Skip to content

Instantly share code, notes, and snippets.

View jof's full-sized avatar
🐈‍⬛
Surviving

Jonathan Lassoff jof

🐈‍⬛
Surviving
View GitHub Profile
@jof
jof / gist:1329203
Created October 31, 2011 22:14
TACACS Accounting FIlter
#!/usr/local/bin/ruby
## TACACS accounting logging helper.
#
# Filter a stream of events for a condition.
#
require 'getoptlong'
TAC_PLUS_ACCOUNTING_LOG_PATTERN = Regexp.new('(\d{1,3}\.){3}\d{1,3}(\t+)\w+(\t+)\w+\d(\t+)(\d{1,3}\.){3}\d{1,3}(\t+)(start|stop)')
@jof
jof / gist:1281122
Created October 12, 2011 12:37
Cisco CDPviaSNMP-to-Graphviz Creator
#!/usr/bin/env ruby
require 'getoptlong'
require 'rubygems'
require 'snmp'
SNMP_COMMUNITY = 'public'
HOSTNAME_BLACKLIST = [ "that_one_switch_thats_down_but_in_dns" ]
ZONE_FILE = /path/to/dns/zone/file
HOSTNAME_REGEX = /^\s?(switch[0-9]+)/i
@jof
jof / request_start_variable.patch
Created July 20, 2011 17:20 — forked from rkbodenner/request_start_variable.patch
Add a 'start_time' variable to nginx 0.7.67 to support an X-REQUEST-START header. This header is used by New Relic RPM to record queue time.
--- src/http/ngx_http_variables.c.orig 2011-07-20 17:28:36.000000000 +0000
+++ src/http/ngx_http_variables.c 2011-07-20 17:28:38.000000000 +0000
@@ -93,6 +93,9 @@
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+
/*
#!/usr/bin/ruby
puts "Hello, world!"
jof@think:~$ ruby -e "require 'rubygems';require 'serialport'"
(eval):1: (eval):1:in `private_class_method': undefined method `create' for class `Class' (NameError)
from (eval):1
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from -e:1
jof@think:~$ ruby -e 'require "reubygems";require "serialport"'
-e:1:in `require': no such file to load -- reubygems (LoadError)
from -e:1