···3232alias aic="aicommits --type conventional"
3333alias dots="cd $DOTFILES_DIR && nvim"
34343535+ZAPIER_ZSHENV="${HOME}/code/zapier/team-staff-engineering/seth/zshenv"
3636+3537# if machine name is asteroid..
3636-if [[ $(hostname) == "asteroid" ]]; then
3737- alias mro="glab mr view -w"
3838- alias mktkt=$HOME/dotfiles/scripts/zapier/make-ticket.sh
3939- alias mkmr=$HOME/dotfiles/scripts/zapier/make-mr.sh
4040- alias mkuser=$HOME/dotfiles/scripts/zapier/make-test-user.sh
4141- alias zghorg="ghorg --config ~/code/zapier/ghorg-conf.yaml clone zapier"
4242- alias cdz="cd ~/code/zapier"
3838+if [[ $(hostname) == "asteroid" && -f "${ZAPIER_ZSHENV}" ]]; then
3939+ source "${ZAPIER_ZSHENV}"
4340fi
44414542# Accepts a target markdown file and opens it with firefox.
···4744# Expects the [markdown viewer](https://github.com/simov/markdown-viewer)
4845# FF extension to be installed.
4946function mdp {
5050- local file="${1}"
4747+ local file="${1}"
51485252- # If it isn't already an absolute path, make it one
5353- if [[ ! "$file" == "/"* ]]; then
5454- file="${PWD}/${file}"
5555- fi
4949+ # If it isn't already an absolute path, make it one
5050+ if [[ ! "$file" == "/"* ]]; then
5151+ file="${PWD}/${file}"
5252+ fi
56535757- # If it isn't a markdown file, bail
5858- if [[ ! "$file" == *".md" ]]; then
5959- echo "Must provide a markdown file"
6060- exit 1
6161- fi
5454+ # If it isn't a markdown file, bail
5555+ if [[ ! "$file" == *".md" ]]; then
5656+ echo "Must provide a markdown file"
5757+ exit 1
5858+ fi
62596363- firefox "${file}"
6060+ firefox "${file}"
6461}
65626663function rand {
6767- count=$1
6868- if [ -z "$count" ]; then
6969- count=8
7070- fi
7171- date +%s | shasum | head -c$1
6464+ count=$1
6565+ if [ -z "$count" ]; then
6666+ count=8
6767+ fi
6868+ date +%s | shasum | head -c$1
7269}
73707471function gittmp {
7575- repo_uri=$1
7676- if [ -z "$1" ]; then
7777- echo "must provide a repo to clone"
7878- return 1
7979- fi
7272+ repo_uri=$1
7373+ if [ -z "$1" ]; then
7474+ echo "must provide a repo to clone"
7575+ return 1
7676+ fi
80778181- newdir=$(mktemp -d)
8282- git clone $1 $newdir
7878+ newdir=$(mktemp -d)
7979+ git clone $1 $newdir
83808484- session_name="gittmp-$(rand 4)"
8585- tmux new -A -s $session_name -c $newdir -d
8686- tmux switch -t $session_name
8181+ session_name="gittmp-$(rand 4)"
8282+ tmux new -A -s $session_name -c $newdir -d
8383+ tmux switch -t $session_name
8784}
88858986# Opens for today's note in ~/obsidian/brain/Daily/
9087# Gets timestamp formatted like YYYY-MM-DD.md
9188function dn {
9292- vault="brain"
9393- if [[ $(hostname) == "asteroid" ]]; then
9494- vault="zapier"
9595- fi
8989+ vault="brain"
9090+ if [[ $(hostname) == "asteroid" ]]; then
9191+ vault="zapier"
9292+ fi
96939797- daily_notes="$HOME/.obsidian/${vault}/Daily/"
9898- todays_note="$(date +%Y-%m-%d).md"
9494+ daily_notes="$HOME/.obsidian/${vault}/Daily/"
9595+ todays_note="$(date +%Y-%m-%d).md"
9996100100- cd $daily_notes
101101- nvim -c "Goyo" -c $'normal Go\eo***\eo\eo' -c "startinsert" $todays_note
9797+ cd $daily_notes
9898+ nvim -c "Goyo" -c $'normal Go\eo***\eo\eo' -c "startinsert" $todays_note
10299}
103100104101function gbrowse() {
105105- branch=$(git branch --show-current)
106106- if [ -z "$branch" ]; then
107107- branch=$(git rev-parse HEAD)
108108- fi
102102+ branch=$(git branch --show-current)
103103+ if [ -z "$branch" ]; then
104104+ branch=$(git rev-parse HEAD)
105105+ fi
109106110110- origin=$(git remote get-url origin)
111111- if [[ "$origin" =~ .*gitlab\.com.* ]]; then
112112- # Assume it's on gitlab
113113- # gitlab's cli doesn't have a `browse` command, so do this instead
114114- baseurl=$origin
115115- if [[ "$origin" =~ ^git@gitlab.* ]]; then
116116- baseurl=$(echo $origin | sed 's/git@/https:\/\//' | sed 's/\.com:/\.com\//' | sed 's/\.git$//')
117117- fi
118118- open "$baseurl/-/blob/$branch/$1"
119119- else
120120- # Assume it's on github
121121- gh browse --branch="$branch" $1
122122- fi
107107+ origin=$(git remote get-url origin)
108108+ if [[ "$origin" =~ .*gitlab\.com.* ]]; then
109109+ # Assume it's on gitlab
110110+ # gitlab's cli doesn't have a `browse` command, so do this instead
111111+ baseurl=$origin
112112+ if [[ "$origin" =~ ^git@gitlab.* ]]; then
113113+ baseurl=$(echo $origin | sed 's/git@/https:\/\//' | sed 's/\.com:/\.com\//' | sed 's/\.git$//')
114114+ fi
115115+ open "$baseurl/-/blob/$branch/$1"
116116+ else
117117+ # Assume it's on github
118118+ gh browse --branch="$branch" $1
119119+ fi
123120}
124121125122export HOMEBREW_BUNDLE_FILE="$HOME/dotfiles/Brewfile"