Skip to content

Instantly share code, notes, and snippets.

View Teemu's full-sized avatar

Teemu Teemu

View GitHub Profile
@Teemu
Teemu / non_deterministic_automata_convertor.py
Created April 4, 2016 12:36
Convert a nondeterministic finite state automaton to a deterministic finite state automaton
"""Convert a nondeterministic finite state automaton to a deterministic finite state automaton"""
from collections import OrderedDict
START = 'a'
STATES = {
'a': {
0: {'a'},
1: {'a', 'b'}
},
@Teemu
Teemu / reset_webcam
Created March 14, 2016 11:04
Take timelapse with Raspberry Pi and unstable webcam
#!/bin/sh
# https://gist.github.com/x2q/5124616#file-usbreset-c-L41
/usr/bin/usbreset /dev/bus/usb/001/002
@Teemu
Teemu / XX_turing_machine
Last active March 14, 2016 11:16
Turing machine that detects {ww | w contains {a,b}*}, try it at http://turingmachinesimulator.com/shared/gfemhnbiqs
name: ww
init: Start
accept: Success
Start,a,_
GoRight,a,X,>,>
Start,b,_
GoRight,b,X,>,>
Start,a,Y
2GoLeft,a,Y,<,<
@Teemu
Teemu / hack.sh
Last active August 29, 2015 14:26
Creating virtualenv with Python3 when everything fails
pip3 install virtualenv
python3.4 `which virtualenv` --python=`which python3.4` --no-site-packages env
mv env ~/.virtualenvs/