Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/chubin/cheat.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
chubin committed Aug 5, 2020
2 parents 80ded69 + 82d1db3 commit dfc7612
Show file tree
Hide file tree
Showing 14 changed files with 1,562 additions and 1,223 deletions.
19 changes: 12 additions & 7 deletions share/cht.sh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# count words in text counter
# group elements list

__CHTSH_VERSION=6
__CHTSH_DATETIME="2019-06-05 18:00:46 +0200"
__CHTSH_VERSION=0.0.1
__CHTSH_DATETIME="2020-08-05 09:30:30 +0200"

# cht.sh configuration loading
#
Expand Down Expand Up @@ -80,6 +80,8 @@ cheatsh_standalone_install()
local installdir; installdir="$1"
local default_installdir="$HOME/.cheat.sh"

[ -z "$installdir" ] && installdir=${default_installdir}

if [ "$installdir" = help ]; then
cat <<EOF
Install cheat.sh in the standalone mode.
Expand Down Expand Up @@ -128,8 +130,9 @@ EOF
[ "$_exit_code" -ne 0 ] && return "$_exit_code"

while true; do
echo -n "Where should cheat.sh be installed [$default_installdir]? "; read -r installdir
[ -n "$installdir" ] || installdir="$default_installdir"
local _installdir
echo -n "Where should cheat.sh be installed [$installdir]? "; read -r _installdir
[ -n "$_installdir" ] && installdir=$_installdir

if [ "$installdir" = y ] \
|| [ "$installdir" = Y ] \
Expand Down Expand Up @@ -172,8 +175,8 @@ EOF

# after the repository cloned, we may have the log directory
# and we can write our installation log into it
mkdir -p "$installdir/log/"
LOG="$installdir/log/install.log"
mkdir -p "log/"
LOG="$PWD/log/install.log"

# we use tee everywhere so we should set -o pipefail
set -o pipefail
Expand All @@ -184,7 +187,7 @@ EOF
# set PYTHON2 to NO:
# PYTHON2=NO
#
PYTHON2=YES
PYTHON2=NO
if [[ $PYTHON2 = YES ]]; then
python="python2"
pip="pip"
Expand All @@ -199,6 +202,8 @@ EOF
"$python" "$(command -v virtualenv)" "${virtualenv_python3_option[@]}" ve \
|| fatal Could not create virtual environment with "python2 $(command -v virtualenv) ve"

export CHEATSH_PATH_WORKDIR=$PWD

# rapidfuzz does not support Python 2,
# so if we are using Python 2, install fuzzywuzzy instead
if [[ $PYTHON2 = YES ]]; then
Expand Down
5 changes: 4 additions & 1 deletion tests/results/1
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
1_Inheritance
1line
2_Multiple_Inheritance
:learn
:list
Advanced
Classes
Comments
Control_Flow
Control_Flow_and_Iterables
Functions
Modules
Primitive_Datatypes_and_Operators
Expand All @@ -13,6 +15,7 @@ doc
func
hello
lambda
list_comprehension
loops
recursion
rosetta/
1,295 changes: 762 additions & 533 deletions tests/results/15

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/results/16
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

1ns Main memory reference: Send 2,000 bytes Read 1,000,000 bytes
▗▖ 100ns over commodity network: sequentially from SSD:
▗▖ 62ns 61.712us
▗▖ 44ns 48.981us
L1 cache reference: 1ns ▗ ▗ 
▗▖ 1.0us
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖ SSD random read: 16.0us Disk seek: 2.679433ms
Branch mispredict: 3ns  ▗▖▗ ▗▖▗▖ 
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖ SSD random read: 16.0us Disk seek: 2.499999ms
Branch mispredict: 3ns  ▗▖▗ ▗▖▗▖ 
▗▖▗▖▗▖ 
Compress 1KB with Snappy: Read 1,000,000 bytes Read 1,000,000 bytes
Compress 1KB wth Snappy: Read 1,000,000 bytes Read 1,000,000 bytes
L2 cache reference: 4ns 2.0us sequentially from memory: sequentially from disk:
▗▖▗▖▗▖▗▖ ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖ 3.738us 947.322us
▗▖▗▖▗▖▗▖ ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖ 2.967us 824.692us
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖ ▗ ▗ 
Mutex lock/unlock: 16ns  
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖  Round trip Packet roundtrip
Expand Down
66 changes: 33 additions & 33 deletions tests/results/17
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Microsoft Azure CLI 2.0
# Command-line tools for Azure
# Microsoft Azure CLI 2.0
# Command-line tools for Azure

# Install Azure CLI 2.0 with one curl command.
# Install Azure CLI 2.0 with one curl command.
curl -L https://aka.ms/InstallAzureCli | bash

# create a resource group named "MyResourceGroup" in the westus2 region of Azure
az group create -n MyResourceGroup -l westus2 
# create a resource group named "MyResourceGroup" in the westus2 region of Azure
az group create -n MyResourceGroup -l westus2

# create a Linux VM using the UbuntuTLS image, with two attached storage disks of 10 GB and 20 GB
# create a Linux VM using the UbuntuTLS image, with two attached storage disks of 10 GB and 20 GB
az vm create -n MyLinuxVM -g MyResourceGroup --ssh-key-value $HOME/.ssh/id_rsa.pub --image UbuntuLTS --data-disk-sizes-gb 10 20

# list VMs
# list VMs
az vm list --output table

# list only VMs having distinct state
# list only VMs having distinct state
az vm list -d --query "[?powerState=='VM running']" --output table

# delete VM (with the name MyLinuxVM in the group MyResourceGroup)
# delete VM (with the name MyLinuxVM in the group MyResourceGroup)
az vm delete -g MyResourceGroup -n MyLinuxVM --yes

# Delete all VMs in a resource group
# Delete all VMs in a resource group
az vm delete --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)

# Create an Image based on a running VM
# Create an Image based on a running VM
az vm deallocate -g MyResourceGroup -n MyLinuxVM
az vm generalize -g MyResourceGroup -n MyLinuxVM
az image create --resource-group MyResourceGroup --name MyTestImage --source MyLinuxVM

# Running VM based on a VHD
# Running VM based on a VHD
az storage blob upload --account-name "${account_name}" \
 --account-key "${account_key}" --container-name "${container_name}" --type page \
 --file "${file}" --name "${vhd_name}"
Expand All @@ -36,55 +36,55 @@
 --name myManagedDisk \
 --source https://${account_name}.blob.core.windows.net/${container_name}/${vhd_name}

# open port
# open port
az vm open-port --resource-group MyResourceGroup --name MyLinuxVM --port 443 --priority 899

# Show storage accounts
# Show storage accounts
az storage account list --output table

# Show contaniers for an account
# Show contaniers for an account
az storage container list --account-name mystorageaccount --output table

# Show blobs in a container
# Show blobs in a container
az storage blob list --account-name mystorageaccount --container-name mycontainer --output table

# list account keys
# list account keys
az storage account keys list --account-name STORAGE_NAME --resource-group RESOURCE_GROUP

# Show own images
# Show own images
az image list --output table

# Configure default storage location
# Configure default storage location
az configure --defaults location=eastus2

# Show disks
# Show disks
az disk list --output table

# Copy blob
# Copy blob
az storage blob copy start \
 --source-uri 'https://md-ldh5nknx2rkz.blob.core.windows.net/jzwuuuzzapn0/abcd?sv=2017-04-17&sr=b&si=68041718-6828-4f5e-9e6e-a1b719975062&sig=XXX' \
 --account-key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX== \
 --account-name destaccount \
 --destination-container vms \
 --destination-blob DESTINATION-blob.vhd
 --source-uri 'https://md-ldh5nknx2rkz.blob.core.windows.net/jzwuuuzzapn0/abcd?sv=2017-04-17&sr=b&si=68041718-6828-4f5e-9e6e-a1b719975062&sig=XXX' \
 --account-key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX== \
 --account-name destaccount \
 --destination-container vms \
 --destination-blob DESTINATION-blob.vhd

# List virtual networks
# List virtual networks
az network vnet list --output table

# List virtual networks adapters
# List virtual networks adapters
az network nic list --output table

# List public IP addresses used by the VMs
# List public IP addresses used by the VMs
az vm list-ip-addresses --output table

# create snapshot
# create snapshot
az snapshot create --resource-group IC-EXASOL-001 --source vm1-disk1 -n vm1-snap1

# create SAS url for a snapshot
# create SAS url for a snapshot
az snapshot grant-access --resource-group IC-EXASOL-001 --name vm1-snap1 --duration-in-seconds 36000 --query '[accessSas]' -o tsv

# attach disk
# attach disk
az vm disk attach --vm-name vm1 -g RESOURCE_GROUP --disk DISK1_ID

# detach disk
# detach disk
az vm disk detach --vm-name vm1 -g RESOURCE_GROUP --name DISK1_ID
Loading

0 comments on commit dfc7612

Please sign in to comment.