Skip to content

Instantly share code, notes, and snippets.

View sfgeorge's full-sized avatar

Stephen George sfgeorge

View GitHub Profile
@sfgeorge
sfgeorge / adhearsion-jruby-startup.rb
Created April 12, 2014 20:11
Start Adhearsion in JRuby
# Start Adhearsion in JRuby, while building a pidfile as soon as possible.
def ahnctl_start
shell_command = "#{exec_ahn_async} && #{wait} && #{save_pid}"
%x{shell_command}
end
private
# Run start in the background, since it is not daemonized.
@sfgeorge
sfgeorge / timestamp_it.sh
Created April 3, 2014 21:43
bash function for adding timestamps
#!/bin/bash
# Adds a timestamp beside every line of data received on STDIN.
# Turns this -> Into that:
# -> Time Data
# [INFO] event 1 -> 04-03-2014 12:00:01 [INFO] event 1
# [INFO] event 2 -> 04-03-2014 12:00:02 [INFO] event 2
# example usage: tail -f some.log | timestamp_it > some-timed.log
@sfgeorge
sfgeorge / adhearsion.log
Last active August 29, 2015 13:57
punchblock-issue-memleak test on Punchblock 2.1.1 (crash before able to test for mem leak)
[2014-03-19 02:03:25] INFO Adhearsion::PunchblockPlugin::Initializer: Starting connection to server
[2014-03-19 02:03:25] INFO Adhearsion::PunchblockPlugin::Initializer: Connected to Punchblock server
[2014-03-19 02:03:25] INFO Adhearsion::Process: Transitioning from booting to running with 0 active calls due to booted event.
[2014-03-19 02:03:25] INFO Adhearsion::Initializer: Adhearsion v2.4.0 initialized in "integration"!
[2014-03-19 02:03:38] INFO Adhearsion::Router: Call cb547d66-26c8-4e51-a768-7de42597a79b selected route "default" (LeakyController)
[2014-03-19 02:03:38] INFO Adhearsion::Call: cb547d66-26c8-4e51-a768-7de42597a79b@: Executing controller #<LeakyController call=cb547d66-26c8-4e51-a768-7de42597a79b, metadata={}>
[2014-03-19 02:03:41] INFO Adhearsion::Call: cb547d66-26c8-4e51-a768-7de42597a79b@: Call ended due to hangup
[2014-03-19 02:03:46] INFO Adhearsion::Router: Call b0e435eb-6d4f-4133-9a6d-6faca30afbfc selected route "default" (LeakyController)
[2014-03-19 02:03:46] INFO Adhearsi
@sfgeorge
sfgeorge / ahn-gc-log-afb3c6b.log
Created March 19, 2014 02:36
punchblock-issue-memleak test on afb3c6b
3.659: [GC 65600K->11278K(251264K), 0.0260710 secs]
5.690: [GC 76878K->15723K(251264K), 0.0238540 secs]
6.753: [GC 81323K->19927K(251264K), 0.0291840 secs]
8.108: [GC 85527K->29833K(251264K), 0.0323710 secs]
9.352: [GC 95433K->38990K(251264K), 0.0316450 secs]
14.642: [GC 104590K->46932K(225408K), 0.0429300 secs]
16.165: [GC 86676K->52624K(225280K), 0.0412700 secs]
34.404: [GC 92368K->53545K(237440K), 0.0196970 secs]
35.818: [GC 92005K->54583K(220864K), 0.0183110 secs]
38.803: [GC 93047K->54826K(235136K), 0.0178710 secs]
@sfgeorge
sfgeorge / wat.rb
Last active August 29, 2015 13:57
WAT
def all_or_nothing_a(value)
if value.eql? :all
'You win!'
elsif
value
end
end
def all_or_nothing_b(value)
if value.eql? :all
@sfgeorge
sfgeorge / 0_reuse_code.js
Created March 13, 2014 12:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sfgeorge
sfgeorge / adhearsion.god
Created April 12, 2013 20:42
An antiquated god watch for Adhearsion
# run with: rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god
# debug with: rvmsudo god quit && rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god -D
@deploy_path = '/srv/phone/phonzy'
@shared_path = File.join @deploy_path, 'shared'
@app_path = File.join @deploy_path, 'current', 'ahn'
@log_path = File.join @shared_path, 'log'
@pid_path = File.join @shared_path, 'pids'
@pid_file = File.join @pid_path, 'adhearsion.pid'
@god_env = YAML.load_file("#{@shared_path}/config/god_environment.yml")
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 52 110832 149208 1530724 0 0 4 232 1593 3277 1 1 98 1 0
0 0 52 111328 149208 1530728 0 0 0 0 1470 3213 0 0 99 0 0
4 0 52 103832 149208 1530744 0 0 0 236 1481 3273 8 4 87 0 0
2 0 52 88852 149208 1530724 0 0 0 0 1498 3227 43 8 49 0 0
2 0 52 65060 149208 1530756 0 0 44 0 1568 3261 42 9 49 0 0
2 0 52 24808 149208 1530804 0 0 0 0 1478 2785 45 6 49 0 0
0 0 52 110772 149208 1530940 0 0 0 0 1192 2196 25 3 72 0 0
1 0 52 110672 149212 1530908 0 0 0 452 1239 2147 0 1 98 0 0
events.after_initialized.each do
puts "Knock, knock"
raise 'fury'
puts "Who's there?"
end