Skip to content

Instantly share code, notes, and snippets.

@MartinLuksik
Last active May 5, 2023 10:22
Show Gist options
  • Save MartinLuksik/f506e2d3371326d3b958ae2f9991f480 to your computer and use it in GitHub Desktop.
Save MartinLuksik/f506e2d3371326d3b958ae2f9991f480 to your computer and use it in GitHub Desktop.
[Linux Local] Linux Local #sh #bash #linux #local
# k8s:
# https://kubernetes.io/docs/tasks/tools/included/optional-kubectl-configs-bash-linux/
source <(kubectl completion bash)
alias k='kubectl'
alias wk='watch kubectl'
export do="--dry-run=client -o yaml"
export now="--force --grace-period 0"
complete -F __start_kubectl k
alias k9s='/home/malu/k9s/execs/k9s'
alias busybox='kubectl run --rm -i --tty busybox-ml --image=radial/busyboxplus:curl --restart=Never -- sh'
KUBECONFIG=/mnt/c/users/malu/.kube/config
# az:
alias aztest='az account set --subscription 0000000-0000-0000-0000-0000000'
alias azqa='az account set --subscription 0000000-0000-0000-0000-0000000'
alias azprod='az account set --subscription 0000000-0000-0000-0000-0000000'
alias azoffice='az account set --subscription 0000000-0000-0000-0000-0000000'
alias azsecure='az account set --subscription 0000000-0000-0000-0000-0000000'
alias sshjump='ssh malu@10.0.104.10'
# tf:
export AZDO_PERSONAL_ACCESS_TOKEN=<secret_token>
export AZDO_ORG_SERVICE_URL=https://dev.azure.com/<org>
export PATH=$PATH:$HOME/.tfenv/bin
alias tf='terraform'
# Pulumi
export PATH=$PATH:$HOME/.pulumi/bin
export AZURE_STORAGE_KEY=<storage_key>
export AZURE_STORAGE_ACCOUNT=<storage_name>
export PULUMI_CONFIG_PASSPHRASE=<passphrase>
cd
# Install docker
sudo apt install docker.io
# enable user to start as sudo without pw
sudo visudo
# add to the bottom:
# <username> ALL=(ALL) NOPASSWD: /usr/bin/dockerd
# bashrc:
# Start docker:
RUNNING=`ps aux | grep dockerd | grep -v grep`
if [ -z "$RUNNING" ]; then
sudo dockerd > /dev/null 2>&1 &
disown
fi
## if "az acr login -n tsntestmlacr" doesn't work out of the box:
#### note: the lower auth is based64 for 0000... default user, no need to change
TOKEN=$(az acr login --name tsntestmlacr --expose-token --output tsv --query accessToken)
cat << EOF > /home/malu/.docker/config.json
{
"auths": {
"tsntestmlacr.azurecr.io": {
"auth" : "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwOg==",
"identitytoken": $TOKEN
}
}
}
EOF
## or instead if config.json doesn't get loaded:
az acr login --name tsntestmlacr --expose-token --output tsv --query accessToken | docker login tsntestmlacr.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin
# .git-credentials:
https://<ORG>:<PAT>@dev.azure.com
# .gitconfig:
[user]
email = <USER>@<ORG>.com
name = <NAME>
[credential]
helper = store
# add "cd" at the end of .bashrc to default to /home/malu
# add soft link to windows default directory
ln -s /mnt/c/Users/malu win_home
# how to remove a link
unlink win_home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment