Skip to content

Instantly share code, notes, and snippets.


Gabriele Renzi riffraff

View GitHub Profile
View gist:6634793
def stuff
puts "ciao"
def magic
at_caller_method_exit { puts "magic!" }
View gist:4250396
mecbucpro:tmp postgres$ /Library/PostgreSQL/9.2/bin/pg_upgrade --old-port 5432 --new-port 5433 --old-datadir /Library/PostgreSQL/9.1/data/ --new-datadir /Library/PostgreSQL/9.2/data/ --old-bindir /Library/PostgreSQL/9.1/bin/ --new-bindir /Library/PostgreSQL/9.2/bin/ --verbose --link --retain --check --user=postgres
Running in verbose mode
Performing Consistency Checks
Checking current, bin, and data directories ok
Checking cluster versions ok
pg_control values:
First log file ID after reset: 28
First log file segment after reset: 215
View gist:3088764
# possible now
def retrying times=x # or strategy
attempt = 0
retry if attempt < times # or retry if strategy
retrying(1) { open_url }
riffraff / gist:2882358
Created Jun 6, 2012
linkedin dump password check
View gist:2882358
# assumes you have the dump in the same dir as combo_not.txt
require 'digest/sha1'
puts "insert password"
system "stty -echo"
pass = gets.chomp
system "stty echo"
hex= Digest::SHA1.hexdigest(pass)
puts hex
system "grep #{hex} combo_not.txt"
riffraff / input data
Created Apr 22, 2012
crash with nokogiri 1.5.2 on osx with finalizers
View input data
<!DOCTYPE html>
<html xmlns:fb="">
<meta charset="utf-8">
All Topics
- The Latest News Headlines, Videos and Images
riffraff / gist:1883670
Created Feb 22, 2012
ruby 1.9 regex to match s-expressions
View gist:1883670
#matches something like an s-expression
R = %r@
(?<atom> [-\w]+){0}
(?<quote> '\g<expr>){0}
\g<atom> |
\g<quote> |
(?<exprs> (\s+ \g<expr>)* )
View gist:1554484
>> 'asd'.pronounceable?
=> 0.3333333333333333
>> 'sdf'.pronounceable?
=> 0.3333333333333333
>> 'skdf'.pronounceable?
=> 0.25
>> 'skadf'.pronounceable?
=> 0.6
>> 'skadkf'.pronounceable?
=> 0.5
View gist:1330812
mecbucpro:~ riffraff$ ruby -e "Float('0.0')"
| Configuration Files |
| |
| System File: /Users/riffraff/.rvm/rubies/maglev-head/etc/system.conf |
| |
| Executable File: /Users/riffraff/gem.conf |
| Warning: File not found (errno=2,ENOENT, The file or directory specified cannot
| be found) |
View gist:1188087
Suggestions from 2011/08/05 for non-obvious SF/Fantasy movies, with many thanks to anyone who answered. Apparently thee isn't much new for me but they were all great suggestions!
- gattaca (suggested twice. Great movie, but also quite known imho)
- dark city (loved it, generally underrated imho)
- primer (mindbending, cheaply made, very geeky)
- La jetée (TBD)
- pandorum (arguably the best "in space" movie to come out recently
- I'm a cyborg, but that's ok (not sci-fi but very enjoyable)
- Videodrome (masterpiece, very old but very famous)
- Aeon Flux (real actors movie: meh; animation: kewl)
View gist:998973
task 'run' => :environment do
20.times do
r = Rating.limit(20).includes(:comment => :post).to_a
results = RubyProf.stop