Skip to content

Instantly share code, notes, and snippets.

@SonOfLilit
SonOfLilit / bf.py
Created June 26, 2017 22:56
Live coded during my "Virtual Machines and Brainfuck" talk at PyConIL 2017
import sys
def parse_parens(code):
result = {}
stack = []
for i, c in enumerate(code):
if c == '[':
stack.append(i)
elif c == ']':
match = stack.pop()
@SonOfLilit
SonOfLilit / gcgid2unicode.csv
Created July 15, 2016 20:17
Extract a gcgid2unicode conversion table from IBM's cdctables.zip
AA010000 0625
AA010002 FE88
AA010006 F8FB
AA010009 0627
AA020000 0649
AA020002 FEF0
AA020009 0649
AA050000 064E
AA050004 FE77
AA050009 064E
Aur Saraf (aur@feezback.com)
All Gists
SonOfLilit
Edit
Delete
Star0
SonOfLilit / choose
# a beginning of a song, using my work-in-progress midi API `melody` at https://github.com/SonOfLilit/melody
from music import *
def walk(duration, scale, bassline):
result = []
for i in xrange(len(bassline) - 1):
n = dict(bassline[i])
result.append(n)
if n['pitch'] == play.EMPTY:
@SonOfLilit
SonOfLilit / cal.py
Created November 5, 2014 01:55
Make an .ics out of events in a weird Excel file (pre-converted to .csv)
import csv
from icalendar import Calendar, Event
from datetime import datetime, timedelta
from icalendar import LocalTimezone
HOUR = 60*60
start_hour = timedelta(0, 17*HOUR)
day_duration = timedelta(0, 4*HOUR)
r = csv.reader(open('e:\\temp\\luz.csv', 'rb'))
++2008+07+10
+ +
+ Aur Saraf
+ 200031177
+[050<2422820
+Neve+America 83+2+6
+Technion Haifa 32000
>
@SonOfLilit
SonOfLilit / riveted.js.patch
Created June 5, 2014 00:42
Basic hysteresis for riveted.js
commit 0fe549297387bf971f96154d9339ed7ee478a029
Author: Aur Saraf <sonoflilit@gmail.com>
Date: Thu Jun 5 03:18:14 2014 +0300
google analytics activity tracking
diff --git a/v3/js/riveted.js b/v3/js/riveted.js
index 5d8bf9e..b337113 100644
--- a/v3/js/riveted.js
+++ b/v3/js/riveted.js
"""
$ python event_test.py
Traceback (most recent call last):
File "event_test.py", line 14, in <module>
assert value
AssertionError
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
"""
from threading import Thread, Event
.table-container th.asc:after {
content: '\0000a0\0025b2';
}
.table-container th.desc:after {
content: '\0000a0\0025bc';
}
.pagination {
text-align: center;
}