Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Moved to Holman topical setup

  • Loading branch information...
commit 00f1393d4f42f4c5c13bfda2e4615a63b0f716b9 1 parent 48018a4
Wynn Netherland authored

Showing 66 changed files with 919 additions and 197 deletions. Show diff stats Hide diff stats

  1. +2 2 .gitignore
  2. +0 30 .gitmodules
  3. +57 0 Rakefile
  4. 0  home/.ackrc → ack/ackrc.symlink
  5. +22 0 bin/e
  6. +5 0 bin/git-all
  7. +5 0 bin/git-amend
  8. +13 0 bin/git-credit
  9. +8 0 bin/git-delete-local-merged
  10. 0  {scripts → bin}/git-diff-grep
  11. +18 0 bin/git-promote
  12. +60 0 bin/git-rank-contributers
  13. +5 0 bin/git-undo
  14. +36 0 bin/git-up
  15. +364 0 bin/git-wtf
  16. +33 0 bin/gitio
  17. +8 0 bin/headers
  18. +30 0 bin/movieme
  19. +56 0 bin/mustacheme
  20. +8 0 bin/search
  21. +152 0 bin/spark
  22. +34 0 bin/wifi-signal-strength
  23. 0  {zsh → git}/git.zsh
  24. 0  {home/.git_template → git/git_template.symlink}/hooks/ctags
  25. 0  {home/.git_template → git/git_template.symlink}/hooks/post-checkout
  26. 0  {home/.git_template → git/git_template.symlink}/hooks/post-commit
  27. 0  {home/.git_template → git/git_template.symlink}/hooks/post-merge
  28. 0  {home/.git_template → git/git_template.symlink}/hooks/post-rewrite
  29. 0  home/.gitconfig → git/gitconfig.symlink
  30. 0  home/.gitingore → git/gitingore.symlink
  31. +0 1  home/.janus/bubblegum
  32. +0 1  home/.janus/hemisu
  33. +0 1  home/.janus/nginx
  34. +0 1  home/.janus/sahara
  35. +0 1  home/.janus/taskpaper
  36. +0 1  home/.janus/vim-bundler
  37. +0 1  home/.janus/vim-stylus
  38. +0 4 home/.powconfig
  39. +0 63 home/.vimrc.after
  40. +0 3  home/.vimrc.before
  41. 0  mail/.gitkeep
  42. 0  {zsh → node}/node.zsh
  43. 0  {zsh → ruby}/bundler.zsh
  44. 0  home/.gemrc → ruby/gemrc.symlink
  45. 0  home/.irbrc → ruby/irbrc.symlink
  46. 0  {zsh → ruby}/rails.zsh
  47. 0  home/.rspec → ruby/rspec.symlink
  48. 0  {zsh → sass}/sass.zsh
  49. +0 85 scripts/spark
  50. 0  {zsh → titanium}/titanium.zsh
  51. 0  home/.tmux.conf → tmux/.tmux.conf.symlink
  52. 0  {zsh → tmux}/tmux.zsh
  53. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/betasplash.yml
  54. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/charity.yml
  55. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/fumblr.yml
  56. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/gtd.yml
  57. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/mission.yml
  58. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/paula.yml
  59. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/tcl.yml
  60. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/tsw.yml
  61. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/twitter.yml
  62. 0  {home/.tmuxinator → tmux/tmuxinator.symlink}/wynn.yml
  63. 0  tumblr/.gitkeep
  64. +1 0  vim/vim.zsh
  65. +0 1  zsh/common.zsh
  66. +2 2 home/.zshrc → zsh/zshrc.symlink
4 .gitignore
... ... @@ -1,2 +1,2 @@
1   -zsh/*_private.zsh
2   -zsh/*_creds.zsh
  1 +*_private.zsh
  2 +*_creds.zsh
30 .gitmodules
... ... @@ -1,30 +0,0 @@
1   -[submodule "home/.janus/taskpaper"]
2   - path = home/.janus/taskpaper
3   - url = https://github.com/davidoc/taskpaper.vim.git
4   -[submodule "home/.janus/nginx"]
5   - path = home/.janus/nginx
6   - url = https://github.com/jinfield/vim-nginx.git
7   -[submodule "home/.janus/YankRing"]
8   - path = home/.janus/YankRing
9   - url = https://github.com/vim-scripts/YankRing.vim.git
10   -[submodule "home/.janus/bubblegum"]
11   - path = home/.janus/bubblegum
12   - url = https://github.com/baskerville/bubblegum.git
13   -[submodule "yankring"]
14   - path = yankring
15   - url = https://github.com/vim-scripts/YankRing.vim.git
16   -[submodule "home/.janus/yankring"]
17   - path = home/.janus/yankring
18   - url = https://github.com/vim-scripts/YankRing.vim.git
19   -[submodule "home/.janus/sahara"]
20   - path = home/.janus/sahara
21   - url = https://github.com/tejr/sahara.git
22   -[submodule "home/.janus/vim-bundler"]
23   - path = home/.janus/vim-bundler
24   - url = https://github.com/tpope/vim-bundler.git
25   -[submodule "home/.janus/hemisu"]
26   - path = home/.janus/hemisu
27   - url = https://github.com/noahfrederick/Hemisu.git
28   -[submodule "home/.janus/vim-stylus"]
29   - path = home/.janus/vim-stylus
30   - url = https://github.com/wavded/vim-stylus.git
57 Rakefile
... ... @@ -0,0 +1,57 @@
  1 +require 'rake'
  2 +
  3 +desc "Hook our dotfiles into system-standard positions."
  4 +task :install do
  5 + linkables = Dir.glob('*/**{.symlink}')
  6 +
  7 + skip_all = false
  8 + overwrite_all = false
  9 + backup_all = false
  10 +
  11 + linkables.each do |linkable|
  12 + overwrite = false
  13 + backup = false
  14 +
  15 + file = linkable.split('/').last.split('.symlink').last
  16 + target = "#{ENV["HOME"]}/.#{file}"
  17 +
  18 + if File.exists?(target) || File.symlink?(target)
  19 + unless skip_all || overwrite_all || backup_all
  20 + 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"
  21 + case STDIN.gets.chomp
  22 + when 'o' then overwrite = true
  23 + when 'b' then backup = true
  24 + when 'O' then overwrite_all = true
  25 + when 'B' then backup_all = true
  26 + when 'S' then skip_all = true
  27 + when 's' then next
  28 + end
  29 + end
  30 + FileUtils.rm_rf(target) if overwrite || overwrite_all
  31 + `mv "$HOME/.#{file}" "$HOME/.#{file}.backup"` if backup || backup_all
  32 + end
  33 + `ln -s "$PWD/#{linkable}" "#{target}"`
  34 + end
  35 +end
  36 +
  37 +task :uninstall do
  38 +
  39 + Dir.glob('**/*.symlink').each do |linkable|
  40 +
  41 + file = linkable.split('/').last.split('.symlink').last
  42 + target = "#{ENV["HOME"]}/.#{file}"
  43 +
  44 + # Remove all symlinks created during installation
  45 + if File.symlink?(target)
  46 + FileUtils.rm(target)
  47 + end
  48 +
  49 + # Replace any backups made during installation
  50 + if File.exists?("#{ENV["HOME"]}/.#{file}.backup")
  51 + `mv "$HOME/.#{file}.backup" "$HOME/.#{file}"`
  52 + end
  53 +
  54 + end
  55 +end
  56 +
  57 +task :default => 'install'
0  home/.ackrc → ack/ackrc.symlink
File renamed without changes
22 bin/e
... ... @@ -0,0 +1,22 @@
  1 +#!/bin/sh
  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 test "$1" == ""
  18 +then
  19 + $($EDITOR .)
  20 +else
  21 + $($EDITOR $1)
  22 +fi
5 bin/git-all
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/sh
  2 +#
  3 +# Stage all unstaged.
  4 +
  5 +git add -A
5 bin/git-amend
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/sh
  2 +#
  3 +# Use the last commit message and amend your stuffs.
  4 +
  5 +git commit --amend -C HEAD
13 bin/git-credit
... ... @@ -0,0 +1,13 @@
  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
8 bin/git-delete-local-merged
... ... @@ -0,0 +1,8 @@
  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'`
0  scripts/git-diff-grep → bin/git-diff-grep
File renamed without changes
18 bin/git-promote
... ... @@ -0,0 +1,18 @@
  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}" )
60 bin/git-rank-contributers
... ... @@ -0,0 +1,60 @@
  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 <wmorgan-git-wt-add@masanjin.net>.
  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("&", "&amp;").gsub("<", "&lt;").gsub(">", "&gt;") 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
5 bin/git-undo
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/sh
  2 +#
  3 +# Undo your last commit, but don't throw away your changes
  4 +
  5 +git reset --soft HEAD^
36 bin/git-up
... ... @@ -0,0 +1,36 @@
  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/^/ /'
364 bin/git-wtf
... ... @@ -0,0 +1,364 @@
  1 +#!/usr/bin/env ruby
  2 +
  3 +HELP = <<EOS
  4 +git-wtf displays the state of your repository in a readable, easy-to-scan
  5 +format. It's useful for getting a summary of how a branch relates to a remote
  6 +server, and for wrangling many topic branches.
  7 +
  8 +git-wtf can show you:
  9 +- How a branch relates to the remote repo, if it's a tracking branch.
  10 +- How a branch relates to integration branches, if it's a feature branch.
  11 +- How a branch relates to the feature branches, if it's an integration
  12 + branch.
  13 +
  14 +git-wtf is best used before a git push, or between a git fetch and a git
  15 +merge. Be sure to set color.ui to auto or yes for maximum viewing pleasure.
  16 +EOS
  17 +
  18 +KEY = <<EOS
  19 +KEY:
  20 +() branch only exists locally
  21 +{} branch only exists on a remote repo
  22 +[] branch exists locally and remotely
  23 +
  24 +x merge occurs both locally and remotely
  25 +~ merge occurs only locally
  26 + (space) branch isn't merged in
  27 +
  28 +(It's possible for merges to occur remotely and not locally, of course, but
  29 +that's a less common case and git-wtf currently doesn't display anything
  30 +special for it.)
  31 +EOS
  32 +
  33 +USAGE = <<EOS
  34 +Usage: git wtf [branch+] [options]
  35 +
  36 +If [branch] is not specified, git-wtf will use the current branch. The possible
  37 +[options] are:
  38 +
  39 + -l, --long include author info and date for each commit
  40 + -a, --all show all branches across all remote repos, not just
  41 + those from origin
  42 + -A, --all-commits show all commits, not just the first 5
  43 + -s, --short don't show commits
  44 + -k, --key show key
  45 + -r, --relations show relation to features / integration branches
  46 + --dump-config print out current configuration and exit
  47 +
  48 +git-wtf uses some heuristics to determine which branches are integration
  49 +branches, and which are feature branches. (Specifically, it assumes the
  50 +integration branches are named "master", "next" and "edge".) If it guesses
  51 +incorrectly, you will have to create a .git-wtfrc file.
  52 +
  53 +To start building a configuration file, run "git-wtf --dump-config >
  54 +.git-wtfrc" and edit it. The config file is a YAML file that specifies the
  55 +integration branches, any branches to ignore, and the max number of commits to
  56 +display when --all-commits isn't used. git-wtf will look for a .git-wtfrc file
  57 +starting in the current directory, and recursively up to the root.
  58 +
  59 +IMPORTANT NOTE: all local branches referenced in .git-wtfrc must be prefixed
  60 +with heads/, e.g. "heads/master". Remote branches must be of the form
  61 +remotes/<remote>/<branch>.
  62 +EOS
  63 +
  64 +COPYRIGHT = <<EOS
  65 +git-wtf Copyright 2008--2009 William Morgan <wmorgan at the masanjin dot nets>.
  66 +This program is free software: you can redistribute it and/or modify it
  67 +under the terms of the GNU General Public License as published by the Free
  68 +Software Foundation, either version 3 of the License, or (at your option)
  69 +any later version.
  70 +
  71 +This program is distributed in the hope that it will be useful, but WITHOUT
  72 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  73 +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  74 +more details.
  75 +
  76 +You can find the GNU General Public License at: http://www.gnu.org/licenses/
  77 +EOS
  78 +
  79 +require 'yaml'
  80 +CONFIG_FN = ".git-wtfrc"
  81 +
  82 +class Numeric; def pluralize s; "#{to_s} #{s}" + (self != 1 ? "s" : "") end end
  83 +
  84 +if ARGV.delete("--help") || ARGV.delete("-h")
  85 + puts USAGE
  86 + exit
  87 +end
  88 +
  89 +## poor man's trollop
  90 +$long = ARGV.delete("--long") || ARGV.delete("-l")
  91 +$short = ARGV.delete("--short") || ARGV.delete("-s")
  92 +$all = ARGV.delete("--all") || ARGV.delete("-a")
  93 +$all_commits = ARGV.delete("--all-commits") || ARGV.delete("-A")
  94 +$dump_config = ARGV.delete("--dump-config")
  95 +$key = ARGV.delete("--key") || ARGV.delete("-k")
  96 +$show_relations = ARGV.delete("--relations") || ARGV.delete("-r")
  97 +ARGV.each { |a| abort "Error: unknown argument #{a}." if a =~ /^--/ }
  98 +
  99 +## search up the path for a file
  100 +def find_file fn
  101 + while true
  102 + return fn if File.exist? fn
  103 + fn2 = File.join("..", fn)
  104 + return nil if File.expand_path(fn2) == File.expand_path(fn)
  105 + fn = fn2
  106 + end
  107 +end
  108 +
  109 +want_color = `git config color.wtf`
  110 +want_color = `git config color.ui` if want_color.empty?
  111 +$color = case want_color.chomp
  112 + when "true"; true
  113 + when "auto"; $stdout.tty?
  114 +end
  115 +
  116 +def red s; $color ? "\033[31m#{s}\033[0m" : s end
  117 +def green s; $color ? "\033[32m#{s}\033[0m" : s end
  118 +def yellow s; $color ? "\033[33m#{s}\033[0m" : s end
  119 +def cyan s; $color ? "\033[36m#{s}\033[0m" : s end
  120 +def grey s; $color ? "\033[1;30m#{s}\033[0m" : s end
  121 +def purple s; $color ? "\033[35m#{s}\033[0m" : s end
  122 +
  123 +## the set of commits in 'to' that aren't in 'from'.
  124 +## if empty, 'to' has been merged into 'from'.
  125 +def commits_between from, to
  126 + if $long
  127 + `git log --pretty=format:"- %s [#{yellow "%h"}] (#{purple "%ae"}; %ar)" #{from}..#{to}`
  128 + else
  129 + `git log --pretty=format:"- %s [#{yellow "%h"}]" #{from}..#{to}`
  130 + end.split(/[\r\n]+/)
  131 +end
  132 +
  133 +def show_commits commits, prefix=" "
  134 + if commits.empty?
  135 + puts "#{prefix} none"
  136 + else
  137 + max = $all_commits ? commits.size : $config["max_commits"]
  138 + max -= 1 if max == commits.size - 1 # never show "and 1 more"
  139 + commits[0 ... max].each { |c| puts "#{prefix}#{c}" }
  140 + puts grey("#{prefix}... and #{commits.size - max} more (use -A to see all).") if commits.size > max
  141 + end
  142 +end
  143 +
  144 +def ahead_behind_string ahead, behind
  145 + [ahead.empty? ? nil : "#{ahead.size.pluralize 'commit'} ahead",
  146 + behind.empty? ? nil : "#{behind.size.pluralize 'commit'} behind"].
  147 + compact.join("; ")
  148 +end
  149 +
  150 +def widget merged_in, remote_only=false, local_only=false, local_only_merge=false
  151 + left, right = case
  152 + when remote_only; %w({ })
  153 + when local_only; %w{( )}
  154 + else %w([ ])
  155 + end
  156 + middle = case
  157 + when merged_in && local_only_merge; green("~")
  158 + when merged_in; green("x")
  159 + else " "
  160 + end
  161 + print left, middle, right
  162 +end
  163 +
  164 +def show b
  165 + have_both = b[:local_branch] && b[:remote_branch]
  166 +
  167 + pushc, pullc, oosync = if have_both
  168 + [x = commits_between(b[:remote_branch], b[:local_branch]),
  169 + y = commits_between(b[:local_branch], b[:remote_branch]),
  170 + !x.empty? && !y.empty?]
  171 + end
  172 +
  173 + if b[:local_branch]
  174 + puts "Local branch: " + green(b[:local_branch].sub(/^heads\//, ""))
  175 +
  176 + if have_both
  177 + if pushc.empty?
  178 + puts "#{widget true} in sync with remote"
  179 + else
  180 + action = oosync ? "push after rebase / merge" : "push"
  181 + puts "#{widget false} NOT in sync with remote (you should #{action})"
  182 + show_commits pushc unless $short
  183 + end
  184 + end
  185 + end
  186 +
  187 + if b[:remote_branch]
  188 + puts "Remote branch: #{cyan b[:remote_branch]} (#{b[:remote_url]})"
  189 +
  190 + if have_both
  191 + if pullc.empty?
  192 + puts "#{widget true} in sync with local"
  193 + else
  194 + action = pushc.empty? ? "merge" : "rebase / merge"
  195 + puts "#{widget false} NOT in sync with local (you should #{action})"
  196 + show_commits pullc unless $short
  197 + end
  198 + end
  199 + end
  200 +
  201 + puts "\n#{red "WARNING"}: local and remote branches have diverged. A merge will occur unless you rebase." if oosync
  202 +end
  203 +
  204 +def show_relations b, all_branches
  205 + ibs, fbs = all_branches.partition { |name, br| $config["integration-branches"].include?(br[:local_branch]) || $config["integration-branches"].include?(br[:remote_branch]) }
  206 + if $config["integration-branches"].include? b[:local_branch]
  207 + puts "\nFeature branches:" unless fbs.empty?
  208 + fbs.each do |name, br|
  209 + next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch])
  210 + next if br[:ignore]
  211 + local_only = br[:remote_branch].nil?
  212 + remote_only = br[:local_branch].nil?
  213 + name = if local_only
  214 + purple br[:name]
  215 + elsif remote_only
  216 + cyan br[:name]
  217 + else
  218 + green br[:name]
  219 + end
  220 +
  221 + ## for remote_only branches, we'll compute wrt the remote branch head. otherwise, we'll
  222 + ## use the local branch head.
  223 + head = remote_only ? br[:remote_branch] : br[:local_branch]
  224 +
  225 + remote_ahead = b[:remote_branch] ? commits_between(b[:remote_branch], head) : []
  226 + local_ahead = b[:local_branch] ? commits_between(b[:local_branch], head) : []
  227 +
  228 + if local_ahead.empty? && remote_ahead.empty?
  229 + puts "#{widget true, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is merged in"
  230 + elsif local_ahead.empty?
  231 + puts "#{widget true, remote_only, local_only, true} #{name} merged in (only locally)"
  232 + else
  233 + behind = commits_between head, (br[:local_branch] || br[:remote_branch])
  234 + ahead = remote_only ? remote_ahead : local_ahead
  235 + puts "#{widget false, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is NOT merged in (#{ahead_behind_string ahead, behind})"
  236 + show_commits ahead unless $short
  237 + end
  238 + end
  239 + else
  240 + puts "\nIntegration branches:" unless ibs.empty? # unlikely
  241 + ibs.sort_by { |v, br| v }.each do |v, br|
  242 + next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch])
  243 + next if br[:ignore]
  244 + local_only = br[:remote_branch].nil?
  245 + remote_only = br[:local_branch].nil?
  246 + name = remote_only ? cyan(br[:name]) : green(br[:name])
  247 +
  248 + ahead = commits_between v, (b[:local_branch] || b[:remote_branch])
  249 + if ahead.empty?
  250 + puts "#{widget true, local_only} merged into #{name}"
  251 + else
  252 + #behind = commits_between b[:local_branch], v
  253 + puts "#{widget false, local_only} NOT merged into #{name} (#{ahead.size.pluralize 'commit'} ahead)"
  254 + show_commits ahead unless $short
  255 + end
  256 + end
  257 + end
  258 +end
  259 +
  260 +#### EXECUTION STARTS HERE ####
  261 +
  262 +## find config file and load it
  263 +$config = { "integration-branches" => %w(heads/master heads/next heads/edge), "ignore" => [], "max_commits" => 5 }.merge begin
  264 + fn = find_file CONFIG_FN
  265 + if fn && (h = YAML::load_file(fn)) # yaml turns empty files into false
  266 + h["integration-branches"] ||= h["versions"] # support old nomenclature
  267 + h
  268 + else
  269 + {}
  270 + end
  271 +end
  272 +
  273 +if $dump_config
  274 + puts $config.to_yaml
  275 + exit
  276 +end
  277 +
  278 +## first, index registered remotes
  279 +remotes = `git config --get-regexp ^remote\.\*\.url`.split(/[\r\n]+/).inject({}) do |hash, l|
  280 + l =~ /^remote\.(.+?)\.url (.+)$/ or next hash
  281 + hash[$1] ||= $2
  282 + hash
  283 +end
  284 +
  285 +## next, index followed branches
  286 +branches = `git config --get-regexp ^branch\.`.split(/[\r\n]+/).inject({}) do |hash, l|
  287 + case l
  288 + when /branch\.(.*?)\.remote (.+)/
  289 + name, remote = $1, $2
  290 +
  291 + hash[name] ||= {}
  292 + hash[name].merge! :remote => remote, :remote_url => remotes[remote]
  293 + when /branch\.(.*?)\.merge ((refs\/)?heads\/)?(.+)/
  294 + name, remote_branch = $1, $4
  295 + hash[name] ||= {}
  296 + hash[name].merge! :remote_mergepoint => remote_branch
  297 + end
  298 + hash
  299 +end
  300 +
  301 +## finally, index all branches
  302 +remote_branches = {}
  303 +`git show-ref`.split(/[\r\n]+/).each do |l|
  304 + sha1, ref = l.chomp.split " refs/"
  305 +
  306 + if ref =~ /^heads\/(.+)$/ # local branch
  307 + name = $1
  308 + next if name == "HEAD"
  309 + branches[name] ||= {}
  310 + branches[name].merge! :name => name, :local_branch => ref
  311 + elsif ref =~ /^remotes\/(.+?)\/(.+)$/ # remote branch
  312 + remote, name = $1, $2
  313 + remote_branches["#{remote}/#{name}"] = true
  314 + next if name == "HEAD"
  315 + ignore = !($all || remote == "origin")
  316 +
  317 + branch = name
  318 + if branches[name] && branches[name][:remote] == remote
  319 + # nothing
  320 + else
  321 + name = "#{remote}/#{branch}"
  322 + end
  323 +
  324 + branches[name] ||= {}
  325 + branches[name].merge! :name => name, :remote => remote, :remote_branch => "#{remote}/#{branch}", :remote_url => remotes[remote], :ignore => ignore
  326 + end
  327 +end
  328 +
  329 +## assemble remotes
  330 +branches.each do |k, b|
  331 + next unless b[:remote] && b[:remote_mergepoint]
  332 + b[:remote_branch] = if b[:remote] == "."
  333 + b[:remote_mergepoint]
  334 + else
  335 + t = "#{b[:remote]}/#{b[:remote_mergepoint]}"
  336 + remote_branches[t] && t # only if it's still alive
  337 + end
  338 +end
  339 +
  340 +show_dirty = ARGV.empty?
  341 +targets = if ARGV.empty?
  342 + [`git symbolic-ref HEAD`.chomp.sub(/^refs\/heads\//, "")]
  343 +else
  344 + ARGV.map { |x| x.sub(/^heads\//, "") }
  345 +end.map { |t| branches[t] or abort "Error: can't find branch #{t.inspect}." }
  346 +
  347 +targets.each do |t|
  348 + show t
  349 + show_relations t, branches if $show_relations || t[:remote_branch].nil?
  350 +end
  351 +
  352 +modified = show_dirty && `git ls-files -m` != ""
  353 +uncommitted = show_dirty && `git diff-index --cached HEAD` != ""
  354 +
  355 +if $key
  356 + puts
  357 + puts KEY
  358 +end
  359 +
  360 +puts if modified || uncommitted
  361 +puts "#{red "NOTE"}: working directory contains modified files." if modified
  362 +puts "#{red "NOTE"}: staging area contains staged but uncommitted files." if uncommitted
  363 +
  364 +# the end!
33 bin/gitio
... ... @@ -0,0 +1,33 @@
  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
8 bin/headers
... ... @@ -0,0 +1,8 @@
  1 +#!/bin/sh
  2 +#
  3 +# https://github.com/rtomayko/dotfiles/blob/rtomayko/bin/headers
  4 +
  5 +curl -sv "$@" 2>&1 >/dev/null |
  6 + grep -v "^\*" |
  7 + grep -v "^}" |
  8 + cut -c3-
30 bin/movieme
... ... @@ -0,0 +1,30 @@
  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 <path> <start-time> <duration>
  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
56 bin/mustacheme
... ... @@ -0,0 +1,56 @@
  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
8 bin/search
... ... @@ -0,0 +1,8 @@
  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
152 bin/spark
... ... @@ -0,0 +1,152 @@
  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
34 bin/wifi-signal-strength
... ... @@ -0,0 +1,34 @@
  1 +#!/bin/sh
  2 +#
  3 +# Use: Put something this in your .tmux.conf file
  4 +# set -g status-right: '#(wifi-signal-strength)'
  5 +#
  6 +
  7 +all_signal=(▁ ▃ ▅ ▇ )
  8 +
  9 +current=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | egrep "agrCtlRSSI|state|lastTxRate| SSID" | tr "\\n" ";" | awk '{print $2,$4,$6,$8}'`
  10 +
  11 +if [ "$current" == "" ]
  12 +then
  13 + echo "(WIFI off)"
  14 +fi
  15 +
  16 +strength=`echo $current | cut -d";" -f1-1 | cut -d" " -f2-`
  17 +state=`echo $current | cut -d";" -f2-2 | cut -d" " -f2-`
  18 +bandwidth=`echo $current | cut -d";" -f3-3 | cut -d" " -f2-`
  19 +name=`echo $current | cut -d";" -f4-4 | cut -d" " -f2-`
  20 +
  21 +signal="( "
  22 +for (( j = 0; j < 4; j++ ))
  23 +do
  24 + if [[ $j -eq 0 && $strength -gt -94 ]] || [[ $j -eq 1 && $strength -gt -92 ]] ||
  25 + [[ $j -eq 2 && $strength -gt -86 ]] || [[ $j -eq 3 && $strength -gt -79 ]]
  26 + then
  27 + signal="${signal}${all_signal[$j]} "
  28 + else
  29 + signal="${signal} "
  30 + fi
  31 +done
  32 +signal="${signal} )"
  33 +
  34 +echo "${name} ${bandwidth}Mbs ${signal}"
0  zsh/git.zsh → git/git.zsh
File renamed without changes
0  home/.git_template/hooks/ctags → git/git_template.symlink/hooks/ctags
File renamed without changes
0  home/.git_template/hooks/post-checkout → git/git_template.symlink/hooks/post-checkout
File renamed without changes
0  home/.git_template/hooks/post-commit → git/git_template.symlink/hooks/post-commit
File renamed without changes
0  home/.git_template/hooks/post-merge → git/git_template.symlink/hooks/post-merge
File renamed without changes
0  home/.git_template/hooks/post-rewrite → git/git_template.symlink/hooks/post-rewrite
File renamed without changes
0  home/.gitconfig → git/gitconfig.symlink
File renamed without changes
0  home/.gitingore → git/gitingore.symlink
File renamed without changes
1  home/.janus/bubblegum
... ... @@ -1 +0,0 @@
1   -Subproject commit 8006f4d481ecddea13651031750526882d0894c1
1  home/.janus/hemisu
... ... @@ -1 +0,0 @@
1   -Subproject commit 54000fa591fcb82e78a207a5e5fb6409c411bda9
1  home/.janus/nginx
... ... @@ -1 +0,0 @@
1   -Subproject commit 32d1dbcefc7d57c38e94b5fe00b6622d0e3de1c5
1  home/.janus/sahara
... ... @@ -1 +0,0 @@
1   -Subproject commit e1c3ce05e22ce6b973cf9cad5b2245f16a21f962
1  home/.janus/taskpaper
... ... @@ -1 +0,0 @@
1   -Subproject commit 12c767050f09fb158e26b935501f96300bf650a6
1  home/.janus/vim-bundler
... ... @@ -1 +0,0 @@
1   -Subproject commit 0faf7670a5412fb5fa9b61e15f48c1276753de29
1  home/.janus/vim-stylus
... ... @@ -1 +0,0 @@
1   -Subproject commit 1c86086bfbf8754508616df5038be1aa98c991ee
4 home/.powconfig
... ... @@ -1,4 +0,0 @@
1   -export POW_WORKERS=5
2   -export POW_TIMEOUT=30000
3   -export POW_DOMAINS=dev,test,local
4   -
63 home/.vimrc.after
... ... @@ -1,63 +0,0 @@
1   -set t_Co=256
2   -syntax enable
3   -set background=dark
4   -color solarized
5   -"color jellybeans
6   -let g:github_token = $GITHUB_TOKEN
7   -
8   -autocmd BufWritePre * :%s/\s\+$//e
9   -
10   -vmap <D-]> >gv
11   -vmap <D-[> <gv
12   -nnoremap <F6> :set invpaste paste?<CR>
13   -set pastetoggle=<F6>
14   -set showmode
15   -
16   -nnoremap <F2> <Esc>:help keycodes<CR>
17   -
18   -au BufRead,BufNewFile /^[A-Z]+\w*file$/ setf ruby
19   -au BufRead,BufNewFile *.thor set filetype=ruby
20   -au BufRead,BufNewFile Guardfile set filetype=ruby
21   -au BufRead,BufNewFile */nginx/*.conf set filetype=nginx
22   -au BufRead,BufNewFile *.zsh-theme set ft=zsh
23   -au BufRead,BufNewFile *.jbuilder setf ruby
24   -au BufRead,BufNewFile *.jeco setf html
25   -au BufRead,BufNewFile *.jss set filetype=css
26   -au BufRead,BufNewFile *.hbs set filetype=mustache
27   -
28   -" disable for jeco
29   -let g:syntastic_disabled_filetypes = ['html']
30   -
31   -set mouse=a
32   -
33   -command! -bang E e<bang>
34   -command! -bang Q q<bang>
35   -command! -bang W w<bang>
36   -command! -bang QA qa<bang>
37   -command! -bang Qa qa<bang>
38   -command! -bang Wa wa<bang>
39   -command! -bang WA wa<bang>
40   -command! -bang Wq wq<bang>
41   -command! -bang WQ wq<bang>
42   -
43   -map <Leader>yy :YRShow<CR>
44   -
45   -function! Privatize()
46   - let priorMethod = PriorMethodDefinition()
47   - exec "normal iprivate :" . priorMethod . "\<Esc>=="
48   -endfunction
49   -
50   -function! PriorMethodDefinition()
51   - let lineNumber = search('def', 'bn')
52   - let line = getline(lineNumber)
53   - if line == 0
54   - echo "No prior method definition found"
55   - endif
56   - return matchlist(line, 'def \(\w\+\).*')[1]
57   -endfunction
58   -
59   -map <Leader>p :call Privatize()<CR>
60   -
61   -
62   -
63   -
3  home/.vimrc.before
... ... @@ -1,3 +0,0 @@
1   -set nobackup
2   -set noswapfile
3   -call janus#disable_plugin('syntastic')
0  mail/.gitkeep
No changes.
0  zsh/node.zsh → node/node.zsh
File renamed without changes
0  zsh/bundler.zsh → ruby/bundler.zsh
File renamed without changes
0  home/.gemrc → ruby/gemrc.symlink
File renamed without changes
0  home/.irbrc → ruby/irbrc.symlink
File renamed without changes
0  zsh/rails.zsh → ruby/rails.zsh
File renamed without changes
0  home/.rspec → ruby/rspec.symlink
File renamed without changes
0  zsh/sass.zsh → sass/sass.zsh
File renamed without changes
85 scripts/spark
... ... @@ -1,85 +0,0 @@
1   -#!/usr/bin/env bash
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   -
27   -# Prints the help text for spark.
28   -help()
29   -{
30   - cat <<EOF
31   -
32   - USAGE:
33   - spark [-h] VALUE,...
34   -
35   - EXAMPLES:
36   - spark 1 5 22 13 53
37   - ▁▁▃▂█
38   - spark 0,30,55,80,33,150
39   - ▁▂▃▄▂█
40   - echo 9 13 5 17 1 | spark
41   - ▄▆▂█▁
42   -EOF
43   -}
44   -
45   -# Generates sparklines.
46   -#
47   -# $1 - The data we'd like to graph.
48   -spark()
49   -{
50   - local n numbers=
51   -
52   - # find min/max values
53   - local min=0xffffffff max=0
54   -
55   - for n in ${@//,/ }
56   - do
57   - # on Linux (or with bash4) we could use `printf %.0f $n` here to
58   - # round the number but that doesn't work on OS X (bash3) nor does
59   - # `awk '{printf "%.0f",$1}' <<< $n` work, so just cut it off
60   - n=${n%.*}
61   - (( n < min )) && min=$n
62   - (( n > max )) && max=$n
63   - numbers=$numbers${numbers:+ }$n
64   - done
65   -
66   - # print ticks
67   - local ticks=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
68   - local f=$(( (($max-$min)<<8)/(${#ticks[@]}-1) ))
69   - (( f < 1 )) && f=1
70   -
71   - for n in $numbers
72   - do
73   - echo -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]}
74   - done
75   - echo
76   -}
77   -
78   -# show help for no arguments if stdin is a terminal
79   -if ([ -z $1 ] && [ -t 0 ]) || [ "$1" == '-h' ]
80   -then
81   - help
82   - exit
83   -fi
84   -
85   -spark ${@:-`cat`}
0  zsh/titanium.zsh → titanium/titanium.zsh
File renamed without changes
0  home/.tmux.conf → tmux/.tmux.conf.symlink
File renamed without changes
0  zsh/tmux.zsh → tmux/tmux.zsh
File renamed without changes
0  home/.tmuxinator/betasplash.yml → tmux/tmuxinator.symlink/betasplash.yml
File renamed without changes
0  home/.tmuxinator/charity.yml → tmux/tmuxinator.symlink/charity.yml
File renamed without changes
0  home/.tmuxinator/fumblr.yml → tmux/tmuxinator.symlink/fumblr.yml
File renamed without changes
0  home/.tmuxinator/gtd.yml → tmux/tmuxinator.symlink/gtd.yml
File renamed without changes
0  home/.tmuxinator/mission.yml → tmux/tmuxinator.symlink/mission.yml
File renamed without changes
0  home/.tmuxinator/paula.yml → tmux/tmuxinator.symlink/paula.yml
File renamed without changes
0  home/.tmuxinator/tcl.yml → tmux/tmuxinator.symlink/tcl.yml
File renamed without changes
0  home/.tmuxinator/tsw.yml → tmux/tmuxinator.symlink/tsw.yml