Skip to content

Instantly share code, notes, and snippets.

@mrmekon
mrmekon / pgp_key_extract.py
Created November 8, 2011 15:40
PGP Key Extractor -- A (partial) Python implementation of OpenPGP
#!/usr/bin/env python2.7
#
# PGP Key Extractor -- A (partial) Python implementation of OpenPGP
#
# Copyright 2011 Trevor Bentley
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@mrmekon
mrmekon / ttsxtest.py
Created December 8, 2011 17:13
PyTTSX problem with GTK and threading
import threading
import pyttsx
import objc
from Foundation import *
from PyObjCTools import AppHelper
import gobject
shouldUseThreads = True
if shouldUseThreads:
@mrmekon
mrmekon / mptest.py
Created December 8, 2011 20:24
Python multiprocessing fails with PyObjC
import multiprocessing
import objc
from Foundation import *
class Test:
def __init__(self):
self.proc = multiprocessing.Process(target=self.run)
def start(self):
self.proc.start()
def run(self):
@mrmekon
mrmekon / Makefile
Created January 16, 2012 23:04
MSP430 capacitive touch sensor with ADC and capacitor
all: default run
default:
msp430-gcc -I/usr/local/msp430-gcc-4.4.3/msp430/include/ captouch.c -save-temps -mendup-at=main -mmcu=msp430x2111 -Os
run:
mspdebug rf2500 "prog a.out"
dump:
mspdebug rf2500 "md 0x1000 256"
@mrmekon
mrmekon / Makefile
Created January 16, 2012 23:05
MSP430 circuit to measure and trick 1997 Jetta LD Pump
all: default run
default:
msp430-gcc -I/usr/local/msp430-gcc-4.4.3//msp430/include/ ldpump_tester.c -save-temps -mendup-at=main -mmcu=msp430x2111 -Os
run:
mspdebug rf2500 "prog a.out"
dump:
mspdebug rf2500 "md 0x1000 256"
@mrmekon
mrmekon / Makefile
Created January 17, 2012 18:40
Capacitive touch sensor via ADC (no external components)
all: default run
default:
msp430-gcc -I/usr/local/msp430-gcc-4.4.3/msp430/include/ captouch.c -save-temps -mendup-at=main -mmcu=msp430x2111 -Os
run:
mspdebug rf2500 "prog a.out"
dump:
mspdebug rf2500 "md 0x1000 256"
@mrmekon
mrmekon / cancelMessages.clj
Created January 30, 2012 15:19
Cancel all ISS messages in queue
(ns com.trevorbentley.cancelMessages
(:require [http.async.client :as client]
[cheshire.core :as cheshire]))
(def host (if (> (count *command-line-args*) 0)
(first *command-line-args*)
"localhost"))
(def cancelUrl (str "http://" host ":9090/cancelMessage"))
(def activeUrl (str "http://" host ":9090/activeMessages"))
@mrmekon
mrmekon / depthdev.py
Created February 10, 2012 21:23
Embedly application puzzle
import urllib2
from xml.etree.ElementTree import XMLParser
import numpy
class DepthCounter:
depthdict = {}
def __init__(self):
self.classdepth = 0
self.depth = 0
self.depthdict = {}
@mrmekon
mrmekon / whitening.py
Created February 16, 2012 18:55
Data whitening (scrambling) with 9-bit LFSR
import sys
import os
import numpy
import random
import string
import matplotlib.pyplot as plt
#data = numpy.random.bytes(10000000)
data = [random.choice(string.printable) for x in xrange(1000000)]
#data = numpy.random.bytes(100)
@mrmekon
mrmekon / analyze.py
Created May 5, 2012 01:35
Markov Chain Employee Performance Review Generator
#!/usr/bin/env python
import string
import random
import sys
import pickle
f = open("employee_review_corpus.txt", "r")
contents = f.read()
f.close()