Skip to content

Instantly share code, notes, and snippets.

View scottwb's full-sized avatar

Scott W. Bradley scottwb

View GitHub Profile
@scottwb
scottwb / check_nfs.sh
Created February 24, 2010 22:41
Checks if NFS mount is wedged.
#!/bin/sh
#
# Checks to see if an NFS-mounted dir is wedged.
#
# Sometimes the NFS mount goes down. Other tactics like rpcinfo didn't
# pan out, so this hack is just based on trying to ls the mounted dir
# and timing that out if it doesn't respond quickly.
#
# Usage: check_nfs.sh <dirpath>
#
@scottwb
scottwb / gist:350738
Created March 31, 2010 19:14 — forked from jnunemaker/gist:350680
Alias file stolen from jnunemaker
alias reload='. ~/.bashrc'
alias ea="$EDITOR ~/bin/dotfiles/bash/aliases && reload"
alias ee="$EDITOR ~/bin/dotfiles/bash/env && reload"
alias eh="$EDITOR ~/bin/dotfiles/bash/heroku && reload"
# Processes
alias tu='top -o cpu'
alias tm='top -o vsize'
# Projects
@scottwb
scottwb / gist:357446
Created April 6, 2010 10:29
Previews a markdown file in the browser.
#!/usr/bin/env ruby
#
# Previews a markdown file in the browser.
#
# Usage: markdown <filename>
#
# Requires: gem install maruku
#
infile = ARGV[0]
= Ruby Packaging Standard
The aim of this document is to specify a common structure of how a
Ruby package distributed as source (that is, but not limited to,
development directories, version-controlled repositories, .tar.gz,
Gems, ...) should conform to.
(See RFC 2119 for use of MUST, SHOULD, SHALL.)
== Library files
@scottwb
scottwb / gist:366373
Created April 14, 2010 21:38
JS to detect if the user has been to certain URLs.
%div#whereyoubeen{:style => "display:none"}
%a{:href => "http://www.google.com/"} Google
%a{:href => "http://www.amazon.com/"} Amazon
%a{:href => "http://www.yahoo.com/"} Yahoo
%a{:href => "http://www.neimanmarcus.com/"} Neiman Marcus
%a{:href => "http://www.strings.com/"} Strings
%a{:href => "http://www.huffingtonpost.com/"} Huffington Post
:javascript
alert("You have been to: " + $$('#whereyoubeen a:visited').map(function(link) {return link.innerHTML;}).join(','));
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
@scottwb
scottwb / git_config_smartsync
Created April 17, 2010 10:36
Git config to use SmartSynchronize as difftool
[diff]
tool = smartsynchronize
[difftool "smartsynchronize"]
cmd = /Application/SmartSynchronize.app/smartsynchronize.sh "$LOCAL" "$REMOTE"
[difftool]
prompt = false

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file, as long the original
# URL is included. See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
# Last updated: May 11th, 2010 at 13:56
@scottwb
scottwb / gist:414979
Created May 26, 2010 20:10
One-liner to show a github log/diff of the changes in master since the last merge to stable.
#!/bin/sh
open http://github.com/strings/ranger_site/compare/stable...master