Skip to content

Instantly share code, notes, and snippets.

@rtomayko
rtomayko / license
Created January 27, 2010 12:04 — forked from ap/license
#!/bin/sh
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
exec sh -c "tail -n +$(expr $LINENO + 1) < $0 | sed s/DATE/$(date +%Y)/"
Copyright (c) DATE Ryan Tomayko
Permission is hereby granted, free of charge, to any person ob-
taining a copy of this software and associated documentation
#!/bin/sh -e
# Usage: git-amend <commit>
# Amend changes staged in the index to <commit>, or edit commit message if
# no changes are currently staged. Modifications not staged are stashed and
# then reapplied once the amend and rebase operations are complete.
#
# This command rewrites history. Do not run it after <commit> or its
# decendants have been published to the world.
#
# This version in POSIX sh by Ryan Tomayko <tomayko.com/about>
@rtomayko
rtomayko / gist:229851
Created November 9, 2009 10:10
Automatic log config based on existence of log file
# Configure logging based on the existence of the log file. If the
# log file doesn't exist, logging is disable entirely and no log
# file will be created. If the log file does exist, logging is
# enabled and turned up to 11.
#
# Example is from config/environments/test.rb in a Rails app but it
# could easily be adapted to other environments/frameworks.
# Disabling logging in test environments can speed things up a bit.
# In your environment:
@rtomayko
rtomayko / gist:229079
Created November 8, 2009 03:36
htop on macosx
# htop on macosx
# I have a staff writeable /usr/local/src directory where I put tarballs
# and stuff but you can do this under /tmp or whatever instead
mkdir -p /usr/local/src
cd /usr/local/src
# grab the git repo and checkout the osx branch
git git://github.com/AndyA/htop-osx.git
cd htop-osx
@rtomayko
rtomayko / nightly-chromium
Created November 7, 2009 04:48
Fetch and install the latest Chromium mac nightly.
#!/bin/sh
# Fetch and install the latest Chromium mac nightly build, but only
# if it's different from the currently installed version. An existing
# Chromium.app is backed up to .Chromium.app in the same directory.
#
# Install with:
# $ curl -L http://bit.ly/night-chrome > ~/bin/nightly-chromium
# $ chmod +x ~/bin/nightly-chromium
#
# To upgrade to latest chromium version:
# Subject: Re: Newbie to Sinatra looking for example
# From: Ryan Tomayko <r@tomayko.com>
# To: sinatrarb@googlegroups.com
# Content-Type: text/plain; charset=UTF-8
#
# > Alright, so I'm pretty new to both Sinatra and web applications, and I
# > was wondering if someone could write up a quick example use of
# > Sinatra. Basically I want to see how Sinatra handles <form>s in one
# > view, and then shows the input on a different view.
# >
@rtomayko
rtomayko / .screenrc
Created October 28, 2009 07:42
~rtomayko/.screenrc
# ~rtomayko/.screenrc
# -------------------------------------------------------------------
# Settings
# -------------------------------------------------------------------
crlf off # No Microsoft linebreaks
startup_message off # bypass GPL notice (we're aware)
defscrollback 15000 # big scrollback
shell bash # don't start login shells
shelltitle "" # no title by default - set in PS1
#!/bin/sh
#
## Usage: github-open FILE [LINE]
## Open GitHub file/blob page for FILE on LINE. FILE is the path to the
## file on disk; it must exist and be tracked with the current HEAD
## revision. LINE is the line number or line number range (e.g., 10-50).
##
## Open foo/bar.rb in browser:
## $ github-open foo/bar.rb
##
@rtomayko
rtomayko / gist:216208
Created October 22, 2009 19:26
tig does author initials
$ cat > ~/.tigrc
set show-date = no
set author-width=3
<ctrl-d>
$ tig
RT harmful specs - disable them
KN [defunkt/master] I shine the shoes around here
CW don't let daemon serving ruin the public / private flow
CW ensure the listeners are notified, just in case
CW add "open sourced" event
#!/bin/sh
file="preview.html"
trap "rm -f $file" EXIT
cat > "$file"
open "$file"
sleep 2