Skip to content

Instantly share code, notes, and snippets.

@Minishlink
Last active January 28, 2023 19:59
Show Gist options
  • Save Minishlink/3abf38444443a9a5c0419c6f95934478 to your computer and use it in GitHub Desktop.
Save Minishlink/3abf38444443a9a5c0419c6f95934478 to your computer and use it in GitHub Desktop.
Cool aliases
eval "$(fnm env --use-on-cd)"
export PATH="$PATH:$(yarn global bin)"
export PATH="$PATH:/Users/louislagrange/.local/bin"
export PATH="$PATH:$(brew --prefix)/opt/python/libexec/bin"
export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
alias gtp="cd $HOME/Projets"
alias kill_sound="sudo kill -9 $(ps aux | grep -e '^_coreaudiod.*/usr/sbin/coreaudiod$' | awk '{print $2}')"
alias arm="env /usr/bin/arch -arm64 /bin/zsh --login"
alias intel="env /usr/bin/arch -x86_64 /bin/zsh --login"
# Android
export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
alias tcprev="adb reverse tcp:8081 tcp:8081"
adbrev() {
adb reverse tcp:${1} tcp:${1}
}
alias adb_capture="adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png && adb shell rm /sdcard/screen.png"
alias adb_menu="adb shell input keyevent 82"
# Git
alias clean_branches='git branch | egrep -v "(master|staging|dev|\*)" | xargs git branch -D'
compress_video() {
ffmpeg -i $1 -tag:v hvc1 -c:v libx265 -c:a copy -x265-params crf=25 $2
}
# Kubernetes
alias k="kubectl"
alias kgp="kubectl get pods"
alias kube_delete_shutdown_pods="kubectl delete pods --field-selector status.phase=Failed -A --ignore-not-found=true"
kube_bash() {
POD_NAME=$(kubectl get pods --field-selector status.phase=Running --no-headers -o custom-columns=":metadata.name" | grep $1 | head -1)
if [ -z "${POD_NAME}" ]; then
echo "pod not found"
else
echo "Bash on $POD_NAME"
kubectl exec -it $POD_NAME -- /bin/sh
fi
}
export PATH="$PATH:$HOME/Projets/anonymize-database/bin"
# Convert video to gif file.
# Usage: video2gif video_file (scale) (fps)
video2gif() {
ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png"
ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".gif
rm "${1}.png"
}
# The next line updates PATH for the Google Cloud SDK.
source "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
# The next line enables shell command completion for gcloud.
source "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
source <(kubectl completion zsh)
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment