Skip to content

Instantly share code, notes, and snippets.

View beezly's full-sized avatar

Andrew Beresford beezly

View GitHub Profile
beezly / checkciphers.rb
Created January 29, 2014 15:30
Find out which SSL cipher types clients are trying to negotiate using a traffic sniffer. Use with tshark something like this: tshark -l -i eth0 -R 'ssl.handshake.ciphersuites' -T fields -e ssl.handshake.ciphersuite 443 | ruby check-ciphers.rb TLS_RSA_WITH_AES_256_CBC_SHA TLS_DHE_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_RSA_…
supported_ciphers = []
known_ciphers = {
0x000000 => "TLS_NULL_WITH_NULL_NULL",
0x000001 => "TLS_RSA_WITH_NULL_MD5",
0x000002 => "TLS_RSA_WITH_NULL_SHA",
0x000003 => "TLS_RSA_EXPORT_WITH_RC4_40_MD5",
0x000004 => "TLS_RSA_WITH_RC4_128_MD5",
0x000005 => "TLS_RSA_WITH_RC4_128_SHA",
0x000006 => "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5",
beezly / gist:8933012
Created February 11, 2014 11:11
Stuck thread in MOLE
"TP-Processor1: userId=_41473_1, sessionId=BC36FD8E8DDBE2F6CA6940DA6E68F035" daemon prio=3 tid=0x000000010be74000 nid=0x142 runnable [0xffffffff2bdb5000]
java.lang.Thread.State: RUNNABLE
at blackboard.platform.intl.resource.BbProperties.loadConvert(
at blackboard.platform.intl.resource.BbProperties.load0(
at blackboard.platform.intl.resource.BbProperties.load(
- locked <0x00000006b0597018> (a blackboard.platform.intl.resource.BbProperties)
at blackboard.platform.intl.resource.BbPropertyResourceBundle.addBundle(
at blackboard.platform.intl.BundleManagerImpl$
at Method)
at blackboard.platform.intl.BundleManagerImpl.loadBundleFromFile(
beezly / gist:9186841
Last active August 29, 2015 13:56
Update or set a parameter in querystring found inside an element attribute (useful for changing the parameters to an <img src="blah?foo=true"> attribute)
setQueryStringParameter = (element, elementAttr, paramName, paramValue) ->
src=element.attr elementAttr
splitSrc=src.split '?'
qs.split('&').forEach (attribute) ->
console.log qsObject
beezly / ping-email.rb
Created March 20, 2014 15:25
Send me an email when a machine becomes pingable
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ping'
require 'net/smtp'
from_name="Pingy Test Thingy"
beezly / zxtm-perf-graphite.rb
Created April 2, 2014 22:55
Collecting ZXTM performance data and passing it to graphite
#!/usr/bin/env ruby
require "rubygems"
require "active_support/inflector"
require "snmp"
require 'graphite-api'
require 'graphite-api/core_ext/numeric'
require 'logger'
require "pp"
NODE_STATE = [ :undefined, :alive, :dead, :unknown, :draining ]
beezly / gist:10022653
Last active August 29, 2015 13:58
Submit jobs via a web interface to a DRMAA compatible scheduler
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'sinatra'
require 'drmaa'
require 'cod'
require 'logger'
require 'rpam'
require 'json'
require 'pp'
beezly / gist:84c6300982d9ec0cf53d
Last active August 29, 2015 14:15
Create Calendar Events when I get parking receipt messages. Depends on receiving an email in the right format from the parking payment provider.
function processParkingMessages() {
// get all unread messages labelled as Parking
var parkingThreads = GmailApp.getUserLabelByName('Parking').getThreads();
var parkingThreadMessages = { return thread.getMessages(); });
var parkingMessages = [];
var parkingMessages = parkingMessages.concat.apply(parkingMessages, parkingThreadMessages);
var unreadParkingMessages = parkingMessages.filter(function(message) { return message.isUnread(); });
// Map through all the unread parking messages and search for a date/time in the appropriate format.
beezly / disksnmp.rb
Created October 23, 2011 19:08
nagios plugin to read free disk space in ruby using snmp
require 'rubygems'
require 'nagios-probe'
require 'snmp'
require 'optparse'
class NagiosDiskCheck < Nagios::Probe
attr_reader :perfdata
def initialize(opts = {})
beezly / gist:1595352
Created January 11, 2012 16:02
class Player
@@health = 0
@@direction = :forward
@@mode = :attack
def taking_damage(warrior)
@@health >
def next_thingy(spaces)
beezly / list-ownership.rb
Created January 17, 2012 16:19
List editors of shared documents
require 'rubygems'
require 'gdata'
LOGIN_PASSWORD = "administratorpassword"
# Login and use version 3 of the api (only v3 allows admin access to files)
client =