This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'optparse' | |
require 'ostruct' | |
class OptParse | |
# | |
# Return a structure describing the options. | |
# | |
def self.parse(args) | |
# The options specified on the command line will be collected in *options*. | |
# We set default values here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo /sbin/route add -net x.x.x.0/24 xxx.xxx.xxx.xxx | |
# Save this file somewhere and make it executable (chmod a+x <file>) | |
# Then run 'sudo defaults write com.apple.loginwindow LoginHook /Path/To/Your/Script' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pathmunge () { | |
if [ "$2" = "force" ] || ! echo $PATH | $(which egrep) -q "(^|:)$1($|:)" | |
then | |
if [ "$2" = "after" ] | |
then | |
PATH=$PATH:$1 | |
else | |
PATH=$1:$PATH | |
fi | |
export PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
fail() { | |
echo "Whoops... $*" | |
exit 1 | |
} | |
if [ ! -d /opt/boxen ] ; then | |
sudo mkdir -p /opt/boxen && sudo chown ${USER}:staff /opt/boxen | |
fi || fail "could not create /opt/boxen" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class State | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
attr_reader :all | |
US_STATES = { | |
AL: "Alabama", | |
AK: "Alaska", | |
AZ: "Arizona", |
NewerOlder