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
Interesting tidbit: | |
Due to this line in ruby's Timeout module: | |
https://github.com/ruby/ruby/blob/v1_9_3_429/lib/timeout.rb#L84 | |
If you use your own custom class, you don't get the original timeout exception backtrace. | |
This is probably a good thing. |
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 'celluloid/autostart' | |
class FetcherTimeoutError < StandardError; end | |
class ProjectMessage | |
attr_accessor :project | |
def initialize(project) | |
@project = project | |
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
#!/bin/bash | |
PORTS="80 443" | |
UNDO= | |
for p in $PORTS | |
do | |
iptables -I OUTPUT -p tcp --dport $p -j DROP -v | |
UNDO="$UNDO iptables -D OUTPUT -p tcp --dport $p -j DROP -v;" | |
done |
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
script -q /dev/null bundle exec rspec spec/lib/organization/manager_spec.rb -c -f d | bcat |
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
function export_skype_chat_history { | |
sqlite3 ~/Library/Application\ Support/Skype/saimonmoore/main.db "SELECT author,timestamp, body_xml FROM messages WHERE dialog_partner = '$1'" > ~/Desktop/skype_chat_history_$1.txt | |
} |
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
module C; def self.included(base); alias :__foo :foo; define_method :foo do |*args|; puts 'dm:'; puts super(*args);puts send('__foo', *args); end; end; def foo; puts 'C';end; end | |
=> nil | |
>> A.new.foo C | |
=> nil | |
>> class A; include B; include C; end => A | |
>> A.new.foo dm: | |
B | |
C | |
=> nil |
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
$ irb | |
>> class C | |
>> def self.opt? | |
>> true | |
>> end | |
>> end | |
=> nil | |
>> | |
?> module B | |
>> def foo |
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
location / { | |
if (-f $uri/index.html) { | |
add_header Cache-Control "max-age=0, no-store"; | |
add_header Pragma "no-cache"; | |
expires 0; | |
} | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; |
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
$ cat .rbenv-vars | |
PASSWD=$foo | |
$ rbenv vars | |
export PASSWD=''$foo'' | |
$ vim .rbenv-vars | |
$ cat .rbenv-vars | |
PASSWD=\$foo | |
$ rbenv vars | |
export PASSWD=''\$'foo' |
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
for f in $(find ~/dotfiles -type f -iname '.*'); do f_=$(basename $f); ln -nfs ~/dotfiles/$f_ ~/$f_; done |