Skip to content

Instantly share code, notes, and snippets.

View chrissnell's full-sized avatar

Chris Snell chrissnell

View GitHub Profile
class FramePacket(Structure):
_fields_ = [ ('header', c_uint8), ('proto_version', c_uint8), ('display_width', c_uint8), ('display_height', c_uint8), \
('retain_delay', c_uint8), ('RESERVED_SPACE', c_uint8 * 24) ]
class AssembledFramePacket(object):
def __init__(self,frame):
self._frame = frame
#include <stdlib.h> // card > cjs.ppm
#include <stdio.h>
#include <math.h>
typedef int i;typedef float f;struct v{
f x,y,z;v operator+(v r){return v(x+r.x
,y+r.y,z+r.z);}v operator*(f r){return
v(x*r,y*r,z*r);}f operator%(v r){return
x*r.x+y*r.y+z*r.z;}v(){}v operator^(v r
){return v(y*r.z-z*r.y,z*r.x-x*r.z,x*r.
y-y*r.x);}v(f a,f b,f c){x=a;y=b;z=c;}v
try:
zones = conn.list_zones()
except:
print "none found"
#include <stdlib.h> // card > cis,ppm
#include <stdio.h>
#include <math.h>
typedef int i;typedef float f;struct v{
f x,y,z;v operator+(v r){return v(x+r.x
,y+r.y,z+r.z);}v operator*(f r){return
v(x*r,y*r,z*r);}f operator%(v r){return
x*r.x+y*r.y+z*r.z;}v(){}v operator^(v r
){return v(y*r.z-z*r.y,z*r.x-x*r.z,x*r.
@chrissnell
chrissnell / gist:8484258
Created January 18, 2014 00:26
Simple syslog sender Running it gives this error: # command-line-arguments ./gologit.go:11: undefined: LOG_INFO ./gologit.go:11: undefined: LOG_LOCAL6
package main
import (
"log"
"log/syslog"
)
func main() {
msg := "Testing my non-existant Go Language skillz"
package main
import (
"os"
"io"
"bufio"
"flag"
"log"
"log/syslog"
)
package main
import (
"encoding/json"
"fmt"
)
/*
JSON looks like this:
@chrissnell
chrissnell / gist:40b9c4dd8d6f0b101099
Last active August 29, 2015 14:01
Revinate Cloud Instance Provisioning
##
## Revinate Cloud Instance Provisioning
## Chris Snell <chris.snell@revinate.com>
##
# We only run this block if the file /etc/firstboot exists
if [ -f /etc/firstboot ]; then
# These are the URLs for the EC2-compatible metadata service running in our cloud
HOSTNAME_METADATA="http://169.254.169.254/2009-04-04/meta-data/hostname"
sudo tcpdump -Xi wlan2 port 14580
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan2, link-type EN10MB (Ethernet), capture size 65535 bytes
11:29:03.142268 IP utila.island.nu.32949 > aprs.nh6z.net.14580: Flags [S], seq 3333231990, win 14600, options [mss 1460,sackOK,TS val 127420093 ecr 0,nop,wscale 3], length 0
0x0000: 4500 003c 53cb 4000 4006 8d8f 0a32 0019 E..<S.@.@....2..
0x0010: c6b2 8864 80b5 38f4 c6ad 1576 0000 0000 ...d..8....v....
0x0020: a002 3908 5990 0000 0204 05b4 0402 080a ..9.Y...........
0x0030: 0798 46bd 0000 0000 0103 0303 ..F.........
11:29:03.176173 IP aprs.nh6z.net.14580 > utila.island.nu.32949: Flags [S.], seq 196851892, ack 3333231991, win 14480, options [mss 1460,sackOK,TS val 939309337 ecr 127420093,nop,wscale 3], length 0
0x0000: 4520 003c 0000 4000 3506 ec3a c6b2 8864 E..<..@.5..:...d
2014-06-09 18:23:27.481 NW5W-1 R KD0SOR-7>TW4WPQ,JUPITR*,WIDE1*,WIDE2-1:`2)^]lh7>/`"49}_
2014-06-09 18:23:51.271 APRSIS R NW5W-10>APRS,TCPIP*,qAC,T2CMH:@091824z4715.66N/12228.20W_048/001g003t064r000p000P000b10210h63 http://fifestreet.com weewx-VantagePro
2014-06-09 18:23:57.391 NW5W-1 T NW5W-1>APRX28,WIDE2-2:!4715.68N/12228.20W-aprx iGate http://nw5w.com
2014-06-09 18:24:51.482 APRSIS R NW5W-10>APRS,TCPIP*,qAC,T2QUEBEC:@091825z4715.66N/12228.20W_359/002g003t064r000p000P000b10209h65 http://fifestreet.com weewx-VantagePro
2014-06-09 18:25:08.711 NW5W-1 R K7FRC>T7RYRX,W7PFR-1*,WIDE1*,WIDE2-1:`2.^\l#4>/'"53}|"6%X'k|!wSm!|3
2014-06-09 18:25:27.613 NW5W-1 R WW7RA>APRS,BALDI*,WIDE2-1:!4732.88N/12248.45W_>WW7RA Digi & Remote Wx Sta
2014-06-09 18:25:28.514 NW5W-1 R BALDI>APRX27:!4713.13NI12150.61W&PHG7830/W2,WAn-N,Baldi Mtn N7FSP
2014-06-09 18:25:43.427 NW5W-1 R TWOODS>APOT21,SOMTN*,WIDE1*,JUPITR*,WIDE2-1:!4645.38N/12207.08W#KD7ISZ
2014-06-09 18:25:51.180 APRSIS R NW5W-10>APRS,TCPIP*,qAC,T2T