Skip to content

Instantly share code, notes, and snippets.

Matt Gorecki mattgorecki

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am mattgorecki on github.
  • I am abledanger (https://keybase.io/abledanger) on keybase.
  • I have a public key ASBQpN5WxiNBYmdRY-TEBfCy860Q-tp8tirCNsl8sdBejAo

To claim this, I am signing this object:

@mattgorecki
mattgorecki / RaspberryPi-RFID
Created Jul 26, 2013
Python script to read RFID card from serial RFID reader attached to a Raspberry Pi. Also has a Exit button. The card swipe releases the maglock on the door.
View RaspberryPi-RFID
#!/usr/bin/python2
import serial
import re, sys, signal, os, time, datetime
import RPi.GPIO as GPIO
BITRATE = 9600
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
@mattgorecki
mattgorecki / trapd.rb
Created Jun 7, 2012
Simple SNMP Trap receiver that dumps to a RabbitMQ queue
View trapd.rb
require 'rubygems'
require 'snmp'
require 'carrot'
require 'json'
q = Carrot.queue('traps', :durable => true)
m = SNMP::TrapListener.new(:Port => 162, :Community => 'snmpcommunity') do |manager|
puts "trapd.rb started..."
manager.on_trap_default do |trap|
@mattgorecki
mattgorecki / gen_pass.py
Created Apr 16, 2012
Random, readable password generator for building initial passwords during signup
View gen_pass.py
import string
import itertools
import random
def gen_pass():
initial_consonants = (set(string.ascii_lowercase) - set('aeiou')
# remove those easily confused with others
- set('qxc')
# add some crunchy clusters
| set(['bl', 'br', 'cl', 'cr', 'dr', 'fl',
@mattgorecki
mattgorecki / socketio.py
Created Nov 18, 2011
Sending an event to a node.js socket.io server from Python.
View socketio.py
import websocket
import thread
import time
import sys
from urllib import *
class SocketIO:
def __init__(self):
self.PORT = 5000
self.HOSTNAME = '127.0.0.1'
@mattgorecki
mattgorecki / facedetect.py
Created Jul 21, 2011
Detecting faces with SimpleCV
View facedetect.py
#!/usr/bin/python
import SimpleCV
import time
import simplejson as json
import sys
if __name__ == "__main__":
captureDir = '/opt/display/applications/tldisplayclient/static'
ofilename = '%s/webcam-original.png' % captureDir
dfilename = '%s/webcam-detected.png' % captureDir
@mattgorecki
mattgorecki / gist:974920
Created May 16, 2011
web2py mobile browser detection
View gist:974920
# Detect mobile device. Set to mobile view if available
from mobile.sniffer.detect import detect_mobile_browser
if detect_mobile_browser(request.env.http_user_agent):
mobile_view = '%s.mobile.%s' % (request.function, request.extension)
if os.path.exists(os.path.join(request.folder, 'views',request.controller, mobile_view)):
response.view = '%s/%s' % (request.controller, mobile_view)
You can’t perform that action at this time.