Skip to content

Instantly share code, notes, and snippets.

View Debilski's full-sized avatar

Rike-Benjamin Schuppner Debilski

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function bash_env --description 'Imports named variables from a bash script'
# Usage:
# bash_env script.bash VAR1 VAR2 VARN
#
set -l script $argv[1]
while read i; set code "$code""$i"\n; end < $script
set -l variables
for arg in $argv[2..-1]
set variables $variables "echo \"set -g $arg \${$arg}\""\n
end
@Debilski
Debilski / actortest-py2.py
Last active December 12, 2015 02:59
Python (2/3) Actor test
import threading, Queue
Thread = threading.Thread
Empty = Queue.Empty
Queue = Queue.Queue
class Stop(Exception):
pass
class Actor(object):
def __init__(self):
import multiprocessing
import threading
import time
def f(i):
try:
print "starting f(%i)..." % i
time.sleep(i * 3 + 1)
print "stopping f(%i)..." % i
@Debilski
Debilski / gist:2839185
Created May 30, 2012 21:55
Pelita network spec

Pelita network messaging specification

Message format

A message is always sent as a JSON object. The following keys are allowed and denote different types of messages.

Request message