Skip to content

Instantly share code, notes, and snippets.


Matt Gorecki mattgorecki

View GitHub Profile
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 = '' % (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)
mattgorecki /
Created Jul 21, 2011
Detecting faces with SimpleCV
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 /
Created Nov 18, 2011
Sending an event to a node.js server from Python.
import websocket
import thread
import time
import sys
from urllib import *
class SocketIO:
def __init__(self):
self.PORT = 5000
self.HOSTNAME = ''
mattgorecki /
Created Apr 16, 2012
Random, readable password generator for building initial passwords during signup
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 / 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 = => 162, :Community => 'snmpcommunity') do |manager|
puts "trapd.rb started..."
manager.on_trap_default do |trap|
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
import serial
import re, sys, signal, os, time, datetime
import RPi.GPIO as GPIO
BITRATE = 9600
GPIO.setup(7, GPIO.OUT)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)

Keybase proof

I hereby claim:

  • I am mattgorecki on github.
  • I am abledanger ( on keybase.
  • I have a public key ASBQpN5WxiNBYmdRY-TEBfCy860Q-tp8tirCNsl8sdBejAo

To claim this, I am signing this object: