Skip to content

Instantly share code, notes, and snippets.

rogercloud / chantest.nim
Created Sep 1, 2015
Warning: use global iterator here is not a good practice.
View chantest.nim
import os, threadpool, macros
template spawnBackgroundJob(t: typedesc, chan:ptr TChannel[t], iter: expr): stmt {.immediate.}=
proc threadFunc(channel: ptr TChannel[t]) {.thread.} =
echo "Thread is starting"
for i in iter:
echo "Sending ", i
rogercloud / gist:8160201
Created Dec 28, 2013
bittorrent download
View gist:8160201
import libtorrent as lt
import time
import sys
ses = lt.session()
ses.listen_on(6881, 6891)
info = lt.torrent_info(sys.argv[1])
h = ses.add_torrent({'ti': info, 'save_path': './'})
print 'starting',