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
# you can't live without 'k' and 'p' | |
# kubectl alias | |
alias k='kubectl' | |
# kubectl get pods alias | |
## store Kubernetes pod name & namespace to env variable | |
## expect servername has number behind last - | |
[[ -z $ZSH_NAME ]] || setopt SH_WORD_SPLIT | |
function get-pods() { |
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
# keep you $SHELL as osx bash | |
# modify your term/iterm2/kitty to start your preffered shell (I do zsh, you can start "up to date" bash from `brew`) | |
# gnu cmd links without "g" preffixed | |
mkdir ~/bin-osxoverride | |
for i in $(ls /usr/local/bin/g*) ;do N=$(basename ${i/g//}); ln -sf $i ~/bin-osxoverride/$N; done | |
# update your path | |
echo "export PATH=~/bin-osxoverride:$PATH" >> ~/.zshrc |
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
# p cmd pritns pods in cluster && | |
# store Kubernetes pod name & namespace to env variable | |
[[ -z $ZSH_NAME ]] || setopt SH_WORD_SPLIT | |
function p() { | |
eval $(kubectl get po --all-namespaces -L app -o wide | tee /dev/stderr|awk '{gsub(/.*-/,"",$8);gsub(/-/,"",$10);printf "%s%s=\x27-n %s %s\x27\n", $10,$8, $1, $2}'|grep -v "^="); | |
} | |
p | |
k logs $fluentbit1 |
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
#!/bin/bash | |
if [ $# -lt 2 -o $# -gt 3 ]; then | |
echo | |
echo 'Please provide 2 or 3 arguments.' | |
echo | |
echo 'USAGE: permissions.sh action username directory' | |
echo 'actions: grant, revoke-app, revoke-all' | |
echo 'eg: permissions.sh grant joe $HOME/webapps/django' | |
echo |
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
# hub tool | |
brew install hub | |
# push PR without web-browser forking the repo | |
GIT_USER=epcim | |
alias github-pull-request="hub fork;git push -u $GIT_USER HEAD;hub pull-request" |
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
# Monitoring on interface eth0 | |
tcpdump -i eth0 -n port 67 and port 68 |
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
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist && \ | |
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist && \ | |
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz && \ | |
sudo pkgutil --forget org.macosforge.xquartz.pkg && \ | |
rm -rf ~/.serverauth* && rm -rf ~/.Xauthorit* && rm -rf ~/.cache && rm -rf ~/.rnd && \ | |
rm -rf ~/Library/Caches/org.macosforge.xquartz.X11 && rm -rf ~/Library/Logs/X11 |
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
# wait for background jobs | |
while true; do | |
wait -n || { | |
code="$?" | |
([[ $code = "127" ]] && exit 0 || exit "$code") | |
break | |
} | |
done; | |
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
fu! GenerateUUID() | |
python << EOF | |
import uuid | |
import vim | |
# output a uuid to the vim variable for insertion below | |
vim.command("let generatedUUID = \"%s\"" % str(uuid.uuid4())) | |
EOF |