Skip to content

Instantly share code, notes, and snippets.

@timo
timo / poll_perl6_vms
Last active August 29, 2015 13:58 — forked from sergot/poll_perl6_vms
Hey!
This is a poll about VMs for Perl 6. It would be awesome if you fill it,
just write a comment with your answers.
I need it because I work on a huge summary (including, among the others, statistics, tests)
of VMs and Perl 6 itself.
Thank you very much in advance!
sergot
@timo
timo / gist:11154880
Created April 21, 2014 20:09
simple example for supplies with intervals.
perl6-m -e 'Supply.merge(Supply.interval(2).map({ "tick" }), Supply.interval(2, 1).map({ "tock" })).tap(&say); sleep 10;'
tick
tock
tick
tock
tick
tock
tick
tock
tick
@timo
timo / post-commit
Last active August 29, 2015 14:15 — forked from kindfulkirby/post-commit
#!/usr/bin/env python3.2
import subprocess, re
matchers = {
'../scripts/public-add': re.compile('[AM]\tpublic/[\w.]'),
'../scripts/public-del': re.compile('D\tpublic/[\w.]'),
}
for line in subprocess.check_output(["git", "show", "--name-status"]).decode().split('\n')[4:-1]:
@timo
timo / gist:0b64637e8b7bda922bea
Created August 15, 2015 01:40
on the glr branch of rakudo, this "use trace" causes the .say to not happen .. or something.
# remove this to get an output from this again.
use trace;
do {
# putting a "use trace" into this block will
# give a trace as well as the expected results
#use trace;
.say for <hello how are you>;
sm = Selmaho()
sm.selmaho = smt
sm.multi = 1
session.save(sm)
print session.query(Selmaho).count()
def query(self, query=None, type=None, valsi=[], gloss=None,
rafsi=[], selmaho=None, definition=None, notes=None,
regexp=False, like=None):
results = []
if query:
args = {"gloss": gloss, "valsi": valsi, "rafsi": rafsi,
"selmaho": selmaho, "definition": definition, "notes": notes,
"regexp": regexp, "type": type}
listargs = ["valsi", "rafsi"]
@timo
timo / Dancer.rb
Created June 12, 2009 10:30 — forked from tene/Dancer.rb
class Dancer
def description()
"is like a beautiful swan, gracefully flying over a lake"
end
def steps()
"⚡→→→→↓↓↓↓←↓→↓←↑↑↑↑→↓←↑Ϟ"
end
def dance()
puts self.WHAT
puts "My dance " + self.description
import threading
import time
import subprocess
# make the system preload the sound
subprocess.Popen(["mplayer", "/home/timo/.drama/drama.ogg", "-ao", "null"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def prebuffer_image(image):
open("/home/timo/Pictures/wallpapers/" + image, "r").read()
threading.Thread(target=prebuffer_image, args=("kittenface.jpg",)).start()
class City(Base):
__tablename__ = "city"
name = Column(Unicode(6), primary_key=True)
rooms = relationship("Room", backref="city")
def __repr__(self):
return u'<City "%s" with %d rooms>' % (self.name, len(self.rooms))
class Room(Base):
__tablename__ = "room"
@timo
timo / flymake.vim
Created April 5, 2011 22:08
python flymake ftplugin
if !exists('b:did_flymake')
let b:did_flymake = 1
autocmd BufWritePost <buffer>
\ call FlyMake('cd %s; export FN="%s"; pylint "$FN"; pep8 "$FN"; pyflakes "$FN"',
\ '[^:]*:\([0-9]*\):\%\(.*:\)? \(.*\)',
\ '.*:\([0-9]*\):\%\(.*:\)? \(.*\)')
autocmd BufWinLeave <buffer> call FlyMakeCloseWindows()
endif