Skip to content

Instantly share code, notes, and snippets.

View jsierles's full-sized avatar
🎯
Focusing

Joshua Sierles jsierles

🎯
Focusing
View GitHub Profile
client = Client.new(JID.new("..."))
client.connect
client.auth("...")
pres = Presence.new
pres.priority=5
client.send(pres)
puts "I'm online!"
pubnode_news = PubSub::NodeHelper.new(client,"engineyard.com",pubsubnode)
main_loop = GLib::MainLoop.new
conn = LM::Connection.new(host)
conn.jid = jid
conn.open do |result|
puts "Connection open block"
if result
puts "Connection opened correctly"
conn.authenticate(login, password, "Test") do |auth_result|
Herakles
--------
traceroute to 65.74.158.89 (65.74.158.89), 64 hops max, 40 byte packets
1 192.168.1.1 (192.168.1.1) 2.900 ms 1.206 ms 1.003 ms
2 192.168.153.1 (192.168.153.1) 34.468 ms 31.997 ms 33.170 ms
3 209.Red-80-58-120.staticIP.rima-tde.net (80.58.120.209) 37.884 ms 31.399 ms 35.497 ms
4 So-5-0-0-0-grtmadpe3.red.telefonica-wholesale.net.9.16.84.in-addr.arpa (84.16.9.161) 44.880 ms * *
5 So6-3-0-0-grtparix3.red.telefonica-wholesale.net (84.16.12.118) 76.288 ms 71.543 ms So0-3-0-0-grtparix3.red.telefonica-wholesale.net (213.140.43.250) 74.450 ms
6 te-7-3.car1.Paris1.Level3.net (212.73.207.97) 138.550 ms 132.915 ms te-4-1.car1.Paris1.Level3.net (212.73.207.69) 216.089 ms
7 ae-32-52.ebr2.Paris1.Level3.net (4.68.109.62) 83.258 ms 78.076 ms 72.184 ms
#!/usr/bin/env ruby
#
# Find bloating passengers and kill them gracefully. Run from cron every minute.
#
# required for passenger since cron has no environment
ENV['HTTPD'] = 'httpd'
MEM_LIMIT = ARGV[0] || 500
require "timeout"
class MemCache
alias_method :old_get, :get
alias_method :old_set, :set
alias_method :old_incr, :incr
alias_method :old_add, :add
alias_method :old_delete, :delete
alias_method :old_get_multi, :get_multi
#!/usr/bin/env ruby
#
# fetch hosts from amazon EC2 meta-data
#
# Based on http://dysinger.net/2008/10/13/using-amazon-ec2-metadata-as-a-simple-dns
#
%w(logger optparse rubygems right_aws resolv pp).each { |l| require l }
LOGGER = Logger.new("/var/log/fetch_hosts.log")
desc "remotely console"
task :console, :roles => :app do
input = ''
run "cd #{current_path} && ./script/console #{ENV['RAILS_ENV']}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /^(>|\?)>/
end
end
desc "remotely console"
task :console, :roles => :app do
input = ''
run "cd #{current_path} && ./script/console #{ENV['RAILS_ENV']}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /^(>|\?)>/
end
end
hoststatus {
host_name=app-01
modified_attributes=0
check_command=check-host-alive
check_period=24x7
notification_period=24x7
check_interval=1.000000
retry_interval=1.000000
event_handler=
has_been_checked=1
# solo.rb
cookbook_path "/var/chef/cookbooks"
node_path "/var/chef/nodes"
#search_index_path File.join(File.dirname(__FILE__), "search_index")
log_level :info
file_store_path "/var/chef"
file_cache_path "/var/chef/cache"
node_name `hostname -s`
% ls /var/chef/cookbooks