Skip to content

Instantly share code, notes, and snippets.

View rietta's full-sized avatar
🏠
Working from home

Frank Rietta rietta

🏠
Working from home
View GitHub Profile
@rietta
rietta / arcdir.sh
Created October 2, 2013 04:29
Tarbar a directory and move the original to the Trash. First, install these from Hamebrew: brew install trash brew install pigz
#!/usr/bin/env bash
# Archive a directory into a compressed tar file
# and prepare a text file that lists all of the files in each archive.
###
# The trash command is OS X specific ane requires a 3rd party tool -
# brew install trash
# brew install pigz
###
@rietta
rietta / hidden.sh
Created October 2, 2013 04:26
Mac OS X, show/hide files in Finder. I keep it in ~/bin/
#!/usr/bin/env bash
if [ "$1" == "show" ]
then
echo 'Enabling hidden files in Finder'
defaults write com.apple.finder AppleShowAllFiles -bool YES
else
echo 'Turn off hidden files in Finder'
defaults write com.apple.finder AppleShowAllFiles -bool NO
fi
After upgrading from Ruby 1.9.2 to 1.9.3 on a test server, the pg would not install.
mv ~/.rvm/usr/lib ~/.rvm/usr/lib_rvm
bundle config build.pg --with-pg-config=/usr/bin/pg_config.libpq-dev
gem install pg
The mv line was the breakthrough, see:
http://stackoverflow.com/questions/8814924/gem-install-pg-can-not-bind-to-libpq
@rietta
rietta / remove_and_reinstall_homebrew.sh
Created March 17, 2013 03:01
Reinstall Homebrew (Mac OS X)
# Thanks to http://dev.enekoalonso.com/2011/08/09/uninstalling-brew-so-i-can-reinstall/
cd `brew --prefix`
rm -rf Cellar
brew prune
rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
rm -rf ~/Library/Caches/Homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
@rietta
rietta / run_as_nice.sh
Created February 28, 2013 15:35
Have a shell script always run with a nice, low priority
#!/usr/bin/nice /bin/bash
#
# Your script goes here....
#
# Now when this script is run from the command line as ./run_as_nice.sh, it will execute with lower
# priority to avoid causing the load average to spike as much.
update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';
@rietta
rietta / nokofix_for_bashrc
Created December 12, 2012 16:46
Add the following alias to your .bashrc file to be able to run the "nokofix" command in a project while running bundler. This assumes that libiconv was installed using brew.
alias nokofix="gem install nokogiri -- --with-xml2-dir=/usr/local/Cellar/libxml2/2.7.8 --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1/ && bundle config build.nokogiri – –with-xml2-dir=/usr/local/Cellar/libxml2/2.7.8 –with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 –with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1/"
@rietta
rietta / gist:4112483
Created November 19, 2012 18:21
The Provinces of Canada
Province/Territory Abbreviation
Alberta AB
British Columbia BC
Manitoba MB
New Brunswick NB
Newfoundland and Labrador NL
Northwest Territories NT
Nova Scotia NS
Nunavut NU
Ontario ON
@rietta
rietta / us_states_adj.txt
Created November 19, 2012 18:17
United States' State Adjacency Lists
# Author Gregg Lind
# License: Public Domain. I would love to hear about any projects you use if it for though!
# Original location: http://writeonly.wordpress.com/2009/03/20/adjacency-list-of-states-of-the-united-states-us/
AK
AL,MS,TN,GA,FL
AR,MO,TN,MS,LA,TX,OK
AZ,CA,NV,UT,CO,NM
CA,OR,NV,AZ
CO,WY,NE,KS,OK,NM,AZ,UT
@rietta
rietta / gist:3924671
Created October 20, 2012 20:25
Rails fails in JRuby out of box on Mac OS X (with Stack Trace)
My first attempts at running a new Rails application on JRuby is completely failing. Through the process of elimination, I have traced the source of the problem down to the asset pipeline in Rails 3.2. Though I do not know how to fix this:
stat.st_gid unsupported or native support failed to load
org/jruby/RubyFileStat.java:432:in `gid'
This is on October 20, 2012. Using jruby 1.6.7 and Rails 3.2.8 out of the box with the gems as published on this date.
Here are the steps to reproduce - again, no custom code on my part.
Using Mac OS X Mountain Lion, I installed the following: