View include-after.rb
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
module M; end | |
module Soup; end | |
class C; include M; end | |
module M; include Soup; end | |
C.ancestors #=> [C, M, Object, Kernel, BasicObject] |
View syslog-injection.sh
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
# Redirect STDOUT/STDERR into syslog | |
exec > >(logger -p user.info) 2> >(logger -p user.warn) |
View ssh_config
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
# (hint from http://blogs.perl.org/users/smylers/2011/08/ssh-productivity-tips.html) | |
ControlMaster auto | |
ControlPath /tmp/ssh_mux_%h_%p_%r | |
ControlPersist 10m |
View autotest-xterm-title.rb
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
# Pop this in your ~/.autotest | |
def set_title(title) | |
if ENV["TERM"] =~ /^xterm/ | |
puts "\e]0;#{title}\007" | |
end | |
end | |
Autotest.add_hook(:green) do | |
set_title "GREEN - all passed" |
View pip-install-ansible.log
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
Downloading/unpacking ansible | |
Running setup.py egg_info for package ansible | |
DATA FILES=[('/usr/share/ansible/', ['./library/add_host', './library/apt', './library/apt_key', './library/apt_repository', './library/assemble', './library/async_status', './library/async_wrapper', './library/authorized_key', './library/bzr', './library/cloudformation', './library/command', './library/copy', './library/cron', './library/debug', './library/django_manage', './library/easy_install', './library/ec2', './library/ec2_facts', './library/ec2_vol', './library/facter', './library/fail', './library/fetch', './library/file', './library/fireball', './library/gem', './library/get_url', './library/git', './library/group', './library/group_by', './library/hg', './library/homebrew', './library/ini_file', './library/lineinfile', './library/lvg', './library/lvol', './library/macports', './library/mail', './library/mongodb_user', './library/mount', './library/mysql_db', './library/mysql_user', './library/nagios', './library/net |
View subl-edit.rb
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
#! /usr/bin/ruby | |
file = ARGV.first || '.' | |
args = [file] | |
args.unshift("-w") unless File.directory?(file) | |
exec("subl", *args) |
View ssh-psql.sh
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
#!/bin/sh | |
db_host=db-server | |
db_user=supersecret | |
db_name=myapp_production | |
port=65432 | |
ssh_ctl=/tmp/$$-ssh-ctl-sock | |
ssh -S $ssh_ctl -fnN -L $port:localhost:5432 $db_host |
View valid.rb
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
# I have a class that delegates functionality to a couple of objects that it | |
# constructs. I want to test this in isolation. I want to make sure that the | |
# objects are constructed with the right arguments. I also want to make sure | |
# that the results from the objects are handled correctly. | |
# | |
# I'm finding it hard to structure the code and test in a way that isn't | |
# cumbersome. What's below works, but it feels like a lot of stubbing and setup | |
# for something the should be simpler. | |
# | |
# Anyone got a better approach for this? |
View enum_type.rb
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
# Provide support for defining enumerated types. | |
# | |
# Example | |
# | |
# class Colour | |
# | |
# extend EnumType | |
# | |
# define :red do | |
# # ... |
View gist:2946149
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
[ | |
{ "keys": ["super+ctrl+r"], "command": "reveal_in_side_bar" }, | |
{ "keys": ["super+shift+\\"], "command": "reindent" }, | |
{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser"} } | |
] |