Skip to content

Instantly share code, notes, and snippets.

LOGFILE = "/var/log/#{PROJECT}/#{now.strftime('%Y-%m')}/#{now.strftime('%Y-%m-%d')}.production.log"
STATEFILE = "/var/lib/munin/plugin-state/rails_response_time_#{TITLE}_#{PROJECT}#{FILTER}.state"
# get the state
statefile = File.new(STATEFILE, "r")
statefile.each do |line|
amount = line.to_i
end
statefile.close
@theflow
theflow / gdb backtrace
Created July 11, 2011 13:33
eventmachine SSL bug
(gdb) backtrace
#0 0xb73ab290 in ?? () from /lib/i686/cmov/libcrypto.so.0.9.8
#1 0xb73aa5bd in BIO_read () from /lib/i686/cmov/libcrypto.so.0.9.8
#2 0xb747df0a in SslBox_t::GetCiphertext (this=0x8befab8, buf=0xdc <Address 0xdc out of bounds>, bufsize=-1430968312) at ssl.cpp:352
#3 0xb748278b in ConnectionDescriptor::_DispatchCiphertext (this=0xaab52008) at ed.cpp:1133
#4 0xb7482a5d in ConnectionDescriptor::_DispatchInboundData (this=0x8c24e08, buffer=0xbfcbe8ab "\024\003\001", size=47) at ed.cpp:767
#5 0xb7482b71 in ConnectionDescriptor::Read (this=0x8c24e08) at ed.cpp:718
#6 0xb746eb9c in EventMachine_t::_RunSelectOnce (this=0x8d59240) at em.cpp:859
#7 0xb7470aff in EventMachine_t::_RunOnce (this=0x1a734b0) at em.cpp:455
#8 0xb74738d4 in EventMachine_t::Run (this=0x8d59240) at em.cpp:432
@theflow
theflow / stud ltrace
Created September 5, 2011 15:16
stud tcpdump
16:52:36.401720 IP 176.21.229.248.55809 > lb1-staging.nextpodio.dk.https: Flags [P.], seq 1918208748:1918209089, ack 3750713440, win 32832, options [nop,nop,TS val 787195431 ecr 147416499], length 341
16:52:36.401745 IP lb1-staging.nextpodio.dk.https > 176.21.229.248.55809: Flags [R], seq 3750713440, win 0, length 0
16:52:36.407947 IP 176.21.229.248.55810 > lb1-staging.nextpodio.dk.https: Flags [P.], seq 3556497451:3556497488, ack 3810623073, win 32832, options [nop,nop,TS val 787195432 ecr 147416857], length 37
16:52:36.407954 IP lb1-staging.nextpodio.dk.https > 176.21.229.248.55810: Flags [R], seq 3810623073, win 0, length 0
16:52:36.410181 IP 176.21.229.248.55810 > lb1-staging.nextpodio.dk.https: Flags [F.], seq 3556497488, ack 3810623073, win 32832, options [nop,nop,TS val 787195447 ecr 147416857], length 0
16:52:36.410188 IP lb1-staging.nextpodio.dk.https > 176.21.229.248.55810: Flags [R], seq 3810623073, win 0, length 0
16:52:36.413817 IP 176.21.229.248.55809 > lb1-staging.nextpodio.dk.https: Flags [P.]
$ gunicorn --workers=2 --timeout=0 --debug --log-level DEBUG test:app
2013-07-10 11:49:00 [5412] [DEBUG] Current configuration:
2013-07-10 11:49:00 [5412] [DEBUG] proxy_protocol: False
2013-07-10 11:49:00 [5412] [DEBUG] worker_connections: 1000
2013-07-10 11:49:00 [5412] [DEBUG] post_fork: <function post_fork at 0x2443230>
2013-07-10 11:49:00 [5412] [DEBUG] pythonpath: None
2013-07-10 11:49:00 [5412] [DEBUG] enable_stdio_inheritance: False
2013-07-10 11:49:00 [5412] [DEBUG] worker_class: sync
2013-07-10 11:49:00 [5412] [DEBUG] accesslog: None
@theflow
theflow / bundle_env.md
Last active May 11, 2018 10:59
Bundler unwanted downgrades

Environment

Bundler       1.16.1
  Platforms   ruby, x86_64-darwin-17
Ruby          2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
  Full Path   /Users/flo/.rbenv/versions/2.4.3/bin/ruby
  Config Dir  /Users/flo/.rbenv/versions/2.4.3/etc
RubyGems      2.6.14
 Gem Home /Users/flo/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0