This file contains hidden or 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
require "mechanize" | |
a = Mechanize.new | |
loop do | |
d=a.get("http://www.tickets.london2012.com/browse?form=search&tab=oly&sport=8199&event&venue=loc_2&fromDate&toDate&morning=1&afternoon=1&evening=1&show_available_events=1") | |
if d.body =~ /Woman's/ | |
loop do | |
`growlnotify -m "Woomenz valleyballz tickets naow" -t "NAOW! "` # -s if you wanna to have it sticky | |
`afplay /System/Library/Sounds/Purr.aiff` |
This file contains hidden or 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
#osx | |
λ gcc -o main main.c | |
λ ./main | |
-32 | |
32 | |
0 |
This file contains hidden or 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
require("timeout") | |
t=Thread.new(codeStr) do |code| | |
$SAFE=4 | |
Timeout::timeout(5) {eval code} rescue nil | |
end |
This file contains hidden or 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
httperf --uri=/ --port=3000 --server=localhost --num-conns=20 --num-calls=1000 | |
httperf --client=0/1 --server=localhost --port=3000 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=20 --num-calls=1000 | |
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE | |
Maximum connect burst length: 1 | |
Total: connections 20 requests 20000 replies 20000 test-duration 20.457 s | |
Connection rate: 1.0 conn/s (1022.8 ms/conn, <=1 concurrent connections) | |
Connection time [ms]: min 972.1 avg 1022.8 max 1142.0 median 1017.5 stddev 41.6 | |
Connection time [ms]: connect 0.2 |
This file contains hidden or 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
RSpec::Matchers.define :be_a_multiple_of do |expected| | |
match do |actual| | |
actual % expected == 0 | |
end | |
end |
This file contains hidden or 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
require 'rubygems' | |
require 'randexp' | |
prefix = "DAWID" | |
regexp = /\d\w\d\w/ | |
size = 10 | |
results = (1..size).map{|i| "#{prefix}#{regexp.gen}" } |
This file contains hidden or 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
foo(_, []) -> [] | |
foo(F, [H | T]) -> foo(F(H), T) | |
bar(X) -> | |
case X of | |
ok -> fire_bomb() | |
_ -> crack_error() | |
end | |
moo() -> |
This file contains hidden or 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
require 'mechanize'; Mechanize.new.get('http://google.com/') do |p|; sr = p.form_with(:name => 'f') do |s|; s.q = ARGV[0]; end.submit; sr.links.each do |l|; puts l.text + ":" + l.href; end; end; |
This file contains hidden or 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
class Icinga | |
@@config = {} | |
def self.config(&block) | |
self.instance_eval &block | |
end | |
def self.cmd_file(file_path) | |
@@config[:file_path] = file_path |
This file contains hidden or 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
App.Collections.EntriesList = Backbone.Collection.extend({ | |
model: App.Models.Entry | |
}); |