This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
alias ls='ls -GFh' | |
alias proxyssh="ssh $1 -oProxyCommand='ssh access -W %h:%p'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azure vm deallocate <rg> <vm> | |
azure vm generalize <rg> <vm> | |
azure vm capture <rg> <vm> <image-prefix> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azure storage container create --connection-string '<dest-cxn>' <dest-container> | |
azure storage blob copy start --connection-string '<source-cxn>' --source-container <source-container> --source-blob <disk.vhd> --dest-connection-string '<dest-cxn>' --dest-container <dest-container> --dest-blob <disk.vhd> | |
# watch copy progress | |
azure storage blob copy show --connection-string '<dest-cxn>' --container <dest-container> --blob <disk.vhd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh -N -D 1080 <user>@<server> | |
# HTTP/HTTPS_PROXY=socks5://127.0.0.1:1080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add alias for lo0 | |
sudo ifconfig lo0 alias 127.0.1.1 up | |
sudo ifconfig lo0 alias 127.0.1.2 up | |
# /etc/hosts alias | |
127.0.1.1 login.microsoftonline.com | |
127.0.1.2 management.azure.com | |
# ssh tunnel | |
sudo ssh -N -L 127.0.1.1:443:login.microsoftonline.com:443 <user>@<jump-server> | |
sudo ssh -N -L 127.0.1.2:443:management.azure.com:443 <user>@<jump-server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azure group create <resource-group> <location> | |
# create storage account for new vm vhds | |
azure storage account create --location <location> --type GRS --resource-group <resource-group> <name> | |
# get connection string(s) for following commands | |
azure storage account connectionstring show --resource-group <resource-group> <name> | |
azure storage container create --connection-string '<dest-cxn>' vhd-base-images | |
# copy blob from base image storage account to resource group that new vm will be in | |
azure storage blob copy start --connection-string '<source-cxn>' --source-container vhd-base-images --source-blob <disk.vhd> --dest-connection-string '<dest-cxn>' --dest-container vhd-base-images | |
# watch copy progress | |
azure storage blob copy show --connection-string '<dest-cxn>' --container vhd-base-images --blob <disk.vhd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azure network nsg create --resource-group <resource-group> --location <location> <nsg-name> | |
azure network nsg rule create --access Allow --protocol Tcp --direction Inbound --priority 100 --source-address-prefix Internet --source-port-range * --destination-address-prefix * --destination-port-range 3389 <resource-group> <nsg-name> allow-rdp | |
azure network nsg rule create --access Allow --protocol Tcp --direction Inbound --priority 100 --source-address-prefix Internet --source-port-range * --destination-address-prefix * --destination-port-range 22 <resource-group> <nsg-name> allow-ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cxn = (azure storage account connectionstring show --json --resource-group <resource-group> <storage-account>) | Out-String | ConvertFrom-Json | |
$sas = (azure storage blob sas create --json -c $cxn.string <container> <blob> r (Get-Date).AddHours(1).ToUniversalTime().ToString("s")) | Out-String | ConvertFrom-Json | |
$sas.url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host * | |
ServerAliveInterval 15 | |
ControlMaster auto | |
# make sure you create this directory: mkdir ~/.ssh/multi | |
ControlPath ~/.ssh/multi/%r@%h-%p | |
ControlPersist 600 | |
Compression yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create files in an otherwise empty directory | |
mkdir files | |
cd files | |
touch setup.sh # entry point after extraction | |
touch file.txt # supporting data used by setup.sh | |
# create archive | |
tar -pczf ../archive.tar.gz * | |
cd .. |