dotfiles/bash.osx

116 lines
3.0 KiB
Bash

# vim: set filetype=sh :
#
# OpenSSL so we can install psychpg2 somedays
# export LDFLAGS="-L/usr/local/opt/openssl/lib"
# export CPPFLAGS="-I/usr/local/opt/openssl/include"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . $NVM_DIR/nvm.sh --no-use # This loads nvm
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
# brew install bash-completion
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
# add homebrew's python pass
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
#Arceo stuff
EKS_CLUSTER=blue
EKS_NAMESPACE=test # there's no sre-staging! use sre-test for grafana, kibana and pgbouncer (rds)
EKS_REGION=us-west-2
KUBECONFIG="$HOME/.kube/config"
for kcfg in "$HOME/.kube/"*.kubeconfig; do
KUBECONFIG="$KUBECONFIG:$kcfg"
done
export KUBECONFIG
tab () {
local cmd=""
local cdto="$PWD"
local args="$@"
if [ -d "$1" ]; then
cdto=`cd "$1"; pwd`
args="${@:2}"
fi
if [ -n "$args" ]; then
cmd="; $args"
fi
osascript <<EOF
tell application "iTerm2"
tell current window
create tab with default profile
tell current session
write text "cd \"$cdto\"$cmd"
end tell
end tell
end tell
EOF
}
new_window () {
local cmd=""
local cdto="$PWD"
local args="$@"
if [ -d "$1" ]; then
cdto=`cd "$1"; pwd`
args="${@:2}"
fi
if [ -n "$args" ]; then
cmd="; $args"
fi
osascript <<EOF
tell application "iTerm2"
set newWindow to (create window with profile "Default")
tell newWindow
tell current session
write text "cd \"$cdto\"$cmd"
end tell
end tell
end tell
EOF
}
alias start-search-web='new_window ~/Work/search-web "./run.sh"; new_window ~/Work/search-web/ "nvm use --delete-prefix; yarn upgrade; yarn run build -- --watch"; cd ~/Work/search-web'
alias dev-watch='tab ~/Work "bundle exec guard"'
alias start-txl='new_window ~/Work/txl "nvm use --delete-prefix; yarn test:watch"; new_window ~/Work/txl "nvm use --delete-prefix; yarn dev-docs"; cd ~/Work/txl; nvm use --delete-prefix;'
add_smudge() {
name=$1
filename=$2
find=$3
replace=$4
git config filter.$name.smudge "sed -e 's/$find/$replace/'"
git config filter.$name.clean "sed -e 's/$replace/$find/'"
touch .git/info/attributes
echo "$filename filter=$name" >> .git/info/attributes
}
convert_video_to_gif() {
SCALE=${3:-"600:-1"}
ffmpeg -y -i "$1" -vf "fps=10,scale=$SCALE:flags=lanczos,palettegen" convert_video_to_gif_palette.png
ffmpeg -y -i "$1" -i convert_video_to_gif_palette.png -filter_complex "fps=10,scale=$SCALE:flags=lanczos[x];[x][1:v]paletteuse" "$2"
rm convert_video_to_gif_palette.png
}
jira() {
local NUMBER=$1
local PREFIX=${2:-"ENG"}
open "https://arceoanalytics.atlassian.net/browse/$PREFIX-$NUMBER"
}