Skip to content

Instantly share code, notes, and snippets.

View lisa's full-sized avatar

Lisa Seelye lisa

View GitHub Profile
@lisa
lisa / test1.v
Created May 6, 2011 00:53
8 bit counter.
module test1(
output reg [7:0] led,
input button);
reg [7:0] cnt;
always @(posedge button) begin
cnt = cnt + 1;
led = cnt;
end
@lisa
lisa / hacklab_door_tweeter.rb
Created April 24, 2011 17:23
Hacklab Toronto doorbot tweet script.
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'oauth'
require 'mq'
require 'rexml/document'
require 'syslog'
include REXML
@lisa
lisa / Splunk postfix Goodness
Created January 26, 2011 18:19
Splunk extractions
Field extractions:
* postfix_queue_id - postfix/[a-z]{1,6}\[\d+\]: (?P<postfix_queue_id>[A-Z0-9]{8,}):
* postfix_forward_queue_id - postfix/local\[\d+\]:.*\(forwarded as
(?P<postfix_forward_queue_id>.*)\)
* postfix_handoff_queue_id - postfix/smtp\[\d+\].*Ok: queued as
(?P<postfix_handoff_queue_id>.*)\)
Amavis:
* amavis_queue_id - amavis\[\d+\].*queued_as: (?P<amavis_queue_id>[A-Z0-9]{11,}),
Nov 26 11:22:14 accolon postfix/smtpd[6546]: connect from titanium.thedoh.com[66.207.205.162]
Nov 26 11:22:14 accolon postfix/smtpd[6546]: 9044C7F29AF: client=titanium.thedoh.com[66.207.205.162]
Nov 26 11:22:14 accolon postfix/cleanup[9806]: 9044C7F29AF: message-id=<64696.company.public.gw.ip.1290788534.squirrel@thedoh.com>
Nov 26 11:22:14 accolon postfix/qmgr[28320]: 9044C7F29AF: from=<lisa@thedoh.com>, size=956, nrcpt=1 (queue active)
Nov 26 11:22:14 accolon postfix/smtpd[6546]: disconnect from titanium.thedoh.com[66.207.205.162]
Nov 26 11:22:15 accolon postfix/smtpd[9810]: connect from accolon[127.0.0.1]
Nov 26 11:22:15 accolon postfix/smtpd[9810]: 27B0D7F29B0: client=accolon[127.0.0.1]
Nov 26 11:22:15 accolon postfix/cleanup[9806]: 27B0D7F29B0: message-id=<64696.company.public.gw.ip.1290788534.squirrel@thedoh.com>
Nov 26 11:22:15 accolon postfix/qmgr[28320]: 27B0D7F29B0: from=<lisa@thedoh.com>, size=1442, nrcpt=1 (queue active)
Nov 26 11:22:15 accolon postfix/smtpd[9810]: disconnect from accolon[127.0.0.1
## Just for an example. :)
# Licensed under MIT license, (c) 2008 Lisa Seelye
require 'thread'
class ThreadPool
attr_reader :max_size
def initialize(max_size)
@pool = []
@max_size = max_size
12:58:35.713461 IP (tos 0x0, ttl 64, id 39789, offset 0, flags [DF], proto TCP (6), length 182) titanium.60904 > 87.237.39.199.http: P, cksum 0x90ce (incorrect (-> 0x9a0e), 1:143(142) ack 1 win 5840
0x0000: 4500 00b6 9b6d 4000 4006 0eaf 42cf cda2 E....m@.@...B...
0x0010: 57ed 27c7 ede8 0050 6515 5185 890c caf7 W.'....Pe.Q.....
0x0020: 5018 16d0 90ce 0000 4745 5420 2f53 6572 P.......GET./Ser
0x0030: 7665 722f 5365 7276 6572 5374 6174 7573 ver/ServerStatus
0x0040: 2e78 6d6c 2e61 7370 7820 4854 5450 2f31 .xml.aspx.HTTP/1
0x0050: 2e31 0d0a 4163 6365 7074 3a20 2a2f 2a0d .1..Accept:.*/*.
0x0060: 0a55 7365 722d 4167 656e 743a 2052 6576 .User-Agent:.Rev
0x0070: 6520 7630 2e30 2e31 3331 0a3b 2068 7474 e.v0.0.131.;.htt
0x0080: 703a 2f2f 6769 7468 7562 2e63 6f6d 2f6c p://github.com/l
# COALESCE to force NULLs to a recognisable string.
# when 'method' - if it's this method impose conditions
# if it's '(none)' (aka NULL) - this user has no EveApiCache entries, so select them
# else this user has a non-#{method} EveApiCache so select them
def users_to_work_on(method)
User.find(:all,
:select => "users.id, COALESCE(eac.method_name, '(none)'), MAX(eac.expires_at), users.api_key, users.api_userid",
:joins => "LEFT OUTER JOIN eve_api_caches eac ON users.id = eac.user_id",
:conditions => "(users.api_key IS NOT NULL AND users.api_userid IS NOT NULL)",
:order => "RANDOM()",
$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
$GPTXT,01,01,02,HW UBX-G5xxx 00040005 FFF9FFFFp*14
$GPTXT,01,01,02,ROM CORE 5$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
$GPTXT,01,01,02,HW UBX-G5xxx 00040005 FFF9FFFFp*14
$GPTXT,01,01,02,ROM CORE 5.00 (28483) Jun 6 2008 14:45:11*40
$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20
$Gð$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
$GPTXT,01,01,02,HW UBX-G5xxx 00040005 FFF9FFFFp*14
$GPTXT,01,01,02,ROM CORE 5.00 (28483) Jun 6 2008 14:45:11*40
$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20
#include <Wire.h>
#define MAX_I2C_RETRIES 100
#define RANDOM_COLOUR (byte)random(1,8)
#define RANDOM_BOARD (byte)random(0,5)
#define RANDOM_LED (byte)random(0,10)
#define RANDOM_PROGRAM (byte)random(0,5)
#define RANDOM_RUNS (int)random(10,50)
#define RANDOM_RUN_DELAY (int)random(250,1000) //250ms to 1s
/* Very first rough draft of some basic structs for the Beacon2 project */
struct layer {
byte i2c_addr; /* i2c bus address */
struct led leds[10]; /* all LEDs on this board */
};
struct led {
byte r_pin_addr; /* Layer-local pin address */
byte g_pin_addr; /* Layer-local pin address */