Skip to content

Instantly share code, notes, and snippets.

View brandondrew's full-sized avatar

Brandon Zylstra brandondrew

  • UC Berkeley
  • the tubes
View GitHub Profile
@brandondrew
brandondrew / script-generate.bash
Created February 5, 2009 04:45
Never forget to run your migrations again
# add this to your .bash_profile or your .zshrc or whatever
# then use sg (or your preferred abbreviation) instead of script/generate
# and never forget to run migrations again
function sg() {
script/generate $@
echo "Would you like to run the migrations right now?"
read CHOICE
if [ "$CHOICE" = "y" ] || [ "$CHOICE" = "yes" ]
then
echo "rake db:migrate" && rake db:migrate
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php
############################################
## GoDaddy specific options
#!/bin/zsh
mkdir -p /tmp/gist
cd /tmp/gist
curl http://github.com/defunkt/gist/raw/master/gist.rb > gist
chmod 755 gist
sudo mv gist /usr/local/bin/gist
echo "Command-line Gist is now installed"
def date_to_epoch(date, offset)
Time.local(date.year, date.month, date.day + offset).to_i
end
# example:
# departure_date = Date.today
# days_until_return = 1
# puts date_to_epoch(departure_date, days_until_return)
#!/bin/bash
###########################################################
# TRIBUNE-SPECIFIC BUILD HOME script:
# This script sets up your home directory fast with basic
# necessities and amenities, to give you sanity when you
# work on a Unix box where you don't have root access.
###########################################################
# TO USE:
# curl https://raw.github.com/gist/259348/build_home.sh | bash
# OR:
require 'feedzirra'
# fetching a single feed
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing")
# feed and entries accessors
feed.title # => "Paul Dix Explains Nothing"
feed.url # => "http://www.pauldix.net"
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing"
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0"
@brandondrew
brandondrew / beanstalkd-macports-1.4.6_1.txt
Created September 30, 2011 00:50
How to fix beanstalkd 1.4.6 compile error (MacPorts)
Just a informational gist if you plan to install "beanstalkd" via MacPorts and get a compiler error:
:info:build net.c: In function 'make_server_socket':
:info:build net.c:35: warning: 'fd' may be used uninitialized in this function
:info:build make[1]: *** [net.o] Error 1
:info:build make[1]: *** Waiting for unfinished jobs....
This is a known issue within the "net.c" file. I've found a diff[1] for said file on the web and applied it locally which then allowed me to install the port without problems.
If your install fails like:
@brandondrew
brandondrew / build_home.sh
Last active December 23, 2021 14:16
Script to automatically build your new home directory on Unix or Linux boxes (with Spartan enhancements)
#!/bin/bash
###############################################################
# BUILD HOME script:
# This script sets up your home directory fast with basic
# necessities and amenities, to give you sanity when you
# work on a Unix box where you don't have root access.
###############################################################
### TO USE:
# wget https://gist.github.com/raw/3639058/build_home.sh
# bash build_home.sh
@brandondrew
brandondrew / tmux_local_install.sh
Created October 19, 2012 00:18 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
TMUX_VERSION="1.7"
LIBEVENT_VERSION="2.0.20"
NCURSES_VERSION="5.9"
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.