Skip to content

Instantly share code, notes, and snippets.

Avatar
👯‍♀️
OMG

Ian Vaughan IanVaughan

👯‍♀️
OMG
View GitHub Profile
@IanVaughan
IanVaughan / flickr gem 1.0.2.rb
Created Feb 22, 2011
flickr gem 1.0.2 installed from default server does not work too well!
View flickr gem 1.0.2.rb
ruby-1.9.2-p0 :001 > require 'rubygems' # required?
=> true
ruby-1.9.2-p0 :002 > require 'flickr'
=> true
ruby-1.9.2-p0 :003 > f = Flickr.new('xxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
=> #<Flickr:0xa713dc4 @api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", @host="http://flickr.com", @api="/services/rest">
ruby-1.9.2-p0 :004 > u = f.users('Ian Vaughan')
ArgumentError: File does not exist: .
from /home/ian/.rvm/gems/ruby-1.9.2-p0/gems/xml-simple-1.0.14/lib/xmlsimple.rb:983:in `find_xml_file'
@IanVaughan
IanVaughan / KillValgrind.sh
Created Apr 15, 2011
Bash command line to kill one-by-one any valgrind processes running
View KillValgrind.sh
kill `ps aux | grep [v]algrind | awk '{print $2}' | tail -n1`
@IanVaughan
IanVaughan / TopMine.sh
Created Apr 15, 2011
Shows via 'top' only the processes of a given name
View TopMine.sh
#!/bin/bash
PIDS=`ps aux | grep "[n]ame" | awk '{print $2}'`
if [ $PIDS = "" ]; then
exit
fi
PID_LIST=
for pid in $PIDS; do
PID_LIST="-p$pid $PID_LIST"
done
top ${PID_LIST}
@IanVaughan
IanVaughan / record.sh
Created Sep 17, 2011
Linux Bash script to record the audio stream for a period of time
View record.sh
#!/bin/bash
FILENAME=$1
HOURS=$2
SECONDS=$((3600 * ${HOURS}))
echo "Recording ${FILENAME} for ${SECONDS} seconds..."
rec -c 2 ${FILENAME}.ogg trim 0 ${SECONDS} #7200
View gist:1325768
# http://gitready.com/intermediate/2009/02/06/helpful-command-aliases.html
git config --global alias.rb rebase
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.df df
git config --global alias.lg log -p
@IanVaughan
IanVaughan / monitor.sh
Created Jan 3, 2012
Bash script that monitors a directory of source files for changes, then does something (like build) if changed.
View monitor.sh
#!/bin/bash
# Bash script that monitors a directory of source files for changes, then does something (like build) if changed.
# It does this via creating a SHA of the ls tree of the folder in question, and if changed, triggers the action.
# The "action" is just the variable $command, normally make.
# Usage :
# ./monitor.sh
# Then save a file, and it gets built! Magic!
command="make"
params=""
@IanVaughan
IanVaughan / monitor2.sh
Created Jan 3, 2012
Update to monitor.sh, this time its serious! This monitors a group of directories, and if a file in one of them changes it only actions that directory command.
View monitor2.sh
#!/bin/bash
# Update to monitor.sh, this time its serious!
# This monitors a group of directories for source file changes, and if a file in one of them changes it only actions that directory command.
# It does this via creating a SHA of the ls tree of the folder in question, and if changed, triggers the action.
# The "action" is just the variable $command, normally make.
# Usage :
# ./monitor.sh
# Then save a file, and it gets built! Magic!
@IanVaughan
IanVaughan / output
Created Feb 28, 2012
brew install gpg
View output
$ brew doctor
Your system is raring to brew.
$ brew update
Already up-to-date.
$ brew install -v gpg
==> Downloading ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.12.tar.bz2
File already downloaded in /Users/ivaughan/Library/Caches/Homebrew
/usr/bin/tar xf /Users/ivaughan/Library/Caches/Homebrew/gnupg-1.4.12.tar.bz2
@IanVaughan
IanVaughan / git-up-all.rb
Created Mar 26, 2012
Update all repos in one shot
View git-up-all.rb
# with git-up (gem install git-up)
`ls`.split.each { |f| `cd #{f}; git up` }
@IanVaughan
IanVaughan / output
Created May 7, 2012
Can't require local installed gem
View output
$ gem install /Users/ivaughan/dev/ianvaughan/ruby_kml/ruby_kml-0.0.1.gem ✹ ✭master ‹1.9.3-p125›
Successfully installed ruby_kml-0.0.1
1 gem installed
$ gem list ruby_kml ✹ ✭master ‹1.9.3-p125›
*** LOCAL GEMS ***
ruby_kml (0.0.1)
$ gem contents ruby_kml ✹ ✭master ‹1.9.3-p125›
/Users/ivaughan/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/ruby_kml-0.0.1/CHANGELOG