my eye

Add git, tmux, zsh and solarized theme for terminal

Committed 5d7b95

index 0000000..86b8ca0
--- /dev/null

+[submodule "tmux/.tmux/plugins/tpm"]
+	path = tmux/.tmux/plugins/tpm
+	url = https://github.com/tmux-plugins/tpm
+[submodule "zsh/.zsh/oh-my-zsh"]
+	path = zsh/.zsh/oh-my-zsh
+	url = https://github.com/ohmyzsh/ohmyzsh
+[submodule "solarized-terminal"]
+	path = solarized-terminal
+	url = https://github.com/aruhier/gnome-terminal-colors-solarized

index 0000000..8b371b5
--- /dev/null

+[user]
+    name = Angelo Gladding
+    email = ragt.ag
+    signingkey = F8ABAF20
+[core]
+    excludesfile = ~/.gitignore
+[help]
+    autocorrect = 1
+[color]
+    ui = true
+# [commit]
+#     gpgsign = true
+[push]
+    default = simple
+    followTags = true
+[credential]
+    helper = store
+[credential "https://ragt.ag"]
+    username = owner
+[pull]
+    rebase = false
+[init]
+    defaultBranch = main

index 0000000..2a8ec66
--- /dev/null

+*.swp
+*~
+cover
+.coverage
+test_coverage.xml
+test_results.xml
+.cache
+*.pyc
+dist/
+*.egg
+*.egg-info
+__pycache__
+geckodriver.log
+.pytest_cache
+bin
+main.build
+main.dist
+main.onefile-build
+deps.svg
+deps.json
+admin_key
+admin_key.pub
+poetry.lock
+api_python.json
+package-lock.json
+node_modules
+artifacts
+mounts.json
+debug.log
+ragt.ag
+canopy.garden
+indieweb.rocks
diff --git a/git/.stow-local-ignore b/git/.stow-local-ignore
new file mode 100644
index 0000000..e69de29
diff --git a/solarized-terminal b/solarized-terminal
new file mode 160000
index 0000000..9651c41
--- /dev/null
+++ b/solarized-terminal
@@ -0,0 +1 @@
+Subproject commit 9651c41df0f89e87feee0c798779abba0f9395e0

index 0000000..dee8b94
--- /dev/null

+set-option -g prefix ^g
+set-option -g default-shell $SHELL
+set-option -g status-bg blue
+
+set-window-option -g mode-keys vi
+
+set -g status-left-length 52
+set -g status-right-length 451
+set -g status-fg white
+set -g status-bg colour234
+# XXX set -g window-status-activity-attr bold
+# XXX set -g pane-border-fg colour245
+# XXX set -g pane-active-border-fg colour39
+# XXX set -g message-fg colour16
+# XXX set -g message-bg colour221
+# XXX set -g message-attr bold
+set -g pane-border-status top
+set -g pane-border-format "#{pane_title}"
+
+# set -g status on
+# set -g status-format[0] "#I #W"
+# set -g status-format[1] "#[fg=colour235,bg=colour252,bold] #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold] XXX #[fg=colour238,bg=default]#(uptime -p) #[fg=colour245,bg=default]#(date +'%A %B %-e') #[fg=colour252,bg=default]#(date +'%R') #[fg=colour29,bg=default]#(sh ~/.tmux/tmux_datetime_status.sh) #[fg=colour3,bg=default]#(sh ~/.tmux/tmux_broadcast_status.sh)#[fg=colour5,bg=default]#(sh ~/.tmux/tmux_mining_status.sh)"
+set -g status-left '#[fg=colour235,bg=colour252,bold] #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]'
+set -g status-right "#[fg=colour238,bg=default]#(uptime -p) #[fg=colour245,bg=default]#(date +'%A %B %-e') #[fg=colour252,bg=default]#(date +'%R') #[fg=colour23,bg=default]#(sh ~/.tmux/tmux_utc_status.sh) #[fg=colour29,bg=default]#(sh ~/.tmux/tmux_datetime_status.sh) #[fg=colour3,bg=default]#(sh ~/.tmux/tmux_broadcast_status.sh)#[fg=colour5,bg=default]#(sh ~/.tmux/tmux_mining_status.sh)"
+# set -g window-status-format "#[fg=white,bg=colour234] #I #W "
+set -g window-status-format "#[fg=white,bg=colour234] #I #W "
+set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour25,bg=colour39,noreverse,bold] #I  #W #[fg=colour39,bg=colour234,nobold]"
+
+set-hook -g after-resize-pane 'if "[ #{window_zoomed_flag} -eq 1 ]" "run \"tmux select-pane -P bg=colour0\"" "run \"tmux select-pane -P bg=colour8\""'
+
+set -g mouse on
+# set -g mouse-utf8 on
+bind -n WheelUpPane   select-pane -t= \; copy-mode -e \; send-keys -M
+bind -n WheelDownPane select-pane -t= \;                 send-keys -M
+
+unbind-key ^b
+
+bind-key / command-prompt "split-window 'exec man %%'"
+# bind-key s command-prompt "new-window -n %1 'ssh %1'"
+
+unbind R
+bind R source-file ~/.tmux.conf
+
+unbind ^g
+bind ^g select-pane -t :.+
+
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+
+bind H resize-pane -L 4
+bind J resize-pane -D 4
+bind K resize-pane -U 4
+bind L resize-pane -R 4
+bind C-H resize-pane -L 1
+bind C-J resize-pane -D 1
+bind C-K resize-pane -U 1
+bind C-L resize-pane -R 1
+bind _ resize-pane -U 99\; resize-pane -D 99
+bind Z resize-pane -Z\; send-keys -l ",g"
+
+# bind-key ( run-shell 'amixer set Master 5%-'
+# bind-key ) run-shell 'amixer set Master 5%+'
+
+# bind-key C run-shell 'sh ~/.tmux/spawn_dev_canopy.sh'
+# bind-key L run-shell 'sh ~/.tmux/spawn_dev_liana.sh'
+
+# bind-key P run-shell 'echo p > /home/angelo/.config/pianobar/cmd'
+# bind-key N run-shell 'echo n > /home/angelo/.config/pianobar/cmd'
+# bind-key X run-shell 'echo - > /home/angelo/.config/pianobar/cmd'
+# bind-key + run-shell 'echo + > /home/angelo/.config/pianobar/cmd'
+# bind-key ( run-shell 'echo "(((" > /home/angelo/.config/pianobar/cmd'
+# bind-key ) run-shell 'echo ")))" > /home/angelo/.config/pianobar/cmd'
+
+bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; split-window -l 10 "urlview /tmp/tmux-buffer"
+# bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'
+
+set -g default-terminal "screen-256color"
+
+# set -g @resurrect-strategy-vim 'session'
+# set -g @continuum-save-interval '5'
+# set -g @continuum-restore 'on'
+
+set -g @plugin 'tmux-plugins/tpm'
+set -g @plugin 'tmux-plugins/tmux-sensible'
+# set -g @plugin 'tmux-plugins/tmux-resurrect'
+# set -g @plugin 'tmux-plugins/tmux-continuum'
+
+# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
+run '~/.tmux/plugins/tpm/tpm'

index 0000000..99469c4
--- /dev/null

index 0000000..5448886
--- /dev/null

+python3 <<EOP
+import subprocess
+process_list = subprocess.check_output(["ps", "aux"]).splitlines()
+window_tree = subprocess.check_output(["xwininfo", "-tree", "-root"]).splitlines()
+if [l for l in process_list if b"obs-ffmpeg" in l]:
+    print("ON AIR ")
+elif [l for l in window_tree if b"OBS 2" in l]:
+    print("READY ")
+EOP

index 0000000..949d6a6
--- /dev/null

+python3 <<EOP
+from datetime import datetime
+now = datetime.now()
+ddd = int(now.strftime("%j"))
+bim = int((ddd - 1) / 61 + 1)
+dayinbim = (ddd - 1) % 61 + 1
+seconds = now.hour * 3600 + now.minute * 60 + now.second
+new_time = seconds / 86.4
+print(f"{bim}-{dayinbim}:{new_time:0.0f}")
+EOP

index 0000000..4faf86a
--- /dev/null

+if [ "$(ls ~/mkp224o/onions | grep xxxxxxxxx | wc -l)" != "0" ]; then
+  echo "9x FOUND ";
+fi

index 0000000..611f00b
--- /dev/null

+python3 <<EOP
+from datetime import datetime
+from dateutil import tz
+now = datetime.now(tz=tz.gettz('Europe/London'))
+print(f"{now.strftime('%H:%M')}")
+EOP
diff --git a/zsh/.oh-my-zsh b/zsh/.oh-my-zsh
new file mode 120000
index 0000000..4dc9e28
--- /dev/null
+++ b/zsh/.oh-my-zsh
@@ -0,0 +1 @@
+.zsh/oh-my-zsh
\ No newline at end of file
diff --git a/zsh/.zsh/oh-my-zsh b/zsh/.zsh/oh-my-zsh
new file mode 160000
index 0000000..d157fc6
--- /dev/null
+++ b/zsh/.zsh/oh-my-zsh
@@ -0,0 +1 @@
+Subproject commit d157fc60c93fa59e757921b503e9594bd23b422c
diff --git a/zsh/.zsh/simplified-agnoster.zsh-theme b/zsh/.zsh/simplified-agnoster.zsh-theme
new file mode 100644
index 0000000..f688861
--- /dev/null
+++ b/zsh/.zsh/simplified-agnoster.zsh-theme
+CURRENT_BG='NONE'
+SEGMENT_SEPARATOR=''
+# XXX ZSH_THEME_GIT_PROMPT_DIRTY=' ±'
+
+build_prompt() {
+  RETVAL=$?
+  prompt_status
+  prompt_context
+  prompt_venv
+  prompt_dir
+  prompt_git
+  prompt_hg
+  prompt_end
+}
+
+prompt_segment() {  # takes two arguments, bg and fg, both optional
+  local bg fg
+  [[ -n $1 ]] && bg="%K{$1}" || bg="%k"
+  [[ -n $2 ]] && fg="%F{$2}" || fg="%f"
+  if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
+    echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
+  else
+    echo -n "%{$bg%}%{$fg%} "
+  fi
+  CURRENT_BG=$1
+  [[ -n $3 ]] && echo -n $3
+}
+
+prompt_status() {
+  local symbols
+  symbols=()
+  [[ $RETVAL -ne 0 ]] && symbols+="%{%F{cyan}%}$RETVAL"  # error
+  # [[ $UID -eq 0 ]] && symbols+="%{%F{cyan}%}$"  # root
+  [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}&"  # bg job(s)?
+  [[ -n "$symbols" ]] && prompt_segment black default "$symbols"
+}
+
+prompt_context() {  # user@hostname if not local
+  local user=`whoami`
+  if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
+    prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m"
+  fi
+}
+
+prompt_venv() {
+  if [ $VIRTUAL_ENV ]; then
+    prompt_segment green black `basename $VIRTUAL_ENV`
+  fi
+}
+export VIRTUAL_ENV_DISABLE_PROMPT=1
+
+prompt_dir() {
+  prompt_segment blue black '%~'
+}
+
+prompt_git() {  # branch/detached head, dirty status
+  local ref dirty
+  if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
+    dirty=$(parse_git_dirty)
+    ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
+    if [[ -n $dirty ]]; then
+      prompt_segment yellow black
+    else
+      prompt_segment green black
+    fi
+
+    setopt promptsubst
+    autoload -Uz vcs_info
+
+    zstyle ':vcs_info:*' enable git
+    zstyle ':vcs_info:*' get-revision true
+    zstyle ':vcs_info:*' check-for-changes true
+    zstyle ':vcs_info:*' stagedstr '✚'
+    zstyle ':vcs_info:git:*' unstagedstr '●'
+    zstyle ':vcs_info:*' formats ' %u%c'
+    zstyle ':vcs_info:*' actionformats '%u%c'
+    vcs_info
+    echo -n "${ref/refs\/heads\//⭠ }${vcs_info_msg_0_}"
+  fi
+}
+
+prompt_hg() {
+	local rev status
+	if $(hg id >/dev/null 2>&1); then
+		if $(hg prompt >/dev/null 2>&1); then
+			if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
+				# if files are not added
+				prompt_segment red white
+				st='±'
+			elif [[ -n $(hg prompt "{status|modified}") ]]; then
+				# if any modification
+				prompt_segment yellow black
+				st='±'
+			else
+				# if working copy is clean
+				prompt_segment green black
+			fi
+			echo -n $(hg prompt "⭠ {rev}@{branch}") $st
+		else
+			st=""
+			rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
+			branch=$(hg id -b 2>/dev/null)
+			if `hg st | grep -Eq "^\?"`; then
+				prompt_segment red black
+				st='±'
+			elif `hg st | grep -Eq "^(M|A)"`; then
+				prompt_segment yellow black
+				st='±'
+			else
+				prompt_segment green black
+			fi
+			echo -n "⭠ $rev@$branch" $st
+		fi
+	fi
+}
+
+prompt_end() {  # close open segments
+  if [[ -n $CURRENT_BG ]]; then
+    echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
+  else
+    echo -n "%{%k%}"
+  fi
+  echo -n "%{%f%}"
+  CURRENT_BG=''
+}
+
+PROMPT='%{%f%b%k%}$(build_prompt) '

index 0000000..0772187
--- /dev/null

+ZSH=$HOME/.oh-my-zsh
+ZSH_THEME="../../simplified-agnoster"
+CASE_SENSITIVE="true"
+COMPLETION_WAITING_DOTS="true"
+plugins=(git mercurial poetry)
+source $ZSH/oh-my-zsh.sh
+unsetopt correct_all
+
+## HISTORY ##
+
+export HISTSIZE=250000 SAVEHIST=250000
+STARTING="true"
+LOG=~/.logs/zsh
+function precmd() {
+  if [[ "$STARTING" == "true" ]]; then
+    STARTING="false"
+    return
+  fi
+  if [ "$(id -u)" -ne 0 ]; then
+    echo -n "`/bin/date +%Y-%m-%dT%H:%M:%S.%N` $$ `pwd`" >> ${LOG};
+    echo " !! `fc -l -1 | sed 's/^  *//g' | sed 's/  / /'`" >> ${LOG};
+  fi
+}
+function preexec() {
+  if [ "$(id -u)" -ne 0 ]; then
+    echo -n "`/bin/date +%Y-%m-%dT%H:%M:%S.%N` $$ `pwd`" >> ${LOG};
+    echo " \$\$ $3" >> ${LOG};
+  fi
+}
+
+## AUTOCOMPLETE ##
+
+_force_rehash() {
+  (( CURRENT == 1 )) && rehash
+  return 1
+}
+
+zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete
+
+# nose autocomplete
+autoload -U compinit
+compinit
+autoload -U bashcompinit
+bashcompinit
+# _nosetests() {
+#   cur="${COMP_WORDS[COMP_CWORD]}"
+#   COMPREPLY=(`nosecomplete ${cur} 2>/dev/null`)
+# }
+# complete -o nospace -F _nosetests nosetests
+# 
+# # pip autocomplete
+# function _pip_completion {
+#   local words cword
+#   read -Ac words
+#   read -cn cword
+#   reply=( $( COMP_WORDS="$words[*]" \
+#              COMP_CWORD=$(( cword-1 )) \
+#              PIP_AUTO_COMPLETE=1 $words[1] ) )
+# }
+
+stty stop undef  # unmap ^s
+stty start undef  # unmap ^q
+
+export DEFAULT_USER="angelo"
+export NAME="Angelo Gladding"
+export EMAIL="ragt.ag"  # serves as fallback for git
+export WEBSITE="ragt.ag"
+
+# export TERM="xterm-256color"
+export TERM="screen-256color"
+export EDITOR="vim"
+export PAGER="less"
+export COLORS_ON=True
+
+export LANGUAGE="en_US.UTF-8"
+export LANG="en_us.utf-8"
+export LC_ALL="en_US.UTF-8"
+export TZ="America/Los_Angeles"
+
+export XDG_CONFIG_HOME=$HOME/.config
+
+export PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin  # XXX
+export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games  # XXX
+export PATH=/home/angelo/bin:/home/angelo/.local/bin:$PATH
+export PATH=/home/angelo/.var/nvim/bin:$PATH
+
+export PYTHONDONTWRITEBYTECODE="true"
+export PIP_DOWNLOAD_CACHE=$HOME/.env/pip-download-cache
+export LD_LIBRARY_PATH=$HOME/.env/envs/sys/lib:$LD_LIBRARY_PATH  # POSTGRES
+
+if [ -x /usr/bin/dircolors ]; then
+  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+  alias ls='ls --color=auto'
+  alias grep='grep --color=auto'
+  alias fgrep='fgrep --color=auto'
+  alias egrep='egrep --color=auto'
+fi
+
+alias g='grep'
+alias df='df -h'
+
+alias l='ls -shC1F'
+alias la='l -a'
+alias ll='ls -lhF'
+
+alias tree='tree -Av -I "__pycache__|node_modules|dist"'
+alias t='tree'
+alias ta='tree -a'
+alias t1='tree -L 1'
+alias t2='tree -L 2'
+alias t3='tree -L 3'
+alias t4='tree -L 4'
+alias t5='tree -L 5'
+
+alias loc='pss --py -f | head -n-1 | xargs wc -l | sort -h'
+
+alias dv='killall devilspie2 > /dev/null; nohup devilspie2 > /dev/null 2>&1 &!'
+
+alias pbcopy='xclip -selection clipboard -r'
+alias pbpaste='xclip -selection clipboard -o'
+
+# alias ssh='ssh -o TCPKeepAlive=no -o ServerAliveInterval=15'
+
+alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'  # e.g.: "sleep 10; alert"
+alias pcat='pygmentize -f terminal256 -O style=Solar -g'
+alias free='free -m'
+alias cleanup='pss -ag "((nosetests|coverage).xml|.coverage|.*\.pyc)\$" | xargs --no-run-if-empty rm'
+# alias most_used_history='cat .zsh_history | tr "\|\;" "\n" | sed -e "s/^ //g" | cut -d " " -f 1 | sort | uniq -c | sort -n | tail'
+alias vpn='sudo openvpn /home/angelo/.openvpn/us-california.ovpn'
+alias ring='echo -e "\a"'
+alias dir_status='for dir in $(ls); do echo $dir; git -C $dir status; echo ""; done'
+
+sql() {
+  sqlite3 $1 $2 2> /dev/null
+}
+
+sumlines() {
+  awk '{ sum += $1 } END { print sum }' $1
+}
+
+stats() {
+  radon raw $1 | grep -i $2 | cut -d" " -f6 | sumlines
+}
+
+fs() {
+  du -sh $1/* | sort -hr
+}
+
+vi() {
+  poetry show -q;
+  if [[ $? -ne 0 ]]; then
+    nvim $1;
+  else
+    poetry run nvim $1;
+  fi
+}
+
+colors () {
+  for i in {0..255}
+  do
+    print -Pn "%K{$i}  %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}
+  done
+}
+
+# for termapp in pkg web; do
+#     eval "$(register-python-argcomplete $termapp)"
+# done
+
+# [[ $- != *i* ]] && return  # if not running interactively, exit
+# [[ -z "$TMUX" ]] && exec tmux new -n "~"
+# source /home/angelo/.zsh/zaw/zaw.zsh
+
+export DISABLE_AUTO_TITLE="true"
+
+fpath+=~/.zfunc
+
+export NVM_DIR="$HOME/.config"
+[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
+[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
+
+# source $HOME/.cargo/env
+
+export PYENV_ROOT="$HOME/.pyenv"
+command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
+eval "$(pyenv init -)"
+
+eval "$(pyenv virtualenv-init -)"