├── ranger └── ranger.config │ ├── plugins │ ├── __init__.py │ └── __init__.pyo │ ├── colorschemes │ ├── __init__.py │ ├── __init__.pyo │ ├── macRanger.pyo │ └── macRanger.py │ ├── tagged │ ├── rc.conf │ ├── scope.sh │ ├── rifle.conf │ └── commands.py ├── system+ ├── env.zsh ├── grc.zsh ├── path.zsh ├── aliases.zsh └── keys.zsh ├── sublime2 ├── User │ ├── Default (Linux).sublime-keymap │ ├── Default (OSX).sublime-keymap │ ├── Default (Windows).sublime-keymap │ ├── Global.sublime-settings │ └── Base File.sublime-settings ├── copy └── setup ├── bin ├── recenter ├── git-all ├── git-amend ├── git-undo ├── quicklook ├── search ├── git-delete-local-merged ├── git-credit ├── qlcat ├── imgcat ├── itermDownload ├── imgcolcat ├── e ├── gitio ├── git-promote ├── testoutput ├── movieme ├── cdTerm.applescript ├── git-up ├── mustacheme ├── git-rank-contributers ├── todo.cfg ├── spark └── git-wtf ├── tmux+ ├── tmux-powerline │ ├── .gitignore │ ├── segments │ │ ├── hostname.sh │ │ ├── time.sh │ │ ├── uptime.sh │ │ ├── date_day.sh │ │ ├── date_full.sh │ │ ├── load.sh │ │ ├── tmux_session_info.sh │ │ ├── battery_mac.sh │ │ ├── Makefile │ │ ├── maildir_inbox_count.sh │ │ ├── lan_ip.sh │ │ ├── mpd_np.sh │ │ ├── wan_ip.sh │ │ ├── weather.sh │ │ ├── battery.sh │ │ └── mpd_np.c │ ├── img │ │ ├── full.png │ │ ├── left-status.png │ │ ├── right-status.png │ │ ├── right-status_no_mail.png │ │ ├── right-status_no_mpd.png │ │ └── right-status_weather_battery.png │ ├── status-left.sh │ ├── status-right.sh │ ├── README.md │ └── lib.sh ├── tmux.zsh └── tmux.conf.symlink ├── ruby+ ├── irbrc.symlink ├── rvm.zsh ├── gemrc.symlink ├── aliases.zsh ├── Gemfile └── Gemfile.lock ├── git+ ├── gitignore.symlink ├── completion.sh ├── gitconfig.symlink.example └── aliases.zsh ├── floobits+ └── floobits.zsh ├── misc+ ├── proBase.symlink └── ycm_extra_conf.py.symlink ├── zsh+ ├── functions.zsh ├── zprofile.symlink ├── config.zsh └── zshrc.symlink ├── vim+ ├── installVundle.sh ├── gvimrc.symlink ├── vimrc.bundles.fork.symlink ├── vimrc.fork.symlink ├── vimrc.bundles.symlink ├── README.markdown └── vimrc.symlink ├── fish+ └── fish.config │ ├── custom │ └── themes │ │ └── thume │ │ ├── fish_right_prompt.fish │ │ └── fish_prompt.fish │ ├── config.fish │ ├── iterm.fish │ └── env.fish ├── .gitignore ├── emacs+ └── editorconfig.symlink ├── ledger+ └── hledger-iadd.config │ └── config.conf ├── osx └── set-defaults.sh ├── License ├── README.markdown ├── pry+ └── pryrc.symlink ├── Rakefile └── hammerspoon └── hammerspoon.symlink ├── tabs.lua └── init.lua /ranger/ranger.config/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /system+/env.zsh: -------------------------------------------------------------------------------- 1 | export EDITOR='vim -f' 2 | -------------------------------------------------------------------------------- /ranger/ranger.config/colorschemes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sublime2/User/Default (Linux).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /sublime2/User/Default (OSX).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /sublime2/User/Default (Windows).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /bin/recenter: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo '!' > /dev/cu.usbmodem1141211 -------------------------------------------------------------------------------- /tmux+/tmux-powerline/.gitignore: -------------------------------------------------------------------------------- 1 | segments/mpd_np 2 | *.swp 3 | -------------------------------------------------------------------------------- /bin/git-all: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Stage all unstaged. 4 | 5 | git add -A 6 | -------------------------------------------------------------------------------- /ruby+/irbrc.symlink: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | require 'pry' 3 | Pry.start || exit 4 | -------------------------------------------------------------------------------- /ruby+/rvm.zsh: -------------------------------------------------------------------------------- 1 | #[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm 2 | -------------------------------------------------------------------------------- /git+/gitignore.symlink: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .svn 3 | .tissues 4 | *~ 5 | *.swp 6 | *.rbc 7 | -------------------------------------------------------------------------------- /tmux+/tmux.zsh: -------------------------------------------------------------------------------- 1 | alias tattach='tmux -2 attach-session -t tbox' 2 | alias texit='tmux detach' 3 | -------------------------------------------------------------------------------- /floobits+/floobits.zsh: -------------------------------------------------------------------------------- 1 | alias floobits='diffshipper --create-room --room-perms 0 -r TBox -o trishume' -------------------------------------------------------------------------------- /misc+/proBase.symlink: -------------------------------------------------------------------------------- 1 | ~/Box/Dev 2 | ~/Library/Application Support/Sublime Text 3/Packages 3 | ~/misc/pro 4 | -------------------------------------------------------------------------------- /zsh+/functions.zsh: -------------------------------------------------------------------------------- 1 | # pro cd function 2 | pd() { 3 | projDir=$(pro search $1) 4 | cd ${projDir} 5 | } 6 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the hostname 3 | hostname 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/time.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the current time. 3 | date +"%H:%M " 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/img/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/tmux+/tmux-powerline/img/full.png -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/uptime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the uptime. 3 | uptime | grep -Pzo "(?<=up )[^,]*" 4 | -------------------------------------------------------------------------------- /bin/git-amend: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Use the last commit message and amend your stuffs. 4 | 5 | git commit --amend -C HEAD 6 | -------------------------------------------------------------------------------- /bin/git-undo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Undo your last commit, but don't throw away your changes 4 | 5 | git reset --soft HEAD^ 6 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/date_day.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the name of the current day. 3 | date +"%a" 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/img/left-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/tmux+/tmux-powerline/img/left-status.png -------------------------------------------------------------------------------- /ranger/ranger.config/plugins/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/ranger/ranger.config/plugins/__init__.pyo -------------------------------------------------------------------------------- /tmux+/tmux-powerline/img/right-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/tmux+/tmux-powerline/img/right-status.png -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/date_full.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Print the current date in ISO 8601 format. 3 | date +"%F" 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /ranger/ranger.config/colorschemes/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/ranger/ranger.config/colorschemes/__init__.pyo -------------------------------------------------------------------------------- /ranger/ranger.config/colorschemes/macRanger.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/ranger/ranger.config/colorschemes/macRanger.pyo -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/load.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Print the average load. 3 | uptime | cut -d "," -f 3- | cut -d ":" -f2 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /system+/grc.zsh: -------------------------------------------------------------------------------- 1 | # GRC colorizes nifty unix tools all over the place 2 | if $(grc &>/dev/null) 3 | then 4 | source `brew --prefix`/etc/grc.bashrc 5 | fi -------------------------------------------------------------------------------- /tmux+/tmux-powerline/img/right-status_no_mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/tmux+/tmux-powerline/img/right-status_no_mail.png -------------------------------------------------------------------------------- /tmux+/tmux-powerline/img/right-status_no_mpd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/tmux+/tmux-powerline/img/right-status_no_mpd.png -------------------------------------------------------------------------------- /tmux+/tmux-powerline/img/right-status_weather_battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trishume/dotfiles/HEAD/tmux+/tmux-powerline/img/right-status_weather_battery.png -------------------------------------------------------------------------------- /bin/quicklook: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | qlmanage -p "$@" 3 | # /Users/tristan/bin/QLTool.app/Contents/MacOS/QLTool p "$@" 4 | osascript -e "tell application \"MacRanger\" to activate" 5 | -------------------------------------------------------------------------------- /bin/search: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Quick search in a directory for a string ($1). 4 | # 5 | set -e 6 | 7 | # use -iru to search directories ack usually ignores (like .git) 8 | ack -i $1 9 | -------------------------------------------------------------------------------- /sublime2/User/Global.sublime-settings: -------------------------------------------------------------------------------- 1 | // Place user-specific overrides in this file, to ensure they're preserved 2 | // when upgrading 3 | { 4 | "theme": "Soda Dark.sublime-theme" 5 | } -------------------------------------------------------------------------------- /system+/path.zsh: -------------------------------------------------------------------------------- 1 | export PATH=".:bin:/usr/local/bin:/usr/local/sbin:$HOME/.sfs:$ZSH/bin:$PATH" 2 | 3 | export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH" 4 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/tmux_session_info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints tmux session info. 3 | # Assuems that [ -n "$TMUX"]. 4 | tmux display-message -p '#S:#I.#P' 5 | 6 | exit 0 7 | -------------------------------------------------------------------------------- /ruby+/gemrc.symlink: -------------------------------------------------------------------------------- 1 | --- 2 | :update_sources: true 3 | :verbose: true 4 | :bulk_threshold: 1000 5 | :backtrace: false 6 | :benchmark: false 7 | :ssl_verify_mode: 0 8 | gem: --no-ri --no-rdoc 9 | -------------------------------------------------------------------------------- /ruby+/aliases.zsh: -------------------------------------------------------------------------------- 1 | alias r='rvm use 1.8.7' 2 | 3 | alias sc='script/console' 4 | alias sg='script/generate' 5 | alias sd='script/destroy' 6 | 7 | alias migrate='rake db:migrate db:test:clone' 8 | -------------------------------------------------------------------------------- /vim+/installVundle.sh: -------------------------------------------------------------------------------- 1 | mkdir ~/.vim 2 | if [ ! -e $HOME/.vim/bundle/vundle ]; then 3 | echo "Installing Vundle" 4 | git clone http://github.com/gmarik/vundle.git $HOME/.vim/bundle/vundle 5 | fi -------------------------------------------------------------------------------- /zsh+/zprofile.symlink: -------------------------------------------------------------------------------- 1 | 2 | 3 | #[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* 4 | #eval $(keychain --eval --agents ssh -Q --quiet id_rsa) 5 | 6 | export PATH="$HOME/.cargo/bin:$PATH" 7 | -------------------------------------------------------------------------------- /fish+/fish.config/custom/themes/thume/fish_right_prompt.fish: -------------------------------------------------------------------------------- 1 | # if test $THIS_MACHINE = "TBook" 2 | # function fish_right_prompt -d 'bobthefish is all about the right prompt' 3 | # set_color 586e75 4 | # date "+%H:%M:%S" 5 | # set_color normal 6 | # end 7 | # end 8 | -------------------------------------------------------------------------------- /sublime2/copy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Since Sublime is fucking insane and can't handle symlinks for the User 3 | # directory, we'll need to manually copy stuff over. 4 | 5 | rm -rf $ZSH/sublime2/User 6 | cp -R ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User $ZSH/sublime2/User 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vim/vim.symlink/.netrwhist 2 | git/gitconfig.symlink 3 | floobits+/floorc.symlink 4 | bin/tboxSync 5 | *.pyo 6 | *.pyc 7 | ranger/ranger.config/bookmarks 8 | ranger/ranger.config/history 9 | fish+/fish.config/fish_history 10 | fish+/fish.config/fishd.* 11 | .DS_Store 12 | -------------------------------------------------------------------------------- /bin/git-delete-local-merged: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Delete all local branches that have been merged into HEAD. Stolen from 4 | # our favorite @tekkub: 5 | # 6 | # https://plus.google.com/115587336092124934674/posts/dXsagsvLakJ 7 | 8 | git branch -d `git branch --merged | grep -v '^*' | tr -d '\n'` 9 | -------------------------------------------------------------------------------- /ranger/ranger.config/tagged: -------------------------------------------------------------------------------- 1 | i:/Users/tristan/Pictures 2 | a:/Applications 3 | w:/Users/tristan/Box/Dev/Website 4 | o:/Users/tristan/Box/Dev 5 | d:/Users/tristan/Downloads 6 | s:/Users/tristan/Library 7 | s:/Library 8 | g:/Users/tristan/Box/Dev/Projects 9 | h:/Users/tristan 10 | c:/Users/tristan/Box 11 | h:/Users 12 | -------------------------------------------------------------------------------- /system+/aliases.zsh: -------------------------------------------------------------------------------- 1 | # grc overides for ls 2 | # Made possible through contributions from generous benefactors like 3 | # `brew install coreutils` 4 | if $(gls &>/dev/null) 5 | then 6 | alias ls="gls -F --color" 7 | alias l="gls -lAh --color" 8 | alias ll="gls -l --color" 9 | alias la='gls -A --color' 10 | fi -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/battery_mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Battery status for Macintosh machines. Borrowed from https://github.com/Meldanya/dotfiles/blob/master/tmux/power.sh 3 | /usr/sbin/ioreg -l | awk 'BEGIN{a=0;b=0} 4 | $0 ~ "MaxCapacity" {a=$5;next} 5 | $0 ~ "CurrentCapacity" {b=$5;nextfile} 6 | END{printf("%d%%", b/a * 100)}' 7 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/Makefile: -------------------------------------------------------------------------------- 1 | # Build the small MPD NP program. 2 | DEBUG=0 3 | CC = $(shell hash clang 2>/dev/null && echo clang || echo gcc) 4 | CFLAGS = -O3 -Wall -std=c99 -I /usr/include/ -D DEBUG=${DEBUG} 5 | LDLIBS = -lmpdclient 6 | 7 | .PHONY: all clean 8 | 9 | 10 | all: mpd_np 11 | 12 | clean: 13 | $(RM) mpd_np 14 | -------------------------------------------------------------------------------- /bin/git-credit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # A very slightly quicker way to credit an author on the latest commit. 4 | # 5 | # $1 - The full name of the author. 6 | # $2 - The email address of the author. 7 | # 8 | # Examples 9 | # 10 | # git credit "Zach Holman" zach@example.com 11 | # 12 | 13 | git commit --amend --author "$1 <$2>" -C HEAD 14 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/maildir_inbox_count.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Return the number of new mails in my Maildir inbox. 3 | 4 | if [ ! -d "$HOME/.mail/inbox/new" ]; then 5 | exit 1 6 | fi 7 | 8 | nbr_new=$(ls $HOME/.mail/inbox/new/ | wc -l) 9 | 10 | if [ "$nbr_new" -gt "0" ]; then 11 | echo "✉ ${nbr_new}" 12 | fi 13 | 14 | exit 0; 15 | -------------------------------------------------------------------------------- /git+/completion.sh: -------------------------------------------------------------------------------- 1 | # Uses git's autocompletion for inner commands. Assumes an install of git's 2 | # bash `git-completion` script at $completion below (this is where Homebrew 3 | # tosses it, at least). 4 | completion=/usr/local/etc/bash_completion.d/git-completion.bash 5 | 6 | if test -f $completion 7 | then 8 | source $completion 9 | fi 10 | -------------------------------------------------------------------------------- /system+/keys.zsh: -------------------------------------------------------------------------------- 1 | # Remove the hosts that I don't want to keep around- in this case, only 2 | # keep the first host. Like a boss. 3 | alias hosts="head -2 ~/.ssh/known_hosts | tail -1 > ~/.ssh/known_hosts" 4 | 5 | # Pipe my public key to my clipboard. Fuck you, pay me. 6 | alias pubkey="more ~/.ssh/id_dsa.public | pbcopy | echo '=> Public key copied to pasteboard.'" -------------------------------------------------------------------------------- /emacs+/editorconfig.symlink: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # Unix-style newlines with a newline ending every file 4 | [*] 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.py] 12 | indent_size = 4 13 | 14 | [*.rs] 15 | indent_size = 4 16 | 17 | [Makefile] 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /bin/qlcat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -eq 0 ]; then 3 | echo "Usage: imgcat file ..." 4 | exit 1 5 | fi 6 | for fn in "$@" 7 | do 8 | if [ -r $fn ] ; then 9 | printf '\033]1337;File=name='`echo -n "$fn" | base64`";" 10 | printf "size=1;inline=1;width=40;" 11 | printf ":q" 12 | printf '\a\n' 13 | else 14 | echo File $fn does not exist. 15 | fi 16 | done 17 | -------------------------------------------------------------------------------- /sublime2/setup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Setup a machine for Sublime Text 2 3 | set -x 4 | 5 | # symlink settings in 6 | sublime_dir=~/Library/Application\ Support/Sublime\ Text\ 2/Packages 7 | mv "$sublime_dir/User" "$sublime_dir/User.backup" 8 | ln -s "$ZSH/sublime2/User" "$sublime_dir" 9 | 10 | # Grab the Soda theme 11 | cd "$sublime_dir" 12 | git clone https://github.com/buymeasoda/soda-theme/ "Theme - Soda" 13 | -------------------------------------------------------------------------------- /vim+/gvimrc.symlink: -------------------------------------------------------------------------------- 1 | " key unbinding 2 | if has("mac") 3 | macm File.New\ Tab key= 4 | macm File.Close key= 5 | macm File.Close\ Window key= 6 | macm File.Print key= 7 | macm Tools.List\ Errors key= 8 | macm Tools.Make key= 9 | endif 10 | 11 | " Remove aqua scrollbars 12 | set guioptions-=rL 13 | " Don't use mac alerts, use vim prompts instead 14 | set guioptions+=c 15 | -------------------------------------------------------------------------------- /ruby+/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem "awesome_print" 3 | gem "bundler" 4 | gem "chunky_png" 5 | gem "cocoapods" 6 | gem "colored" 7 | gem "compass" 8 | gem "fb_graph" 9 | gem "fuzzy_match" 10 | gem "jekyll" 11 | gem "knod" 12 | gem "liquid" 13 | gem "mail" 14 | gem "oozby" 15 | gem "pd" 16 | gem "prawn" 17 | gem "pro" 18 | gem "progress" 19 | gem "pry" 20 | gem "rails" 21 | gem "sinatra" 22 | gem "trogdoro-el4r" 23 | -------------------------------------------------------------------------------- /bin/imgcat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -eq 0 ]; then 3 | echo "Usage: imgcat file ..." 4 | exit 1 5 | fi 6 | for fn in "$@" 7 | do 8 | if [ -r $fn ] ; then 9 | printf '\033]1337;File=name='`echo -n "$fn" | base64`";" 10 | wc -c "$fn" | awk '{printf "size=%d",$1}' 11 | printf ";inline=1" 12 | printf ":" 13 | base64 < "$fn" 14 | printf '\a\n' 15 | else 16 | echo File $fn does not exist. 17 | fi 18 | done 19 | -------------------------------------------------------------------------------- /bin/itermDownload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -ne 1 ]; then 3 | echo "Usage: download.sh file ..." 4 | exit 1 5 | fi 6 | for fn in "$@" 7 | do 8 | if [ -r "$fn" ] ; then 9 | printf '\033]1337;File=name='`echo -n "$fn" | base64`";" 10 | wc -c "$fn" | awk '{printf "size=%d",$1}' 11 | printf ":" 12 | base64 < "$fn" 13 | printf '\a' 14 | else 15 | echo File $fn does not exist or is not readable. 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/lan_ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the local network IP address. 3 | nic0="eth0" 4 | nic1="wlan0" 5 | ip0=$(ifconfig ${nic0} | grep 'inet addr:') 6 | ip1=$(ifconfig ${nic1} | grep 'inet addr:') 7 | if [ -n "$ip0" ]; then 8 | ip="$ip0" 9 | elif [ -n "$ip1" ]; then 10 | ip="$ip1" 11 | fi 12 | 13 | if [ -n "$ip" ]; then 14 | ip=$(echo "$ip" | cut -d: -f2 | awk '{ print $1}') 15 | 16 | #echo "Ⓛ ${ip}" 17 | echo "ⓛ ${ip}" 18 | exit 0 19 | else 20 | exit 1 21 | fi 22 | -------------------------------------------------------------------------------- /bin/imgcolcat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -eq 0 ]; then 3 | echo "Usage: imgcolcat file width" 4 | exit 1 5 | fi 6 | 7 | fn=$1 8 | if [ -r $fn ] ; then 9 | printf '\033]1337;File=name='`echo -n "$fn" | base64`";" 10 | wc -c "$fn" | awk '{printf "size=%d",$1}' 11 | printf ";inline=1" 12 | printf ";width=$(($2-3))" 13 | printf ":" 14 | #base64 < "$fn" 15 | base64 < "$fn" | xargs echo -n 16 | #printf "lolololol" 17 | printf '\a\n' 18 | else 19 | echo File $fn does not exist. 20 | exit 1 21 | fi 22 | -------------------------------------------------------------------------------- /bin/e: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Quick shortcut to an editor. 4 | # 5 | # This means that as I travel back and forth between editors, hey, I don't have 6 | # to re-learn any arcane commands. Neat. 7 | # 8 | # USAGE: 9 | # 10 | # $ e 11 | # # => opens the current directory in your editor 12 | # 13 | # $ e . 14 | # $ e /usr/local 15 | # # => opens the specified directory in your editor 16 | 17 | if [ "$1" = "" ]; then 18 | emacsclient -n -c . 19 | elif [ "$1" = "--" ]; then 20 | emacsclient -n "${@:2}" 21 | else 22 | emacsclient -n "${@:1}" 23 | fi 24 | -------------------------------------------------------------------------------- /ledger+/hledger-iadd.config/config.conf: -------------------------------------------------------------------------------- 1 | # Write this to /Users/tristan/.config/hledger-iadd/config.conf 2 | 3 | # Path to the journal file 4 | file = "/Users/tristan/Box/Life/me.ldg" 5 | 6 | # Format used to parse dates 7 | date-format = "[[%y/]%m/]%d" 8 | 9 | # Algorithm used to find completions for account names. Possible values are: 10 | # - substrings: Every word in the search string has to occur somewhere in the account name 11 | # - fuzzy: All letters from the search string have to appear in the name in the same order 12 | completion-engine = fuzzy 13 | -------------------------------------------------------------------------------- /sublime2/User/Base File.sublime-settings: -------------------------------------------------------------------------------- 1 | // Settings in here override those in "Default/Base File.sublime-settings", and 2 | // are overridden in turn by file type specific settings. Place your settings 3 | // here, to ensure they're preserved when upgrading. 4 | { 5 | "vintage_start_in_command_mode": true, 6 | "tab_size": 2, 7 | "translate_tabs_to_spaces": true, 8 | "drawWhiteSpace": true, 9 | "matchBracketsAngle": true, 10 | "matchBracketsBraces": true, 11 | "matchBracketsSquare": true, 12 | "rulers": [ 80 ], 13 | "show_minimap": false, 14 | "trimTrailingWhiteSpaceOnSave": true, 15 | "highlight_modified_tabs": true 16 | } -------------------------------------------------------------------------------- /bin/gitio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Usage: gitio URL [CODE] 3 | # 4 | # Turns a github.com URL 5 | # into a git.io URL 6 | # 7 | # Created by @defunkt: 8 | # https://gist.github.com/1209316 9 | # 10 | # Copies the git.io URL to your clipboard. 11 | 12 | url = ARGV[0] 13 | code = ARGV[1] 14 | 15 | if url !~ /^(https?:\/\/)?(gist\.)?github.com/ 16 | abort "* github.com URLs only" 17 | end 18 | 19 | if url !~ /^http/ 20 | url = "https://#{url}" 21 | end 22 | 23 | if code 24 | code = "-F code=#{code}" 25 | end 26 | 27 | output = `curl -i http://git.io -F 'url=#{url}' #{code} 2> /dev/null` 28 | if output =~ /Location: (.+)\n?/ 29 | puts $1 30 | `echo #$1 | pbcopy` 31 | else 32 | puts output 33 | end 34 | -------------------------------------------------------------------------------- /zsh+/config.zsh: -------------------------------------------------------------------------------- 1 | # HISTORY 2 | 3 | ## History file configuration 4 | [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history" 5 | HISTSIZE=50000 6 | SAVEHIST=10000 7 | 8 | ## History command configuration 9 | setopt extended_history # record timestamp of command in HISTFILE 10 | setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE 11 | setopt hist_ignore_dups # ignore duplicated commands history list 12 | setopt hist_ignore_space # ignore commands that start with space 13 | setopt hist_verify # show command with history expansion to user before running it 14 | setopt inc_append_history # add commands to HISTFILE in order of execution 15 | setopt share_history # share command history data 16 | -------------------------------------------------------------------------------- /bin/git-promote: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Promotes a local topic branch to a remote tracking branch of the same name, 4 | # by pushing and then setting up the git config 5 | # 6 | # Thanks to ENTP: 7 | # http://hoth.entp.com/2008/11/10/improving-my-git-workflow 8 | 9 | curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') 10 | 11 | remote_branch=$(git branch -r | grep "origin/${curr_branch}") 12 | [ -z "${remote_branch}" ] && ( git push origin "${curr_branch}" ) 13 | 14 | origin=$(git config --get "branch.${curr_branch}.remote") 15 | [ -z "${origin}" ] && ( git config --add "branch.${curr_branch}.remote" origin ) 16 | 17 | merge=$(git config --get "branch.${curr_branch}.merge") 18 | [ -z "${merge}" ] && ( git config --add "branch.${curr_branch}.merge" "refs/heads/${curr_branch}" ) -------------------------------------------------------------------------------- /osx/set-defaults.sh: -------------------------------------------------------------------------------- 1 | # Sets reasonable OS X defaults. 2 | # 3 | # Or, in other words, set shit how I like in OS X. 4 | # 5 | # The original idea (and a couple settings) were grabbed from: 6 | # https://github.com/mathiasbynens/dotfiles/blob/master/.osx 7 | # 8 | # Run ./set-defaults.sh and you'll be good to go. 9 | 10 | # Disable press-and-hold for keys in favor of key repeat 11 | defaults write -g ApplePressAndHoldEnabled -bool false 12 | 13 | # Use AirDrop over every interface. srsly this should be a default. 14 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1 15 | 16 | # Always open everything in Finder's list view. This is important. 17 | defaults write com.apple.Finder FXPreferredViewStyle Nlsv 18 | 19 | # Show the ~/Library folder 20 | chflags nohidden ~/Library 21 | -------------------------------------------------------------------------------- /bin/testoutput: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "yaml" 3 | require "open3" 4 | 5 | conf = YAML.load(IO.read("tests.yml")) 6 | 7 | anyfail = false 8 | conf["tests"].each_with_index do |test,i| 9 | unless conf['command'] && test['in'] && test['out'] 10 | puts "# Invalid test: #{test}" 11 | anyfail = true 12 | next 13 | end 14 | output,status = Open3.capture2(conf['command'], stdin_data: test['in']) 15 | unless status == 0 16 | puts "# Test failed with code #{status}: #{test}" 17 | anyfail = true 18 | next 19 | end 20 | unless output == test['out'] 21 | STDERR.puts "# Test #{i} failed!" 22 | puts "# Output:" 23 | puts output 24 | puts "# Did not match expected:" 25 | puts test['out'] 26 | anyfail = true 27 | next 28 | end 29 | puts "# Passed test #{i}!" 30 | end 31 | exit 1 if anyfail 32 | -------------------------------------------------------------------------------- /vim+/vimrc.bundles.fork.symlink: -------------------------------------------------------------------------------- 1 | let g:spf13_no_autochdir = 1 2 | let g:indent_guides_enable_on_vim_startup = 0 3 | let g:ctrlp_working_path_mode = 'ra' 4 | let g:spf13_bundle_groups=['general', 'programming', 'ruby', 'python', 'javascript', 'html', 'misc'] 5 | Bundle 'trishume/sexy-railscasts-theme' 6 | Bundle 'nanotech/jellybeans.vim' 7 | Bundle 'croaker/mustang-vim' 8 | Bundle 'jpo/vim-railscasts-theme' 9 | "Bundle 'marcus/rsense' 10 | "Bundle 'mikezackles/Bisect' 11 | "Bundle 'aghareza/vim-gitgrep' 12 | "Bundle 'AutoComplPop' 13 | "Bundle 'Valloric/YouCompleteMe' 14 | Bundle 'tpope/vim-endwise' 15 | Bundle 'kana/vim-arpeggio' 16 | Bundle 'kana/vim-filetype-haskell' 17 | "Bundle 'tek/vim-conque' 18 | "Bundle 'skwp/vim-ruby-conque' 19 | "Bundle 'tpope/vim-rails' 20 | Bundle 'rizzatti/funcoo.vim' 21 | Bundle 'rizzatti/dash.vim' 22 | Bundle 'rking/ag.vim' 23 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/mpd_np.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Print a simple line of NP in mpd. 3 | # 4 | # Previously I used something as simple as 5 | #mpc --format "%artist%\n%title%" | grep -Pzo '^(.|\n)*?(?=\[)' | sed ':a;N;$!ba;s/\n/ - /g' | sed 's/\s*-\s$//' | cut -c1-50 6 | # But I decided that I don't want any info about songs if there is nothing playing. Unfortunately I did not find a way of expressing this with mpc (I'm sure there is with idle/idleloop) but I did found a useful library: libmpdclient. I've used version 2.7 when developing my small program. Download the latest version here: http://sourceforge.net/projects/musicpd/files/libmpdclient/ 7 | 8 | cd "$(dirname $0)" 9 | 10 | if [ ! -x "mpd_np" ]; then 11 | make clean all &>/dev/null 12 | fi 13 | if [ -x "mpd_np" ]; then 14 | np=$(mpd_np) 15 | if [ -n "$np" ]; then 16 | echo "♫ ${np}" | cut -c1-50 17 | fi 18 | exit 0 19 | else 20 | exit 1 21 | fi 22 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/wan_ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the WAN IP address. The result is cached and updated according to $update_period. 3 | tmp_file="/tmp/wan_ip.txt" 4 | 5 | wan_ip="" 6 | if [ -f "$tmp_file" ]; then 7 | last_update=$(stat -c "%Y" ${tmp_file}) 8 | time_now=$(date +%s) 9 | update_period=960 10 | 11 | up_to_date=$(echo "(${time_now}-${last_update}) < ${update_period}" | bc) 12 | if [ "$up_to_date" -eq 1 ]; then 13 | wan_ip=$(cat ${tmp_file}) 14 | fi 15 | fi 16 | 17 | if [ -z "$wan_ip" ]; then 18 | #wan_ip=$(wget --timeout=1 --tries=1 -O - http://formyip.com/ 2>/dev/null | grep -Pzo "(?<=Your IP is )[^<]*") 19 | wan_ip=$(wget --timeout=2 --tries=1 -O - http://whatismyip.akamai.com/ 2>/dev/null) 20 | if [ "$?" -eq "0" ]; then 21 | echo "${wan_ip}" > $tmp_file 22 | elif [ -f "${tmp_file}" ]; then 23 | wan_ip=$(cat "$tmp_file") 24 | fi 25 | fi 26 | 27 | if [ -n "$wan_ip" ]; then 28 | #echo "Ⓦ ${wan_ip}" 29 | echo "ⓦ ${wan_ip}" 30 | fi 31 | 32 | exit 0 33 | -------------------------------------------------------------------------------- /bin/movieme: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # MOVIE ME as in: "MOVIE ME AN ANIMATED GIF FROM THIS MOVIE, DAMMIT" 4 | # 5 | # Creates an animated gif from a movie file. Uploads to CloudApp. You must also 6 | # have `gifme` and `cloudapp` in your $PATH. 7 | # 8 | # $1 - the path to the movie we're converting. 9 | # $2 - the start time of the finished product. 10 | # This can be in seconds, or it also accepts the "hh:mm:ss[.xxx]" format. 11 | # $3 - the duration of the video sequence. 12 | # This can be in seconds, or it also accepts the "hh:mm:ss[.xxx]" format. 13 | # 14 | # Examples: 15 | # 16 | # movieme 17 | # ~/Desktop/dr-strangelove.mp4 23:12 3 18 | # ~/Desktop/holman-backflip-on-fire.mov 3.9 1.75 19 | 20 | # cleanup 21 | rm -rf /tmp/movieme 22 | 23 | # create tmp dir 24 | mkdir -p /tmp/movieme 25 | 26 | # split the movie into constituent frames 27 | ffmpeg -i $1 -f image2 -ss $2 -t $3 -r 7 /tmp/movieme/d-%05d.png 28 | 29 | # ANIMATE 30 | gifme /tmp/movieme/* -d 0 31 | -------------------------------------------------------------------------------- /bin/cdTerm.applescript: -------------------------------------------------------------------------------- 1 | on run (arguments) 2 | tell application "iTerm" 3 | -- activate current terminal 4 | -- tell the current terminal 5 | -- set sess to current session 6 | -- 7 | -- tell sess to write "" 8 | -- tell sess to write text "cd \"" & dir & "\"" 9 | -- end tell 10 | set dir to (first item of arguments) 11 | -- set dir to "~/Box/Dev" 12 | repeat with myterm in terminals 13 | tell myterm 14 | set sess to (current session) 15 | tell sess 16 | set the_name to get name 17 | if the_name does not contain "Python" then 18 | tell sess 19 | -- write text "" 20 | write text ("cd " & dir) 21 | end tell 22 | exit repeat 23 | end if 24 | end tell 25 | end tell 26 | end repeat 27 | end tell 28 | -- 29 | -- cdThing(sess, "troll") 30 | end run 31 | 32 | on cdThing(sess, directory) 33 | tell sess 34 | say (get name) 35 | write text "" 36 | write text ("cd \"" & dir & "\"") 37 | end tell 38 | end cdThing 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /git+/gitconfig.symlink.example: -------------------------------------------------------------------------------- 1 | # Sample gitconfig 2 | # 3 | # This is a sample gitconfig. Usually we keep a lot of sensitive information 4 | # here (things like authentication tokens, email addresses, and so on), so this 5 | # file is ignored in this project's .gitignore. 6 | # 7 | # To set this up, rename this file to `gitconfig.symlink` and you'll be able to 8 | # install this to the correct location by running the project's main `rake` 9 | # task. 10 | [user] 11 | name = Zach Holman 12 | email = your@example.com 13 | [alias] 14 | co = checkout 15 | promote = !$ZSH/bin/git-promote 16 | wtf = !$ZSH/bin/git-wtf 17 | rank-contributers = !$ZSH/bin/git-rank-contributers 18 | count = !git shortlog -sn 19 | [color] 20 | diff = auto 21 | status = auto 22 | branch = auto 23 | [core] 24 | excludesfile = ~/.gitignore 25 | editor = mate -w 26 | [apply] 27 | whitespace = nowarn 28 | [github] 29 | user = holman 30 | [mergetool] 31 | keepBackup = false 32 | -------------------------------------------------------------------------------- /bin/git-up: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Usage: git-up 4 | # git-reup 5 | # 6 | # Like git-pull but show a short and sexy log of changes 7 | # immediately after merging (git-up) or rebasing (git-reup). 8 | # 9 | # Inspired by Kyle Neath's `git up' alias: 10 | # http://gist.github.com/249223 11 | # 12 | # Stolen from Ryan Tomayko 13 | # http://github.com/rtomayko/dotfiles/blob/rtomayko/bin/git-up 14 | 15 | set -e 16 | 17 | PULL_ARGS="$@" 18 | 19 | # when invoked as git-reup, run as `git pull --rebase' 20 | test "$(basename $0)" = "git-reup" && 21 | PULL_ARGS="--rebase $PULL_ARGS" 22 | 23 | git pull $PULL_ARGS 24 | 25 | # show diffstat of all changes if we're pulling with --rebase. not 26 | # sure why git-pull only does this when merging. 27 | test "$(basename $0)" = "git-reup" && { 28 | echo "Diff:" 29 | git --no-pager diff --color --stat HEAD@{1}.. | 30 | sed 's/^/ /' 31 | } 32 | 33 | # show an abbreviated commit log of stuff that was just merged. 34 | echo "Log:" 35 | git log --color --pretty=oneline --abbrev-commit HEAD@{1}.. | 36 | sed 's/^/ /' 37 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) Zach Holman, http://zachholman.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /git+/aliases.zsh: -------------------------------------------------------------------------------- 1 | # Use `hub` as our git wrapper: 2 | # http://defunkt.github.com/hub/ 3 | # 4 | # I use JRuby substantially, and we want to make sure hub is run using MRI 5 | # regardless of which Ruby you're using or else the `git status` in your prompt 6 | # will take seven thousand seconds to run `ls`. 7 | # 8 | # I'm hardcoding it to an installed rvm (using rvm's `rvm 1.8.7,ruby /hub/path` 9 | # syntax is way too slow). It should work fine for those without rvm, though. 10 | if [[ -s $HOME/.rvm/scripts/rvm ]] 11 | then 12 | if $(which hub &> /dev/null) && [[ -s $HOME/.rvm/rubies/ruby-1.8.7-p334 ]] 13 | then 14 | alias git='$HOME/.rvm/rubies/ruby-1.8.7-p334/bin/ruby `which hub`' 15 | else 16 | fi 17 | fi 18 | 19 | # The rest of my fun git aliases 20 | alias gl='git pull --prune' 21 | alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" 22 | alias gp='git push origin HEAD' 23 | alias gd='git diff' 24 | alias gc='git commit' 25 | alias gca='git commit -a' 26 | alias gco='git checkout' 27 | alias gb='git branch' 28 | # alias gs='git status -sb' # upgrade your git if -sb breaks for you. it's fun. 29 | alias grm="git status | grep deleted | awk '{print \$3}' | xargs git rm" 30 | 31 | function mkcd 32 | { 33 | dir="$*"; 34 | mkdir -p "$dir" && cd "$dir"; 35 | } 36 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Tristan does dotfiles 2 | 3 | Based off of holman/dotfiles and spf13-vim 4 | 5 | These may not immediately work on your system because of the assumption that you organize things in a folder called ~/Box like I do. 6 | If you change these paths things should work. 7 | 8 | ## components 9 | 10 | There's a few special files in the hierarchy. 11 | 12 | - **bin/**: Anything in `bin/` will get added to your `$PATH` and be made 13 | available everywhere. 14 | - **topic/\*.zsh**: Any files ending in `.zsh` get loaded into your 15 | environment. 16 | - **topic/\*.symlink**: Any files ending in `*.symlink` get symlinked into 17 | your `$HOME`. This is so you can keep all of those versioned in your dotfiles 18 | but still keep those autoloaded files in your home directory. These get 19 | symlinked in when you run `rake install`. 20 | - **topic/\*.completion.sh**: Any files ending in `completion.sh` get loaded 21 | last so that they get loaded after we set up zsh autocomplete functions. 22 | 23 | ## add-ons 24 | 25 | There are a few things I use to make my life awesome. They're not a required 26 | dependency, but if you install them they'll make your life a bit more like a 27 | bubble bath. 28 | 29 | - If you want some more colors for things like `ls`, install grc: `brew install 30 | grc`. 31 | - If you install the excellent [rvm](http://rvm.beginrescueend.com) to manage 32 | multiple rubies, your current branch will show up in the prompt. Bonus. 33 | 34 | -------------------------------------------------------------------------------- /pry+/pryrc.symlink: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | if defined?(PryByebug) 3 | Pry.commands.alias_command 'c', 'continue' 4 | Pry.commands.alias_command 's', 'step' 5 | Pry.commands.alias_command 'n', 'next' 6 | Pry.commands.alias_command 'f', 'finish' 7 | end 8 | 9 | # Hit Enter to repeat last command 10 | Pry::Commands.command /^$/, "repeat last command" do 11 | _pry_.run_command Pry.history.to_a.last 12 | end 13 | 14 | begin 15 | require 'hirb' 16 | rescue LoadError 17 | # Missing goodies, bummer 18 | end 19 | 20 | if defined? Hirb 21 | # Slightly dirty hack to fully support in-session Hirb.disable/enable toggling 22 | Hirb::View.instance_eval do 23 | def enable_output_method 24 | @output_method = true 25 | @old_print = Pry.config.print 26 | Pry.config.print = proc do |*args| 27 | Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args) 28 | end 29 | end 30 | 31 | def disable_output_method 32 | Pry.config.print = @old_print 33 | @output_method = nil 34 | end 35 | end 36 | 37 | Hirb.enable 38 | end 39 | 40 | # === CONVENIENCE METHODS === 41 | # Stolen from https://gist.github.com/807492 42 | # Use Array.toy or Hash.toy to get an array or hash to play with 43 | class Array 44 | def self.toy(n=10, &block) 45 | block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1} 46 | end 47 | end 48 | 49 | class Hash 50 | def self.toy(n=10) 51 | Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})] 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/status-left.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #Print the status-left for tmux. 3 | # 4 | # Enter the script directory so we easily can use the other scripts. 5 | cd "$(dirname $0)" 6 | 7 | # Source lib functions. 8 | . ./lib.sh 9 | 10 | # Segments 11 | 12 | declare -A tmux_session_info 13 | tmux_session_info+=(["script"]="${segments_path}/tmux_session_info.sh") 14 | tmux_session_info+=(["foreground"]="colour234") 15 | tmux_session_info+=(["background"]="colour148") 16 | tmux_session_info+=(["separator"]="${separator_right_bold}") 17 | #tmux_session_info+=(["separator_fg"]="default") 18 | register_segment "tmux_session_info" 19 | 20 | declare -A hostname 21 | hostname+=(["script"]="${segments_path}/hostname.sh") 22 | hostname+=(["foreground"]="colour0") 23 | hostname+=(["background"]="colour33") 24 | hostname+=(["separator"]="${separator_right_bold}") 25 | register_segment "hostname" 26 | 27 | declare -A lan_ip 28 | lan_ip+=(["script"]="${segments_path}/lan_ip.sh") 29 | lan_ip+=(["foreground"]="colour255") 30 | lan_ip+=(["background"]="colour24") 31 | lan_ip+=(["separator"]="${separator_right_bold}") 32 | register_segment "lan_ip" 33 | 34 | declare -A wan_ip 35 | wan_ip+=(["script"]="${segments_path}/wan_ip.sh") 36 | wan_ip+=(["foreground"]="colour255") 37 | wan_ip+=(["background"]="colour24") 38 | wan_ip+=(["separator"]="${separator_right_thin}") 39 | wan_ip+=(["separator_fg"]="white") 40 | register_segment "wan_ip" 41 | 42 | # Print the status line in the order of registration above. 43 | print_status_line_left 44 | 45 | exit 0 46 | -------------------------------------------------------------------------------- /ranger/ranger.config/rc.conf: -------------------------------------------------------------------------------- 1 | set using_macranger_app true 2 | 3 | set preview_images false 4 | set use_preview_script false 5 | 6 | set column_ratios 1,3,3 7 | 8 | set vcs_backend_git local 9 | set collapse_preview false 10 | set dirname_in_tabs true 11 | set update_title true 12 | 13 | setlocal path=~/Downloads sort ctime 14 | setlocal path=~/Downloads sort_directories_first false 15 | 16 | alias find scout -aefst 17 | alias search_inc scout -rtsi 18 | alias travel scout -aefklst 19 | 20 | map quickLook 21 | map e mark_files toggle=True 22 | 23 | map pd console pro 24 | 25 | unmap gm 26 | unmap ge 27 | unmap gM 28 | unmap go 29 | unmap gu 30 | unmap gv 31 | unmap gl 32 | unmap gL 33 | unmap g? 34 | 35 | map gd cd ~/Downloads 36 | map gb cd ~/Box 37 | map gc cd ~/Box/Dev 38 | map gf cd ~/Box/Dev/Dotfiles 39 | map gp cd ~/Box/Dev/Projects 40 | map gs cd ~/Pictures 41 | map gv cd /Volumes/ 42 | 43 | map E shell -s e %f 44 | map O shell -s e . 45 | map D shell -s osascript ~/Box/Dev/Dotfiles/bin/cdTerm.applescript "%d" 46 | 47 | map zz shell zip -r -X %f %f 48 | 49 | map cd console mkdir 50 | map cf console touch 51 | 52 | map dt trash 53 | 54 | map / console search_inc 55 | 56 | map tn tab_new ~ 57 | map tc tab_close 58 | map td tab_close 59 | map te tab_open e 60 | map ts tab_open s 61 | map t1 tab_open 1 62 | map t2 tab_open 2 63 | map t3 tab_open 3 64 | map t4 tab_open 4 65 | map t5 tab_open 5 66 | map t6 tab_open 6 67 | map t7 tab_open 7 68 | map t8 tab_open 8 69 | map t9 tab_open 9 70 | 71 | map o open_with 0 72 | -------------------------------------------------------------------------------- /bin/mustacheme: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # mustacheme 4 | # expanded from an idea from Rick Olson (@technoweenie) 5 | # 6 | # Takes a .gif, splits it into constituent frames, mustaches each, restitches 7 | # the gif, and uploads to cloudapp. 8 | # 9 | # This leverages the nifty service mustachify.me, which will analyze your photo, 10 | # identify faces, and add a mustache to your image. 11 | # 12 | # If the .gif is a remote file, we'll download it and blow it up locally. 13 | # 14 | # $1 - the path of the gif 15 | # 16 | # Examples: 17 | # 18 | # mustacheme holman-jumping-off-cliff-into-butter.gif 19 | # mustacheme http://github.com/holman/butter/blob/master/holman-butter.gif 20 | # 21 | # Dependencies: 22 | # 23 | # - ImageMagick. If you're on a Mac, run: 24 | # brew install imagemagick 25 | # - wget 26 | # - cloudapp: https://github.com/holman/dotfiles/blob/master/bin/cloudapp 27 | # - gifme: https://github.com/holman/gifme 28 | 29 | set -e 30 | 31 | # Set up mustacheme temporary working directory 32 | output=/tmp/mustacheme 33 | rm -rf $output 34 | mkdir $output 35 | 36 | if [[ $1 == http* ]] 37 | then 38 | wget $1 -O /tmp/mustache-download.gif 39 | file=/tmp/mustache-download.gif 40 | else 41 | file="$1" 42 | fi 43 | 44 | # Blow apart the GIF 45 | convert $1 -coalesce $output/frame_%03d.gif 46 | 47 | # Mustache each frame 48 | for frame in $output/*.gif 49 | do 50 | url=$(cloudapp $frame | grep Uploaded | awk '{print substr($0, index($0, "http://"))}') 51 | url="$url/$(basename $frame)" 52 | wget "http://mustachify.me/?src=$url" -O "$frame-stache" 53 | done 54 | 55 | # Ding! Fries are done. 56 | gifme $output/*-stache -d 0 57 | -------------------------------------------------------------------------------- /zsh+/zshrc.symlink: -------------------------------------------------------------------------------- 1 | # shortcut to this dotfiles path is $ZSH 2 | export ZSH=$HOME/Box/Dev/Dotfiles 3 | 4 | # your project folder that we can `c [tab]` to 5 | export PROJECTS=~/Box/Dev 6 | export SITE_DEPLOY_PATH=~/Box/Sites/thume 7 | export LEDGER_FILE=~/Box/Life/me.ldg 8 | 9 | test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" 10 | 11 | # OPAM configuration 12 | . /Users/tristan/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true 13 | 14 | # The next line updates PATH for the Google Cloud SDK. 15 | if [ -f '/Users/tristan/bin/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/tristan/bin/google-cloud-sdk/path.zsh.inc'; fi 16 | 17 | # The next line enables shell command completion for gcloud. 18 | if [ -f '/Users/tristan/bin/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/tristan/bin/google-cloud-sdk/completion.zsh.inc'; fi 19 | 20 | ### Added by Zplugin's installer 21 | source '/Users/tristan/.zplugin/bin/zplugin.zsh' 22 | autoload -Uz _zplugin 23 | (( ${+_comps} )) && _comps[zplugin]=_zplugin 24 | ### End of Zplugin's installer chunk 25 | 26 | export SLIMLINE_SYMBOL_WORKING_FORMAT="%F{white}∙%f" 27 | export SLIMLINE_RIGHT_PROMPT_SECTIONS="execution_time exit_status virtualenv git" 28 | export SLIMLINE_MAX_EXEC_TIME="1" 29 | zplugin light mengelbrecht/slimline 30 | 31 | zplugin ice wait"0" blockf lucid 32 | zplugin light zsh-users/zsh-completions 33 | 34 | export ZSH_AUTOSUGGEST_USE_ASYNC=yah 35 | zplugin ice wait"1" atload"_zsh_autosuggest_start" lucid 36 | zplugin light zsh-users/zsh-autosuggestions 37 | 38 | zplugin ice wait"0" atinit"zpcompinit; zpcdreplay" lucid 39 | zplugin light zdharma/fast-syntax-highlighting 40 | 41 | # source every .zsh file in this rep 42 | for config_file ($ZSH/**/*.zsh) source $config_file 43 | 44 | # use .localrc for SUPER SECRET CRAP that you don't 45 | # want in your public, versioned repo. 46 | # if [[ -a ~/.localrc ]] 47 | # then 48 | # source ~/.localrc 49 | # fi 50 | -------------------------------------------------------------------------------- /fish+/fish.config/config.fish: -------------------------------------------------------------------------------- 1 | # Path to your oh-my-fish. 2 | set fish_path $HOME/.oh-my-fish 3 | set -x FISH $HOME/.config/fish 4 | 5 | if test (hostname) = "Tbox3" 6 | set -x THIS_MACHINE TBox 7 | else if test (hostname) = "WikiBox" -o (hostname) = "WikiBox2" 8 | set -x THIS_MACHINE WikiBox 9 | else if test (hostname) = "vagrant.myshopify.io" 10 | set -x THIS_MACHINE Vagrant 11 | else if test (hostname) = "Tristans-MacBook-Pro.local" 12 | set -x THIS_MACHINE WorkBook 13 | else 14 | set -x THIS_MACHINE TBook 15 | end 16 | 17 | . $FISH/env.fish 18 | 19 | set fish_custom $HOME/.config/fish/custom 20 | set fish_theme thume 21 | 22 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-fish/plugins/*) 23 | # Custom plugins may be added to ~/.oh-my-fish/custom/plugins/ 24 | # Example format: set fish_plugins autojump bundler 25 | if test $THIS_MACHINE = "TBook" 26 | set fish_plugins localhost balias 27 | else if test $THIS_MACHINE = "WikiBox" 28 | set fish_plugins 29 | else 30 | set fish_plugins localhost percol gi rvm 31 | end 32 | 33 | # Load oh-my-fish configuration. 34 | . $fish_path/oh-my-fish.fish 35 | 36 | set fish_greeting '' 37 | 38 | function fish_title 39 | echo (basename $PWD) 40 | end 41 | 42 | function fish_user_key_bindings 43 | bind \cr percol_select_history 44 | end 45 | 46 | function pd 47 | cd (pro search $argv) 48 | end 49 | 50 | function r --description 'Cd the current ranger tab' 51 | curl -X POST --data $PWD http://localhost:5964/cd 52 | end 53 | 54 | function ranger_shell_tab --on-variable PWD --description 'Update the ranger tab' 55 | curl -X POST --data $PWD --connect-timeout 0.05 http://localhost:5964/cdtab-s 2> /dev/null 56 | end 57 | 58 | function ensimeServer 59 | /Users/tristan/Library/Application\ Support/Sublime\ Text\ 3/Packages/Ensime/serverStart.sh .ensime 60 | end 61 | 62 | alias git hub 63 | alias be "bundle exec" 64 | alias tattach "tmux -2 attach-session -t tbox" 65 | alias e "emacsclient -a vim -n -c" 66 | alias scp-resume "rsync --partial -av --progress --rsh=ssh" 67 | 68 | if test $THIS_MACHINE = "TBook" 69 | . $FISH/iterm.fish 70 | end 71 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | 3 | desc "Hook our dotfiles into system-standard positions." 4 | task :install do 5 | mac = `uname -s`.chomp == "Darwin" 6 | linkables = Dir.glob(mac ? '*/**{.symlink,.config}' : '*+/**{.symlink,.config}') 7 | 8 | skip_all = false 9 | overwrite_all = false 10 | backup_all = false 11 | 12 | linkables.each do |linkable| 13 | overwrite = false 14 | backup = false 15 | 16 | if linkable.include?('.config') 17 | file = linkable.split('/').last.split('.config').last 18 | target = "#{ENV["HOME"]}/.config/#{file}" 19 | puts "Linking config: #{target}" 20 | else 21 | file = linkable.split('/').last.split('.symlink').last 22 | target = "#{ENV["HOME"]}/.#{file}" 23 | end 24 | 25 | if File.exists?(target) || File.symlink?(target) 26 | next if skip_all 27 | unless skip_all || overwrite_all || backup_all 28 | puts "File already exists: #{target}, what do you want to do? [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all" 29 | case STDIN.gets.chomp 30 | when 'o' then overwrite = true 31 | when 'b' then backup = true 32 | when 'O' then overwrite_all = true 33 | when 'B' then backup_all = true 34 | when 'S' then skip_all = true 35 | when 's' then next 36 | end 37 | end 38 | FileUtils.rm_rf(target) if overwrite || overwrite_all 39 | `mv "#{target}" "#{target}.backup"` if backup || backup_all 40 | end 41 | `ln -s "$PWD/#{linkable}" "#{target}"` 42 | end 43 | end 44 | 45 | task :uninstall do 46 | 47 | Dir.glob('**/*.symlink').each do |linkable| 48 | 49 | file = linkable.split('/').last.split('.symlink').last 50 | target = "#{ENV["HOME"]}/.#{file}" 51 | 52 | # Remove all symlinks created during installation 53 | if File.symlink?(target) 54 | FileUtils.rm(target) 55 | end 56 | 57 | # Replace any backups made during installation 58 | if File.exists?("#{ENV["HOME"]}/.#{file}.backup") 59 | `mv "$HOME/.#{file}.backup" "$HOME/.#{file}"` 60 | end 61 | 62 | end 63 | end 64 | 65 | task :default => 'install' 66 | -------------------------------------------------------------------------------- /bin/git-rank-contributers: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ## git-rank-contributors: a simple script to trace through the logs and 4 | ## rank contributors by the total size of the diffs they're responsible for. 5 | ## A change counts twice as much as a plain addition or deletion. 6 | ## 7 | ## Output may or may not be suitable for inclusion in a CREDITS file. 8 | ## Probably not without some editing, because people often commit from more 9 | ## than one address. 10 | ## 11 | ## git-rank-contributors Copyright 2008 William Morgan . 12 | ## This program is free software: you can redistribute it and/or modify 13 | ## it under the terms of the GNU General Public License as published by 14 | ## the Free Software Foundation, either version 3 of the License, or (at 15 | ## your option) any later version. 16 | ## 17 | ## This program is distributed in the hope that it will be useful, 18 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | ## GNU General Public License for more details. 21 | ## 22 | ## You can find the GNU General Public License at: 23 | ## http://www.gnu.org/licenses/ 24 | 25 | class String 26 | def obfuscate; gsub(/@/, " at the ").gsub(/\.(\w+)(>|$)/, ' dot \1s\2') end 27 | def htmlize; gsub("&", "&").gsub("<", "<").gsub(">", ">") end 28 | end 29 | 30 | lines = {} 31 | verbose = ARGV.delete("-v") 32 | obfuscate = ARGV.delete("-o") 33 | htmlize = ARGV.delete("-h") 34 | 35 | author = nil 36 | state = :pre_author 37 | `git log -M -C -C -p --no-color`.split("\n").each do |l| 38 | case 39 | when (state == :pre_author || state == :post_author) && l =~ /Author: (.*)$/ 40 | author = $1 41 | state = :post_author 42 | lines[author] ||= 0 43 | when state == :post_author && l =~ /^\+\+\+/ 44 | state = :in_diff 45 | when state == :in_diff && l =~ /^[\+\-]/ 46 | lines[author] += 1 47 | when state == :in_diff && l =~ /^commit / 48 | state = :pre_author 49 | end 50 | end 51 | 52 | lines.sort_by { |a, c| -c }.each do |a, c| 53 | a = a.obfuscate if obfuscate 54 | a = a.htmlize if htmlize 55 | if verbose 56 | puts "#{a}: #{c} lines of diff" 57 | else 58 | puts a 59 | end 60 | end -------------------------------------------------------------------------------- /misc+/ycm_extra_conf.py.symlink: -------------------------------------------------------------------------------- 1 | import os 2 | import ycm_core 3 | 4 | default_flags = [ 5 | '-Wall', 6 | '-Wextra', 7 | '-Wc++98-compat', 8 | '-Wno-long-long', 9 | '-Wno-variadic-macros', 10 | '-fexceptions', 11 | '-DNDEBUG', 12 | '-std=c++11', 13 | '-x', 14 | 'c++', 15 | # This path will only work on OS X, but extra paths that don't exist are not harmful 16 | '-isystem' 17 | '/System/Library/Frameworks/Python.framework/Headers', 18 | '-isystem', 19 | '/usr/include', 20 | '-isystem', 21 | '/usr/local/include', 22 | '-isystem', 23 | '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1', 24 | '-isystem', 25 | '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include', 26 | ] 27 | 28 | def DirectoryOfThisScript(): 29 | return os.path.dirname( os.path.abspath( __file__ ) ) 30 | 31 | 32 | def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): 33 | if not working_directory: 34 | return list( flags ) 35 | new_flags = [] 36 | make_next_absolute = False 37 | path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] 38 | for flag in flags: 39 | new_flag = flag 40 | 41 | if make_next_absolute: 42 | make_next_absolute = False 43 | if not flag.startswith( '/' ): 44 | new_flag = os.path.join( working_directory, flag ) 45 | 46 | for path_flag in path_flags: 47 | if flag == path_flag: 48 | make_next_absolute = True 49 | break 50 | 51 | if flag.startswith( path_flag ): 52 | path = flag[ len( path_flag ): ] 53 | new_flag = path_flag + os.path.join( working_directory, path ) 54 | break 55 | 56 | if new_flag: 57 | new_flags.append( new_flag ) 58 | return new_flags 59 | 60 | # Thanks to https://github.com/decrispell/vim-config for this code 61 | def FlagsForFile( filename, **kwargs ): 62 | """ given the source filename, return the compiler flags """ 63 | opt_basename = '.clang_complete' 64 | curr_dir = os.path.dirname(filename) 65 | opt_fname = os.path.join(curr_dir, opt_basename) 66 | # keep traversing up the tree until we find the file, or hit the root 67 | while not os.path.exists(opt_fname): 68 | new_dir = os.path.dirname(curr_dir) 69 | if new_dir == curr_dir: 70 | # we've reached the root of the tree 71 | break 72 | curr_dir = new_dir 73 | opt_fname = os.path.join(curr_dir, opt_basename) 74 | try: 75 | fd = open(opt_fname, 'r') 76 | except IOError: 77 | return {'flags': default_flags, 'do_cache': True} 78 | flags = [line.strip() for line in fd.readlines()] 79 | relative_to = os.path.dirname(opt_fname) 80 | flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to) 81 | return { 82 | 'flags': default_flags+flags, 'do_cache': True 83 | } 84 | -------------------------------------------------------------------------------- /bin/todo.cfg: -------------------------------------------------------------------------------- 1 | # === EDIT FILE LOCATIONS BELOW === 2 | 3 | # Your todo.txt directory 4 | export TODO_DIR="/Users/tristan/Dropbox/todo" 5 | #export TODO_DIR=`dirname "$0"` 6 | 7 | # Your todo/done/report.txt locations 8 | export TODO_FILE="$TODO_DIR/todo.txt" 9 | export DONE_FILE="$TODO_DIR/done.txt" 10 | export REPORT_FILE="$TODO_DIR/report.txt" 11 | export TMP_FILE="$TODO_DIR/todo.tmp" 12 | 13 | # You can customize your actions directory location 14 | #export TODO_ACTIONS_DIR="$HOME/.todo.actions.d" 15 | 16 | # == EDIT FILE LOCATIONS ABOVE === 17 | 18 | # === COLOR MAP === 19 | 20 | ## Text coloring and formatting is done by inserting ANSI escape codes. 21 | ## If you have re-mapped your color codes, or use the todo.txt 22 | ## output in another output system (like Conky), you may need to 23 | ## over-ride by uncommenting and editing these defaults. 24 | ## If you change any of these here, you also need to uncomment 25 | ## the defaults in the COLORS section below. Otherwise, todo.txt 26 | ## will still use the defaults! 27 | 28 | # export BLACK='\\033[0;30m' 29 | # export RED='\\033[0;31m' 30 | # export GREEN='\\033[0;32m' 31 | # export BROWN='\\033[0;33m' 32 | # export BLUE='\\033[0;34m' 33 | # export PURPLE='\\033[0;35m' 34 | # export CYAN='\\033[0;36m' 35 | # export LIGHT_GREY='\\033[0;37m' 36 | # export DARK_GREY='\\033[1;30m' 37 | # export LIGHT_RED='\\033[1;31m' 38 | # export LIGHT_GREEN='\\033[1;32m' 39 | # export YELLOW='\\033[1;33m' 40 | # export LIGHT_BLUE='\\033[1;34m' 41 | # export LIGHT_PURPLE='\\033[1;35m' 42 | # export LIGHT_CYAN='\\033[1;36m' 43 | # export WHITE='\\033[1;37m' 44 | # export DEFAULT='\\033[0m' 45 | 46 | # === COLORS === 47 | 48 | ## Uncomment and edit to override these defaults. 49 | ## Reference the constants from the color map above, 50 | ## or use $NONE to disable highlighting. 51 | # 52 | # Priorities can be any upper-case letter. 53 | # A,B,C are highlighted; you can add coloring for more. 54 | # 55 | # export PRI_A=$YELLOW # color for A priority 56 | # export PRI_B=$GREEN # color for B priority 57 | # export PRI_C=$LIGHT_BLUE # color for C priority 58 | # export PRI_D=... # define your own 59 | # export PRI_X=$WHITE # color unless explicitly defined 60 | 61 | # There is highlighting for tasks that have been done, 62 | # but haven't been archived yet. 63 | # 64 | # export COLOR_DONE=$LIGHT_GREY 65 | 66 | # === BEHAVIOR === 67 | 68 | ## customize list output 69 | # 70 | # TODOTXT_SORT_COMMAND will filter after line numbers are 71 | # inserted, but before colorization, and before hiding of 72 | # priority, context, and project. 73 | # 74 | # export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -f -k2' 75 | 76 | # TODOTXT_FINAL_FILTER will filter list output after colorization, 77 | # priority hiding, context hiding, and project hiding. That is, 78 | # just before the list output is displayed. 79 | # 80 | # export TODOTXT_FINAL_FILTER='cat' 81 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/status-right.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script prints a string will be evaluated for text attributes (but not shell commands) by tmux. It consists of a bunch of segments that are simple shell scripts/programs that output the information to show. For each segment the desired foreground and background color can be specified as well as what separator to use. The script the glues together these segments dynamically so that if one script suddenly does not output anything (= nothing should be shown) the separator colors will be nicely handled. 3 | 4 | # Enter the script directory so we easily can use the other scripts. 5 | cd "$(dirname $0)" 6 | 7 | # Source lib functions. 8 | . ./lib.sh 9 | 10 | # Segment 11 | # Comment/uncomment the register function call to enable or disable a segment. 12 | 13 | declare -A mail_count 14 | mail_count+=(["script"]="${segments_path}/maildir_inbox_count.sh") 15 | mail_count+=(["foreground"]="white") 16 | mail_count+=(["background"]="red") 17 | mail_count+=(["separator"]="${separator_left_bold}") 18 | register_segment "mail_count" 19 | 20 | declare -A mpd_np 21 | mpd_np+=(["script"]="${segments_path}/mpd_np.sh") 22 | mpd_np+=(["foreground"]="colour37") 23 | mpd_np+=(["background"]="colour234") 24 | mpd_np+=(["separator"]="${separator_left_bold}") 25 | register_segment "mpd_np" 26 | 27 | declare -A load 28 | load+=(["script"]="${segments_path}/load.sh") 29 | load+=(["foreground"]="colour167") 30 | load+=(["background"]="colour237") 31 | load+=(["separator"]="${separator_left_bold}") 32 | register_segment "load" 33 | 34 | declare -A battery 35 | battery+=(["script"]="${segments_path}/battery.sh") 36 | battery+=(["foreground"]="colour127") 37 | battery+=(["background"]="colour137") 38 | battery+=(["separator"]="${separator_left_bold}") 39 | #register_segment "battery" 40 | 41 | declare -A weather 42 | weather+=(["script"]="${segments_path}/weather.sh") 43 | weather+=(["foreground"]="colour255") 44 | weather+=(["background"]="colour37") 45 | weather+=(["separator"]="${separator_left_bold}") 46 | register_segment "weather" 47 | 48 | declare -A date_day 49 | date_day+=(["script"]="${segments_path}/date_day.sh") 50 | date_day+=(["foreground"]="colour136") 51 | date_day+=(["background"]="colour235") 52 | date_day+=(["separator"]="${separator_left_bold}") 53 | register_segment "date_day" 54 | 55 | declare -A date_full 56 | date_full+=(["script"]="${segments_path}/date_full.sh") 57 | date_full+=(["foreground"]="colour136") 58 | date_full+=(["background"]="colour235") 59 | date_full+=(["separator"]="${separator_left_thin}") 60 | date_full+=(["separator_fg"]="default") 61 | register_segment "date_full" 62 | 63 | declare -A time 64 | time+=(["script"]="${segments_path}/time.sh") 65 | time+=(["foreground"]="colour136") 66 | time+=(["background"]="colour235") 67 | time+=(["separator"]="${separator_left_thin}") 68 | time+=(["separator_fg"]="default") 69 | register_segment "time" 70 | 71 | # Print the status line in the order of registration above. 72 | print_status_line_right 73 | 74 | exit 0 75 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/weather.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Prints the current weather in Celsius, Fahrenheits or lord Kelvins. The forecast is cached and updated with a period of $update_period. 3 | 4 | # You location. Find a string that works for you by Googling on "weather in " 5 | location="Lund, Sweden" 6 | 7 | # Can be any of {c,f,k}. 8 | unit="c" 9 | 10 | tmp_file="/tmp/weather.txt" 11 | 12 | get_condition_symbol() { 13 | local conditions=$(echo "$1" | tr '[:upper:]' '[:lower:]') 14 | case "$conditions" in 15 | sunny | "partly sunny" | "mostly sunny") 16 | echo "☀" 17 | #echo "☼" 18 | ;; 19 | "rain and snow" | "chance of rain" | "light rain" | rain | "freezing drizzle" | flurries | showers | "scattered showers") 20 | #echo "☂" 21 | echo "☔" 22 | ;; 23 | snow | "light snow" | "scattered snow showers" | icy | ice/snow | "chance of snow" | "snow showers" | sleet) 24 | #echo "☃" 25 | echo "❅" 26 | ;; 27 | "partly cloudy" | "mostly cloudy" | cloudy | overcast) 28 | echo "☁" 29 | ;; 30 | "chance of storm" | thunderstorm | "chance of tstorm" | storm | "scattered thunderstorms") 31 | #echo "⚡" 32 | echo "☈" 33 | ;; 34 | dust | fog | smoke | haze | mist) 35 | echo "♨" 36 | ;; 37 | windy) 38 | echo "⚑" 39 | #echo "⚐" 40 | ;; 41 | clear) 42 | #echo "☐" 43 | echo "✈" # So clear you can see the aeroplanes! 44 | ;; 45 | *) 46 | echo "?" 47 | ;; 48 | esac 49 | } 50 | 51 | read_tmp_file() { 52 | if [ ! -f "$tmp_file" ]; then 53 | return 54 | fi 55 | IFS_bak="$IFS" 56 | IFS=$'\n' 57 | lines=($(cat ${tmp_file})) 58 | IFS="$IFS_bak" 59 | degrees="${lines[0]}" 60 | conditions="${lines[1]}" 61 | } 62 | 63 | degrees="" 64 | if [ -f "$tmp_file" ]; then 65 | last_update=$(stat -c "%Y" ${tmp_file}) 66 | time_now=$(date +%s) 67 | update_period=960 68 | 69 | up_to_date=$(echo "(${time_now}-${last_update}) < ${update_period}" | bc) 70 | if [ "$up_to_date" -eq 1 ]; then 71 | read_tmp_file 72 | fi 73 | fi 74 | 75 | if [ -z "$degrees" ]; then 76 | if [ "$unit" == "k" ]; then 77 | search_unit="c" 78 | else 79 | search_unit="$unit" 80 | fi 81 | search_location=$(echo "$location" | sed -e 's/\s/%20/g') 82 | 83 | weather_data=$(curl --max-time 2 -s "http://www.google.com/ig/api?weather=${search_location}") 84 | if [ "$?" -eq "0" ]; then 85 | degrees=$(echo "$weather_data" | sed "s|.*.*|\1|") 86 | conditions=$(echo "$weather_data" | grep -Pzo "(\\n|.)*" | grep -Pzo "(?<= $tmp_file 88 | echo "$conditions" >> $tmp_file 89 | elif [ -f "$tmp_file" ]; then 90 | read_tmp_file 91 | fi 92 | fi 93 | 94 | if [ -n "$degrees" ]; then 95 | if [ "$unit" == "k" ]; then 96 | degrees=$(echo "${degrees} + 273.15" | bc) 97 | fi 98 | unit_upper=$(echo "$unit" | tr '[cfk]' '[CFK]') 99 | condition_symbol=$(get_condition_symbol "$conditions") 100 | echo "${condition_symbol} ${degrees}°${unit_upper}" 101 | fi 102 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/README.md: -------------------------------------------------------------------------------- 1 | # tmux-powerline 2 | This is a set of scripts (segments) for making a nice and dynamic tmux status-bar where elements can come and disappears depending on events. I really like the look of [Lokaltog/vim-powerline](https://github.com/Lokaltog/vim-powerline) and I decided I wanted the same for tmux. 3 | 4 | The following segments exists for now: 5 | * LAN & WAN IP addresses. 6 | * MPD now playing (requires [libmpdclient](http://sourceforge.net/projects/musicpd/files/libmpdclient/)). 7 | * Maildir check. 8 | * GNU Linux and Macintosh OS X battery status (uses [richo/dotfiles/bin/battery](https://github.com/richoH/dotfiles/blob/master/bin/battery)). 9 | * Weather in Celcius, Farenheit and Kelvin! 10 | * System load and uptime. 11 | * Date and time. 12 | * Hostname. 13 | * tmux info. 14 | 15 | # Screenshots 16 | **Full screenshot** 17 | 18 | ![Full screenshot](https://github.com/erikw/tmux-powerline/raw/master/img/full.png) 19 | 20 | **left-status** 21 | 22 | Current tmux session, window and pane, hostname and LAN&WAN IP address. 23 | 24 | ![left-status](https://github.com/erikw/tmux-powerline/raw/master/img/left-status.png) 25 | 26 | **right-status** 27 | 28 | New mails, now playing in MPD, average load, date and time. 29 | 30 | ![right-status](https://github.com/erikw/tmux-powerline/raw/master/img/right-status.png) 31 | 32 | Now I've read my inbox so the maildir segment disappears! 33 | 34 | ![right-status, no mail](https://github.com/erikw/tmux-powerline/raw/master/img/right-status_no_mail.png) 35 | 36 | `mpc pause` and there's no need for showing NP anymore. 37 | 38 | ![right-status, no mpd](https://github.com/erikw/tmux-powerline/raw/master/img/right-status_no_mpd.png) 39 | 40 | Weather segment using Google's weather API and remaining battery. 41 | 42 | ![right-status, no mpd](https://github.com/erikw/tmux-powerline/raw/master/img/right-status_weather_battery.png) 43 | 44 | # Configuration 45 | To use the scripts; set the following in your `~/.tmux.conf`: 46 | 47 | set-option -g status on 48 | set-option -g status-interval 5 49 | set-option -g status-utf8 on 50 | set-option -g status-justify "centre" 51 | set-option -g status-left-length 60 52 | set-option -g status-right-length 120 53 | set-option -g status-left "#(~/path/to/tmux-powerline/status-left.sh)" 54 | set-option -g status-right "#(~/path/to//tmux-powerline/status-right.sh)" 55 | 56 | Also I recommend you to use the [tmux-colors-solarized](https://github.com/seebi/tmux-colors-solarized) theme (as well as solarized for [everything else](http://ethanschoonover.com/solarized) :)): 57 | 58 | source ~/path/to/tmux-colors-solarized/tmuxcolors.conf 59 | 60 | Now edit the two scripts to suit you needs. The segments can be move around and does not needs to be in the order (or same file) as they are now. It should be quite easy to add you own segments. 61 | 62 | $$EDITOR ~/path/to/tmux-powerline/status-left.sh 63 | $$EDITOR ~/path/to/tmux-powerline/status-right.sh 64 | 65 | # Notes 66 | It's written over a night and in Bash so be prepared for the ugliness. I had some interesting design ideas but after hours of struggling with associative arrays that could not be declare where and how I wanted etc. I just went with the ugly way(s) :-P 67 | -------------------------------------------------------------------------------- /fish+/fish.config/iterm.fish: -------------------------------------------------------------------------------- 1 | if begin; status --is-interactive; and not functions -q -- iterm2_status; and [ "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != screen ]; end 2 | function iterm2_status 3 | printf "\033]133;D;%s\007" $argv 4 | end 5 | 6 | # Mark start of prompt 7 | function iterm2_prompt_mark 8 | printf "\033]133;A\007" 9 | end 10 | 11 | # Mark end of prompt 12 | function iterm2_prompt_end 13 | printf "\033]133;B\007" 14 | end 15 | 16 | # Tell terminal to create a mark at this location 17 | function iterm2_preexec 18 | # For other shells we would output status here but we can't do that in fish. 19 | printf "\033]133;C;\007" 20 | end 21 | 22 | # Usage: iterm2_set_user_var key value 23 | # These variables show up in badges (and later in other places). For example 24 | # iterm2_set_user_var currentDirectory "$PWD" 25 | # Gives a variable accessible in a badge by \(user.currentDirectory) 26 | # Calls to this go in iterm2_print_user_vars. 27 | function iterm2_set_user_var 28 | printf "\033]1337;SetUserVar=%s=%s\007" "$argv[1]" (printf "%s" "$argv[2]" | base64 | tr -d "\n") 29 | end 30 | 31 | # iTerm2 inform terminal that command starts here 32 | function iterm2_precmd 33 | printf "\033]1337;RemoteHost=%s@%s\007\033]1337;CurrentDir=$PWD\007" $USER $iterm2_hostname 34 | 35 | # Users can define a function called iterm2_print_user_vars. 36 | # It should call iterm2_set_user_var and produce no other output. 37 | if functions -q -- iterm2_print_user_vars 38 | iterm2_print_user_vars 39 | end 40 | 41 | end 42 | 43 | functions -c fish_prompt iterm2_fish_prompt 44 | 45 | functions -c fish_mode_prompt iterm2_fish_mode_prompt 46 | function fish_mode_prompt --description 'Write out the mode prompt; do not replace this. Instead, change fish_mode_prompt before sourcing .iterm2_shell_integration.fish, or modify iterm2_fish_mode_prompt instead.' 47 | set -l last_status $status 48 | 49 | iterm2_status $last_status 50 | if not functions iterm2_fish_prompt | grep iterm2_prompt_mark > /dev/null 51 | iterm2_prompt_mark 52 | end 53 | sh -c "exit $last_status" 54 | 55 | iterm2_fish_mode_prompt 56 | end 57 | 58 | function fish_prompt --description 'Write out the prompt; do not replace this. Instead, change fish_prompt before sourcing .iterm2_shell_integration.fish, or modify iterm2_fish_prompt instead.' 59 | # Remove the trailing newline from the original prompt. This is done 60 | # using the string builtin from fish, but to make sure any escape codes 61 | # are correctly interpreted, use %b for printf. 62 | printf "%b" (string join "\n" (iterm2_fish_prompt)) 63 | 64 | iterm2_prompt_end 65 | end 66 | 67 | function underscore_change -v _ 68 | if [ x$_ = xfish ] 69 | iterm2_precmd 70 | else 71 | iterm2_preexec 72 | end 73 | end 74 | 75 | # If hostname -f is slow for you, set iterm2_hostname before sourcing this script 76 | if not set -q iterm2_hostname 77 | set iterm2_hostname (hostname -f 2>/dev/null) 78 | # some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option 79 | if test $status -ne 0 80 | set iterm2_hostname (hostname) 81 | end 82 | end 83 | 84 | iterm2_precmd 85 | printf "\033]1337;ShellIntegrationVersion=6;shell=fish\007" 86 | end 87 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/lib.sh: -------------------------------------------------------------------------------- 1 | # Library functions. 2 | 3 | segments_path="./segments" 4 | declare entries 5 | 6 | # Separators 7 | separator_left_bold="◀" 8 | separator_left_thin="❮" 9 | separator_right_bold="▶" 10 | separator_right_thin="❯" 11 | 12 | 13 | # Register a segment. 14 | register_segment() { 15 | segment_name="$1" 16 | entries[${#entries[*]}]="$segment_name" 17 | 18 | } 19 | 20 | print_status_line_right() { 21 | local prev_bg="colour235" 22 | for entry in ${entries[*]}; do 23 | local script=$(eval echo \${${entry}["script"]}) 24 | local foreground=$(eval echo \${${entry}["foreground"]}) 25 | local background=$(eval echo \${${entry}["background"]}) 26 | local separator=$(eval echo \${${entry}["separator"]}) 27 | local separator_fg="" 28 | if [ $(eval echo \${${entry}["separator_fg"]+_}) ];then 29 | separator_fg=$(eval echo \${${entry}["separator_fg"]}) 30 | fi 31 | 32 | local output=$(${script}) 33 | if [ -z "$output" ]; then 34 | continue 35 | fi 36 | __ui_right "$prev_bg" "$background" "$foreground" "$separator" "$separator_fg" 37 | echo -n "$output" 38 | prev_bg="$background" 39 | done 40 | # End in a clean state. 41 | echo "#[default]" 42 | } 43 | 44 | first_segment_left=1 45 | print_status_line_left() { 46 | prev_bg="colour148" 47 | for entry in ${entries[*]}; do 48 | local script=$(eval echo \${${entry}["script"]}) 49 | local foreground=$(eval echo \${${entry}["foreground"]}) 50 | local background=$(eval echo \${${entry}["background"]}) 51 | local separator=$(eval echo \${${entry}["separator"]}) 52 | local separator_fg="" 53 | if [ $(eval echo \${${entry}["separator_fg"]+_}) ];then 54 | separator_fg=$(eval echo \${${entry}["separator_fg"]}) 55 | fi 56 | 57 | local output=$(${script}) 58 | if [ -z "$output" ]; then 59 | continue 60 | fi 61 | __ui_left "$prev_bg" "$background" "$foreground" "$separator" "$separator_fg" 62 | echo -n "$output" 63 | prev_bg="$background" 64 | if [ "$first_segment_left" -eq "1" ]; then 65 | first_segment_left=0 66 | fi 67 | done 68 | __ui_left "colour235" "colour235" "red" "$separator_right_bold" "$prev_bg" 69 | 70 | # End in a clean state. 71 | echo "#[default]" 72 | } 73 | 74 | #Internal printer for right. 75 | __ui_right() { 76 | local bg_left="$1" 77 | local bg_right="$2" 78 | local fg_right="$3" 79 | local separator="$4" 80 | local separator_fg 81 | if [ -n "$5" ]; then 82 | separator_fg="$5" 83 | else 84 | separator_fg="$bg_right" 85 | fi 86 | echo -n " #[fg=${separator_fg}, bg=${bg_left}]${separator}#[fg=${fg_right},bg=${bg_right}] " 87 | } 88 | 89 | # Internal printer for left. 90 | __ui_left() { 91 | local bg_left="$1" 92 | local bg_right="$2" 93 | local fg_right="$3" 94 | local separator 95 | if [ "$first_segment_left" -eq "1" ]; then 96 | separator="" 97 | else 98 | separator="$4" 99 | fi 100 | 101 | local separator_fg 102 | if [ -n "$5" ]; then 103 | bg_left="$5" 104 | separator_bg="$bg_right" 105 | else 106 | separator_bg="$bg_right" 107 | fi 108 | 109 | if [ "$first_segment_left" -eq "1" ]; then 110 | echo -n "#[bg=${bg_right}]" 111 | fi 112 | 113 | echo -n " #[fg=${bg_left}, bg=${separator_bg}]${separator}#[fg=${fg_right},bg=${bg_right}]" 114 | 115 | if [ "$first_segment_left" -ne "1" ]; then 116 | echo -n " " 117 | fi 118 | } 119 | -------------------------------------------------------------------------------- /tmux+/tmux-powerline/segments/battery.sh: -------------------------------------------------------------------------------- 1 | # NOTE I have note written this. I cloned it from https://github.com/richoH/dotfiles/blob/master/bin/battery and just made somemodifications so it works for my laptop. Check that URL for more recent versions. 2 | #!/bin/sh 3 | #CUTE_BATTERY_INDICATOR="true" 4 | 5 | HEART_FULL=♥ 6 | HEART_EMPTY=♡ 7 | [ -z "$NUM_HEARTS" ] && 8 | NUM_HEARTS=5 9 | 10 | cutinate() 11 | { 12 | perc=$1 13 | inc=$(( 100 / $NUM_HEARTS)) 14 | 15 | 16 | for i in `seq $NUM_HEARTS`; do 17 | if [ $perc -lt 100 ]; then 18 | echo $HEART_EMPTY 19 | else 20 | echo $HEART_FULL 21 | fi 22 | perc=$(( $perc + $inc )) 23 | done 24 | } 25 | 26 | linux_get_bat () 27 | { 28 | bf=$(cat $BAT_FULL) 29 | bn=$(cat $BAT_NOW) 30 | echo $(( 100 * $bn / $bf )) 31 | } 32 | 33 | freebsd_get_bat () 34 | { 35 | echo "$(sysctl -n hw.acpi.battery.life)" 36 | 37 | } 38 | 39 | # Do with grep and awk unless too hard 40 | 41 | # TODO Identify which machine we're on from teh script. 42 | 43 | battery_status() 44 | { 45 | case $(uname -s) in 46 | "Linux") 47 | BATPATH=/sys/class/power_supply/BAT1 48 | STATUS=$BATPATH/status 49 | BAT_FULL=$BATPATH/charge_full 50 | BAT_NOW=$BATPATH/charge_now 51 | if [ "$1" = `cat $STATUS` -o "$1" = "" ]; then 52 | linux_get_bat 53 | fi 54 | ;; 55 | "FreeBSD") 56 | STATUS=`sysctl -n hw.acpi.battery.state` 57 | case $1 in 58 | "Discharging") 59 | if [ $STATUS -eq 1 ]; then 60 | freebsd_get_bat 61 | fi 62 | ;; 63 | "Charging") 64 | if [ $STATUS -eq 2 ]; then 65 | freebsd_get_bat 66 | fi 67 | ;; 68 | "") 69 | freebsd_get_bat 70 | ;; 71 | esac 72 | ;; 73 | "Darwin") 74 | case $1 in 75 | "Discharging") 76 | ext="No";; 77 | "Charging") 78 | ext="Yes";; 79 | esac 80 | 81 | ioreg -c AppleSmartBattery -w0 | \ 82 | grep -o '"[^"]*" = [^ ]*' | \ 83 | sed -e 's/= //g' -e 's/"//g' | \ 84 | sort | \ 85 | while read key value; do 86 | case $key in 87 | "MaxCapacity") 88 | export maxcap=$value;; 89 | "CurrentCapacity") 90 | export curcap=$value;; 91 | "ExternalConnected") 92 | if [ "$ext" != "$value" ]; then 93 | exit 94 | fi 95 | ;; 96 | "FullyCharged") 97 | if [ "$value" = "Yes" ]; then 98 | exit 99 | fi 100 | ;; 101 | esac 102 | if [[ -n "$maxcap" && -n $curcap ]]; then 103 | echo $(( 100 * $curcap / $maxcap )) 104 | break 105 | fi 106 | done 107 | esac 108 | } 109 | 110 | BATTERY_STATUS=`battery_status $1` 111 | [ -z "$BATTERY_STATUS" ] && exit 112 | 113 | if [ -n "$CUTE_BATTERY_INDICATOR" ]; then 114 | echo `cutinate $BATTERY_STATUS` 115 | else 116 | echo "${HEART_FULL} ${BATTERY_STATUS}%" 117 | #echo "⛁ ${BATTERY_STATUS}%" 118 | fi 119 | 120 | -------------------------------------------------------------------------------- /bin/spark: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # spark 4 | # https://github.com/holman/spark 5 | # 6 | # Generates sparklines for a set of data. 7 | # 8 | # Here's a a good web-based sparkline generator that was a bit of inspiration 9 | # for spark: 10 | # 11 | # https://datacollective.org/sparkblocks 12 | # 13 | # spark takes a comma-separated list of data and then prints a sparkline out of 14 | # it. 15 | # 16 | # Examples: 17 | # 18 | # spark 1,5,22,13,53 19 | # # => ▁▁▃▂▇ 20 | # 21 | # spark 0,30,55,80,33,150 22 | # # => ▁▂▃▅▂▇ 23 | # 24 | # spark -h 25 | # # => Prints the spark help text. 26 | set -e 27 | 28 | # Prints the help text for spark. 29 | # 30 | # Returns nothing. 31 | help() 32 | { 33 | echo "spark\n" 34 | echo "USAGE:" 35 | echo " spark [comma,separated,value,list]\n" 36 | echo "EXAMPLES:" 37 | echo " spark 1,5,22,13,53" 38 | echo " ▁▁▃▂▇" 39 | echo " spark 0,30,55,80,33,150" 40 | echo " ▁▂▃▅▂▇" 41 | } 42 | 43 | # The actual fun characters we are generating in the sparkline. 44 | ticks=(▁ ▂ ▃ ▅ ▆ ▇) 45 | 46 | # The numbers the user gave us. 47 | numbers=() 48 | 49 | # The sorted array of the numbers. 50 | sorted=() 51 | 52 | # This sets up our secondary array so we can actually generate the correct 53 | # tick. 54 | # 55 | # Returns nothing. 56 | setup_array() { 57 | # 3,6,2 => 2,3,6 58 | sorted=$(echo $1 | tr ',' '\n' | sort -k1,1n | paste -s -d',' -) 59 | 60 | # convert comma-separated string to array 61 | IFS=, 62 | sorted=($sorted) 63 | numbers=($1) 64 | } 65 | 66 | # The maximum value of the sorted array. In other words, the last value. 67 | sort_max() 68 | { 69 | last=${#sorted[@]} 70 | echo ${sorted[$last - 1]} 71 | } 72 | 73 | # The minimum value of the sorted array. In other words, the first value. 74 | sort_min() 75 | { 76 | echo ${sorted[0]} 77 | } 78 | 79 | # Find the distance between tiers so we know which tick to assign a character. 80 | tier() 81 | { 82 | number_of_ticks=${#ticks[@]} 83 | distance=$(echo "$(sort_max) / $number_of_ticks" | bc) 84 | echo $distance 85 | } 86 | 87 | # Determines what tick we should print for this number and prints it. 88 | # 89 | # Returns nothing. 90 | print_tick() 91 | { 92 | tier=$(tier) 93 | 94 | for (( i = 0 ; i < ${#numbers[@]} ; i++ )) 95 | do 96 | tick=${ticks[$i]} 97 | number=$1 98 | less_than=$(echo "$i * $tier + sort_min + $tier" | bc) 99 | greater_than=$(echo "($i - 1) * $tier + sort_min + $tier" | bc) 100 | result=$(echo "$number <= $less_than && $number >= $greater_than" | bc) 101 | 102 | if [ $result -eq 1 ] 103 | then 104 | echo "$tick" 105 | return 106 | fi 107 | done 108 | 109 | last=${#ticks[@]} 110 | echo ${ticks[$last-1]} 111 | } 112 | 113 | # Iterate over all of our ticks and print them out. 114 | # 115 | # Returns nothing. 116 | print_ticks() 117 | { 118 | for number in ${numbers[@]} 119 | do 120 | echo $"$(print_tick $number)\c" 121 | done 122 | echo "" 123 | } 124 | 125 | while getopts ":h" option; do 126 | case "$option" in 127 | h) help && exit ;; 128 | # [?]) echo "$OPTARG";; 129 | esac 130 | done 131 | 132 | # Accept input from $1 or from the pipeline. 133 | if test "$1" != "" 134 | then 135 | data="$1" 136 | else 137 | data='' 138 | 139 | # check to see if stdin's a tty 140 | if [ -t 0 ]; then 141 | help 142 | exit 143 | fi 144 | 145 | while read data; do 146 | data=$data 147 | break 148 | done 149 | fi 150 | 151 | setup_array $data 152 | print_ticks $data 153 | -------------------------------------------------------------------------------- /tmux+/tmux.conf.symlink: -------------------------------------------------------------------------------- 1 | ## keybindings 2 | unbind % 3 | unbind , 4 | unbind . 5 | unbind n 6 | unbind p 7 | unbind [ 8 | unbind '"' 9 | unbind l 10 | unbind & 11 | unbind "'" 12 | 13 | bind-key C-a last-window 14 | bind-key | split-window -h 15 | bind-key \ split-window -h 16 | bind-key - split-window -v 17 | bind-key x kill-pane 18 | bind-key X kill-window 19 | bind-key q confirm-before kill-session 20 | bind-key Q confirm-before kill-server 21 | bind-key , previous-window # < 22 | bind-key . next-window # > 23 | bind-key < swap-window -t :- 24 | bind-key > swap-window -t :+ 25 | bind-key n command-prompt 'rename-window %%' 26 | bind-key N command-prompt 'rename-session %%' 27 | bind-key Escape copy-mode -u 28 | bind-key Up copy-mode -u 29 | bind-key r source-file ~/.tmux.conf; display-message " ✱ ~/.tmux.conf is reloaded" 30 | bind-key R refresh-client 31 | bind-key a send-key C-a 32 | bind-key C-j resize-pane -L 5 33 | bind-key C-l resize-pane -R 5 34 | bind-key C-k resize-pane -D 5 35 | bind-key C-i resize-pane -U 5 36 | bind-key z splitw -h pry 37 | 38 | unbind-key j 39 | bind-key j select-pane -D # Similar to 'C-w j' to navigate windows in Vim 40 | unbind-key k 41 | bind-key k select-pane -U 42 | unbind-key h 43 | bind-key h select-pane -L 44 | unbind-key l 45 | bind-key l select-pane -R 46 | 47 | 48 | # Bind a different key to copy-selection 49 | bind -t vi-copy y copy-selection 50 | 51 | 52 | ## set status bar 53 | set-option -g status-utf8 on 54 | set-option -g status-bg colour11 55 | set-option -g status-fg colour7 56 | 57 | #set-option -g status-left '⣿' 58 | #set-option -g status-right '⡇ #[bold]❐ #S:#I#[default] ⡇ #[bold]#(whoami) ● #H#[default] ' 59 | #set-option -g status-right '⡇ ❐ #S ⡇ ❖ #(rvm tools identifier) ⡇ #(whoami) ● #H ' 60 | set-option -g status-left ' #[bold]❐ #S#[default] ⡇' 61 | set-option -g status-right '#[bold]#(whoami) ● #H#[default] ' 62 | 63 | set-option -g status-right-length 60 64 | set-option -g status-left-length 60 65 | 66 | ## highlight active window 67 | set-window-option -g window-status-current-bg colour166 68 | set-window-option -g window-status-current-fg colour15 69 | set-window-option -g window-status-current-attr bold 70 | set-window-option -g window-status-current-format ' #I #W ' 71 | 72 | ## set window notifications 73 | set-option -g visual-activity on 74 | set-option -g visual-content on 75 | set-window-option -g monitor-activity on 76 | set-window-option -g automatic-rename off 77 | 78 | ## tmux window titling for X 79 | set-option -g set-titles on 80 | set-option -g set-titles-string '[#I] #W' 81 | set-window-option -g automatic-rename on 82 | set-window-option -g window-status-format ' #I #W ' 83 | set-window-option -g window-status-attr bold 84 | # starts windows at 1 not 0 85 | set-option -g base-index 1 86 | 87 | ## enable mouse 88 | set-option -g mouse-select-pane on 89 | set-option -g mouse-select-window on 90 | set-option -g mouse-resize-pane on 91 | set-window-option -g mode-keys vi 92 | set-window-option -g mode-mouse on 93 | # set-window-option -g monitor-activity off 94 | # set-window-option -g monitor-content off 95 | # set-option -g status-keys vi 96 | # set-option -g history-limit 4096 97 | 98 | ## pane border and colors 99 | set-option -g pane-active-border-fg yellow 100 | set-option -g pane-border-fg white 101 | 102 | ## good copy paste 103 | #set-option -g default-command "reattach-to-user-namespace -l zsh" # or bash... 104 | #bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy" 105 | #bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer" 106 | 107 | #misc config 108 | set -g default-terminal "screen-256color" 109 | 110 | new-session -s tbox 111 | -------------------------------------------------------------------------------- /ranger/ranger.config/scope.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # ranger supports enhanced previews. If the option "use_preview_script" 3 | # is set to True and this file exists, this script will be called and its 4 | # output is displayed in ranger. ANSI color codes are supported. 5 | 6 | # NOTES: This script is considered a configuration file. If you upgrade 7 | # ranger, it will be left untouched. (You must update it yourself.) 8 | # Also, ranger disables STDIN here, so interactive scripts won't work properly 9 | 10 | # Meanings of exit codes: 11 | # code | meaning | action of ranger 12 | # -----+------------+------------------------------------------- 13 | # 0 | success | success. display stdout as preview 14 | # 1 | no preview | failure. display no preview at all 15 | # 2 | plain text | display the plain content of the file 16 | # 3 | fix width | success. Don't reload when width changes 17 | # 4 | fix height | success. Don't reload when height changes 18 | # 5 | fix both | success. Don't ever reload 19 | 20 | # Meaningful aliases for arguments: 21 | path="$1" # Full path of the selected file 22 | width="$2" # Width of the preview pane (number of fitting characters) 23 | height="$3" # Height of the preview pane (number of fitting characters) 24 | cache="$4" 25 | 26 | maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln 27 | 28 | # Find out something about the file: 29 | mimetype=$(file --mime-type -Lb "$path") 30 | extension=${path##*.} 31 | 32 | # Functions: 33 | # runs a command and saves its output into $output. Useful if you need 34 | # the return value AND want to use the output in a pipe 35 | try() { output=$(eval '"$@"'); } 36 | 37 | # writes the output of the previouosly used "try" command 38 | dump() { echo "$output"; } 39 | 40 | # a common post-processing function used after most commands 41 | trim() { head -n "$maxln"; } 42 | 43 | # wraps highlight to treat exit code 141 (killed by SIGPIPE) as success 44 | highlight() { command highlight "$@"; test $? = 0 -o $? = 141; } 45 | 46 | case "$extension" in 47 | # Archive extensions: 48 | # 7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\ 49 | # rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip) 50 | # try als "$path" && { dump | trim; exit 0; } 51 | # try acat "$path" && { dump | trim; exit 3; } 52 | # try bsdtar -lf "$path" && { dump | trim; exit 0; } 53 | # exit 1;; 54 | # rar) 55 | # try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;; 56 | # PDF documents: 57 | # pdf) 58 | # try pdftotext -l 10 -nopgbrk -q "$path" - && \ 59 | # { dump | trim | fmt -s -w $width; exit 0; } || exit 1;; 60 | # BitTorrent Files 61 | # torrent) 62 | # try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;; 63 | # HTML Pages: 64 | htm|html|xhtml) 65 | try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } 66 | try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } 67 | try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } 68 | ;; # fall back to highlight/cat if the text browsers fail 69 | esac 70 | 71 | case "$mimetype" in 72 | # Syntax highlight for text files: 73 | text/* | */xml) 74 | try highlight --out-format=ansi "$path" && { dump | trim; exit 5; } || exit 2;; 75 | # Ascii-previews of images: 76 | # image/*) 77 | # exit 6; 78 | # imgcolcat "$path" "$width" && exit 3 || exit 1;; 79 | #img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; 80 | # Display information about media files: 81 | # video/*) 82 | # /Users/tristan/Box/Dev/Dotfiles/ranger/ranger.config/QLTool.app/Contents/MacOS/QLTool si "$path" 200 200 "$cached" && exit 6 || exit 1;; 83 | # video/* | audio/*) 84 | # #exiftool "$path" && exit 5 85 | # # Use sed to remove spaces so the output fits into the narrow window 86 | # try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;; 87 | esac 88 | 89 | exit 1 90 | -------------------------------------------------------------------------------- /fish+/fish.config/env.fish: -------------------------------------------------------------------------------- 1 | if test $THIS_MACHINE = "Vagrant" 2 | set -x DOTFILES $HOME/dotfiles 3 | else 4 | set -x DOTFILES $HOME/Box/Dev/Dotfiles 5 | end 6 | set -x PROJECTS $HOME/Box/Dev 7 | set -x GOPATH $HOME/Box/Dev/Langs/go 8 | set -x NODE_PATH /usr/local/lib/node:/usr/local/lib/node_modules 9 | set -x EDITOR vim 10 | set -x ALTERNATE_EDITOR vim 11 | set -x SITE_DEPLOY_PATH $HOME/Box/Sites/thume 12 | set -x LEDGER_FILE $HOME/Box/Life/me.ldg 13 | set -x PRY 14 | set -x DISABLE_SPRING 15 | 16 | # Random programs 17 | if test $THIS_MACHINE = "TBook" 18 | set -x JAVA_HOME (/usr/libexec/java_home -v 1.8) 19 | end 20 | 21 | # if which keychain > /dev/null 22 | # set -gx HOSTNAME (hostname) 23 | # if status --is-interactive; 24 | # keychain --nogui ~/.ssh/id_rsa 25 | # [ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish 26 | # end 27 | # end 28 | 29 | # PATH Setup 30 | 31 | # Languages 32 | if test $THIS_MACHINE = "TBox" 33 | set PATH /usr/local/bin $PATH # misc 34 | set PATH $HOME/bin/nim/bin $PATH # Nim 35 | else if test $THIS_MACHINE = "WikiBox" 36 | set PATH $HOME/bin/nim/bin $PATH # Nim 37 | else if test $THIS_MACHINE = "Vagrant" 38 | set PATH /home/vagrant/.gem/ruby/2.1.6/bin /usr/lib/shopify-ruby/2.1.6-shopify1/lib/ruby/gems/2.1.0/bin /usr/lib/shopify-ruby/2.1.6-shopify1/bin $PATH 39 | set PATH /usr/local/heroku/bin $PATH /home/vagrant/src/go/bin 40 | else if test $THIS_MACHINE = "TBook" # Tbook 41 | # set PATH $PATH /Applications/Julia.app/Contents/Resources/julia/bin # Julia 42 | # set PATH $PATH $HOME/Box/Dev/Projects/gutenberg/target/release 43 | set PATH $PATH /Applications/JuliaPro-0.6.0.1.app/Contents/Resources/julia/Contents/Resources/julia/bin 44 | set PATH "/Applications/Sublime Text.app/Contents/SharedSupport/bin" $PATH 45 | set PATH /Applications/Racket/bin $PATH # racket 46 | # set PATH $HOME/Qt/5.3/clang_64/bin $PATH # Qt 47 | set PATH $HOME/Library/Haskell/bin $PATH # Haskell platform 48 | set PATH $HOME/.local/bin $PATH # Haskell Stack 49 | set PATH $GOPATH/bin $PATH /usr/local/opt/go/libexec/bin # go 50 | # set PATH $HOME/bin/nim/bin $HOME/.nimble/bin $PATH # Nim 51 | # set PATH $HOME/bin/depot_tools $PATH # Chrome Depot Tools 52 | # set PATH /Applications/Emacs.app/Contents/MacOS/bin $PATH # emacs 53 | set PATH /usr/local/share/npm/bin $PATH # Node binaries 54 | set PATH /Users/tristan/.cargo/bin $PATH # Rust binaries 55 | set -x RUST_SRC_PATH /Users/tristan/Documents/rustc-1.6.0/src 56 | set PATH /usr/local/opt/ruby/bin $PATH # Ruby executables 57 | set PATH /usr/local/bin /usr/local/sbin $PATH # homebrew 58 | set PATH /Users/tristan/Library/Python/2.7/bin $PATH # voltron Python 59 | set PATH /Users/tristan/misc/apitrace/build $PATH # apitrace 60 | set PATH /Users/tristan/bin/google-cloud-sdk/bin $PATH # Google Cloud 61 | set PATH /Users/tristan/bin/zig $PATH # Zig 62 | set PATH "/Applications/Visual Studio Code.app/Contents/Resources/app/bin" $PATH # VSCode 63 | set PATH "/Applications/Sublime Merge.app/Contents/SharedSupport/bin" $PATH # Sublime Merge 64 | set PYTHONPATH /usr/local/lib/python2.7/site-packages $PYTHONPATH 65 | 66 | # set -x QTDIR64 $HOME/Qt/5.5/clang_64 67 | set -x QT_DIR $HOME/Qt5.8.0/ 68 | 69 | 70 | # OCaml OPAM 71 | # . /Users/tristan/.opam/opam-init/variables.fish > /dev/null 2> /dev/null or true 72 | set PATH "/Users/tristan/.opam/system/bin" $PATH 73 | set -x OCAML_TOPLEVEL_PATH "/Users/tristan/.opam/system/lib/toplevel" 74 | set MANPATH "$MANPATH" "/Users/tristan/.opam/system/man" 75 | set -x OPAMUTF8MSGS "1" 76 | set -x CAML_LD_LIBRARY_PATH "/Users/tristan/.opam/system/lib/stublibs:/usr/local/lib/ocaml/stublibs" 77 | 78 | set -x RUST_SRC_PATH /Users/tristan/Documents/rustc-1.8.0/src 79 | 80 | # Nix 81 | # set -xg NIX_LINK "$HOME/.nix-profile" 82 | # set PATH $NIX_LINK/bin $NIX_LINK/sbin $PATH 83 | # set -xg NIX_PATH $NIX_PATH "nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs" 84 | # set -xg SSL_CERT_FILE "$NIX_LINK/etc/ca-bundle.crt" 85 | set -x NIX_REMOTE daemon 86 | set -x NIX_USER_PROFILE_DIR "/nix/var/nix/profiles/per-user/$USER" 87 | set -x NIX_PROFILES "/nix/var/nix/profiles/default $HOME/.nix-profile" 88 | set -x NIX_SSL_CERT_FILE "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt" 89 | set -x NIX_PATH "/nix/var/nix/profiles/per-user/root/channels" 90 | set PATH "/nix/var/nix/profiles/default/bin" $PATH 91 | end 92 | 93 | set PATH $HOME/bin $DOTFILES/bin $PATH # local bins 94 | -------------------------------------------------------------------------------- /ranger/ranger.config/rifle.conf: -------------------------------------------------------------------------------- 1 | # vim: ft=cfg 2 | # 3 | # This is the configuration file of "rifle", ranger's file executor/opener. 4 | # Each line consists of conditions and a command. For each line the conditions 5 | # are checked and if they are met, the respective command is run. 6 | # 7 | # Syntax: 8 | # , , ... = command 9 | # 10 | # The command can contain these environment variables: 11 | # $1-$9 | The n-th selected file 12 | # $@ | All selected files 13 | # 14 | # If you use the special command "ask", rifle will ask you what program to run. 15 | # 16 | # Prefixing a condition with "!" will negate its result. 17 | # These conditions are currently supported: 18 | # match | The regexp matches $1 19 | # ext | The regexp matches the extension of $1 20 | # mime | The regexp matches the mime type of $1 21 | # name | The regexp matches the basename of $1 22 | # path | The regexp matches the absolute path of $1 23 | # has | The program is installed (i.e. located in $PATH) 24 | # file | $1 is a file 25 | # directory | $1 is a directory 26 | # number | change the number of this command to n 27 | # terminal | stdin, stderr and stdout are connected to a terminal 28 | # X | $DISPLAY is not empty (i.e. Xorg runs) 29 | # 30 | # There are also pseudo-conditions which have a "side effect": 31 | # flag | Change how the program is run. See below. 32 | # label