Skip to content

Instantly share code, notes, and snippets.

@rroblak
rroblak / .bash_profile
Created February 7, 2020 18:13
Alias `git` to `g` with support for `hub` if it's installed
# Alias `hub` to `git` if it's installed.
if [[ ! -z $(command -v hub) ]]; then
eval "$(hub alias -s)"
fi
# Alias `git` to `g` and set up completion (also brings in `hub` completion if it's installed).
alias g=git
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
__git_complete g _git
@rroblak
rroblak / .zshrc
Last active August 29, 2015 14:18
.zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt appendhistory autocd extendedglob notify
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/roblak/.zshrc'
@rroblak
rroblak / .tmux.conf
Created March 9, 2015 04:15
Tmux Configs
# Make vi keys work in copy/paste mode
setw -g mode-keys vi
unbind p
bind p paste-buffer
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# Needed for notify-terminal to work
set-option -g default-command "reattach-to-user-namespace -l bash"
@rroblak
rroblak / gist:d46f3fc057f25569ae20
Created March 4, 2015 23:48
Useful OS X tricks
until some_command_that_is_temporaily_failing; do sleep 30; done; echo 'It works now!' | terminal-notifier
import java.io.PrintWriter
import cascading.stats.CascadingStats
import com.twitter.scalding._
/**
* Writes all custom counters into a tsv file args("counters-file") if this property is set.
*
* Output format:
* counter_name value
@rroblak
rroblak / gist:6b5a8ae89013fe4ddc14
Last active August 29, 2015 14:11
Various bash configs
source /etc/bash_completion.d/git
function g {
if [ $# -gt 0 ]; then
git "$@"
else
git status
fi
}
@rroblak
rroblak / README.md
Last active October 26, 2023 03:22
git diff image files on the command line, with color

This is a simple way to spot check that the modified image in your git index is the image you actually want without having to leave the command line.

Example: http://i.imgur.com/RUenUcM.png

Instructions

  1. Install git, ImageMagick, and jp2a via your favorite package manager.
  2. Put img-ascii-diff somewhere (e.g. ~/bin/img-ascii-diff).
  3. Put attributes in ~/.config/git/attributes.
  4. Modify ~/.gitconfig and add the lines below, pointing to wherever you put img-ascii-diff.
@rroblak
rroblak / gist:10919032
Last active August 29, 2015 13:59
JSON request from the shell
curl -X GET -H "Accept: application/json" -H "Authorization: Bearer <access token>" localhost:3000/api/v1/quizzes/new
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <access token>" localhost:3000/api/v1/quizzes -d '{"quiz":{"answers":[0,1,2,3]}}'
@rroblak
rroblak / pac_aliases
Last active April 12, 2023 13:49
Package manager-independent bash aliases
# paci - install one or more packages
# pacu - upgrade all packages to their newest version
# pacr - uninstall one or more packages
# pacs - search for a package using one or more keywords
# pacinfo - show information about a package
# pacinstalled - show if a package is installed
# paca - list all installed packages
# paclo - list all packages which are orphaned
# pacdnc - delete all not currently installed package files
# pacfiles - list all files installed by a given package
@rroblak
rroblak / .gitconfig
Last active December 18, 2015 04:18
.gitconfig
[color]
branch = auto
diff = auto
status = auto
grep = auto
[color "grep"]
match = blue bold
[color "branch"]
current = yellow reverse
local = yellow