🍯 Glaze

#!/bin/zsh

set -o vi

export HISTFILE=$HOME/.zsh_history
export HISTSIZE=1000000
export SAVEHIST=1000000
export LESSCHARSET=UTF-8

setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt INC_APPEND_HISTORY_TIME
setopt EXTENDED_HISTORY

export EDITOR='nvim'
export GOPATH=$HOME/Go
export PATH=$PATH:$GOPATH/bin

PWD=`dirname $0`
source "$PWD/prompt.sh"

# Zsh
alias sz="source $HOME/.zshrc"

# ls
if [ `uname` = 'Linux' ]; then
  alias ls='ls --color=auto'
fi
alias ll='ls -oah'

# npm
alias nscr="cat package.json | jq -r '.scripts | to_entries[] | \"\u001b[1m\(.key)\u001b[0m\n    $\(.value)\"'"

jwt_decode () {
  jq -R 'split(".") | .[0:2] | map(@base64d) | map(fromjson)' <<< "$1"
}

ridiculusPushDirModified() {
  pushd `git ss | grep ^UU | head -n 1 | cut -d ' ' -f 2 | xargs dirname`
}

sfx() {
  [ -n "$1" ] && oggdec -Q -o - $PWD/sfx/$1.ogg | paplay
}

boop() {
  local ret="$?"
  if [[ "$ret" -eq 0 ]]; then
    sfx good
  else
    sfx bad
  fi
  $(exit "$last")
}

notify() {
  notify-send -a $1 $2 $3
}

timer() {
  sleep "$1"
  sfx good
  notify 'ding ding ding' "$1"
}

# Misc
alias wttr='curl wttr.in/Malmö'
alias tt='fn() { echo -n "\033]2;$1\007" }; fn'
alias gg='cd `git rev-parse --show-toplevel`'
alias puu='ridiculusPushDirModified'
alias re='git ss | grep ^UU | cut -d " " -f 2 | xargs nvim'
alias gbr='git branch --show-current'
alias lofi='mpv --input-ipc-server=/tmp/mpv-$(whoami)-socket https://live.hunter.fm/lofi_low'
alias mpause='socat - /tmp/mpv-$(whoami)-socket <<< "cycle pause"'
alias unvm='nvm install --reinstall-packages-from=node --latest-npm'