View gist:78305
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
#define TRY_ASSIGN(v, x) do { \ | |
v = x; \ | |
if (v == -1) { \ | |
fprintf(stderr, # x ": %s\n", strerror(errno)); \ | |
exit(EXIT_FAILURE); \ | |
} \ | |
} while (0) | |
#define TRY(x) do { int unused; TRY_ASSIGN(unused, x); } while (0) |
View gist:210240
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
alias ssh_gaul="export TERM=xterm && ssh USER_NAME@obelix.gaul.csd.uwo.ca" |
View untitled.txt
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
Fib(0 * 10): 0 | |
Fib(1 * 10): 55 | |
Fib(2 * 10): 6765 | |
Fib(3 * 10): 832040 | |
Fib(4 * 10): 102334155 | |
Fib(5 * 10): 12586269025 | |
Fib(6 * 10): 1548008755920 | |
Fib(7 * 10): 190392490709135 | |
Fib(8 * 10): 23416728348467685 | |
Fib(9 * 10): 2880067194370816120 |
View untitled.c
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
byte * fib(byte *prev, byte *curr, int n) | |
{ | |
byte *next; | |
// Fib(0) = 0 | |
if (n == 0) { return prev; } | |
next = sum(prev, curr); | |
if (n > 2) { | |
return fib(curr, next, n - 1); | |
} else { | |
return next; |
View gist:318526
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
Run the following commands | |
========================== | |
wget "http://kernel.org/pub/software/scm/git/git-1.7.0.1.tar.bz2" | |
tar xvf git-1.7.0.1.tar.bz2 | |
mkdir $HOME/local/ | |
cd git-1.7.0.1 | |
./configure --prefix=$HOME/local/ | |
make | |
make install |
View gist:389415
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
# Credit to Brandon Keepers | |
# http://opensoul.org/2007/2/9/automatically-backing-up-your-remote-database-on-deploy | |
require 'yaml' | |
desc "Backup the remote production database" | |
task :backup, :roles => :db, :only => { :primary => true } do | |
filename = "#{application}.dump.#{Time.now.to_i}.sql.bz2" | |
file = "/tmp/#{filename}" | |
env = ENV['RAILS_ENV'] || 'development' | |
on_rollback { delete file } |
View .vimrc
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
" Use Vim settings, rather than Vi settings | |
set nocompatible | |
" Use The Pope's awesome pathogen.vim to load plugins | |
call pathogen#runtime_append_all_bundles() | |
" Automatically detect filetypes | |
filetype on | |
" Use syntax highlighting |
View t
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
ruby-1.9.2-rc1 > f = Father.new | |
=> #<Father id: nil, name: nil, created_at: nil, updated_at: nil> | |
ruby-1.9.2-rc1 > f.name = "Dave" | |
=> "Dave" | |
ruby-1.9.2-rc1 > s = Son.new :name => "Nate" | |
=> #<Son id: nil, name: "Nate", father_id: nil, created_at: nil, updated_at: nil> | |
ruby-1.9.2-rc1 > f.son | |
f.son_ids f.sons f.sons= f.son_ids= | |
ruby-1.9.2-rc1 > f.sons << s | |
=> [#<Son id: nil, name: "Nate", father_id: nil, created_at: nil, updated_at: nil>] |
OlderNewer