Skip to content

Instantly share code, notes, and snippets.

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

Jonathan Lassoff jof

🐈‍⬛
Surviving
View GitHub Profile
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
#!/usr/bin/ruby
puts "Hello, world!"
@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);
+
/*
@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 / 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 / parport_daemon.c
Created November 13, 2011 05:34
Parallel Port Daemon
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <strings.h>
#include <string.h>
#include <time.h>
#include <linux/ppdev.h>
#include <sys/ioctl.h>
@jof
jof / doorduino.c
Created November 28, 2011 01:21
Arduino Door Opener
#include <errno.h>
#include <stdio.h>
#include <string.h>
// Ardunio-specific headers
#include <Ethernet.h>
#include <Udp.h>
#include <SPI.h>
#include <stdarg.h>
class File
def join_from_root(*args)
# Stringify objects.
args.map! { |a| a.to_s }
return self.join(SEPARATOR, *args)
end
end
@jof
jof / bssid_hunter.rb
Created August 30, 2012 22:13
"Loudest APs" Kismet Client
#!/usr/bin/env ruby
load '/Users/jof/src/kismet/ruby/kismet.rb'
require 'time'
require 'rubygems'
require 'pry'
require 'awesome_print'
require 'yaml'
CLEAR_SCREEN = "\e[2J"
@jof
jof / provision_debian_chroot.sh
Last active December 16, 2015 06:38
Userland Debian chroot
#!/bin/bash
debian_release=squeeze
rhel_major=6
epel_release_rpm="epel-release-6-8.noarch.rpm"
chroot=/debian
mkdir -p $chroot
_machine=`uname -m`