Skip to content

Instantly share code, notes, and snippets.

@haniawni
Last active August 5, 2016 18:44
Show Gist options
  • Save haniawni/e70c66ecd5065ed4b6fcdbefeecf5e5f to your computer and use it in GitHub Desktop.
Save haniawni/e70c66ecd5065ed4b6fcdbefeecf5e5f to your computer and use it in GitHub Desktop.
pys = require('python-shell');
sl = require('sleep');
var s = new pys('testStdIn.py');
s.on('message',function(message){
console.log('stdOut: '+ message);
});
s.on('error',function(message){
console.log('stdErr: '+ message);
});
while(true){
str = (Math.random()*10).toString()+' lol';
console.log('Sending: '+str)
s.send(str);
sl.sleep(1);
}
var spawn = require('child_process').spawn,
sl = require('sleep');
s = spawn('python',['testStdIn.py']);
s.on('data',function(message){
console.log('stdOut: '+ message);
});
while(true){
str = (Math.random()*10).toString()+' lol';
console.log('Sending: '+str)
s.stdin.write(str);
sl.sleep(1);
}
from __future__ import print_function
import sys
import time
from datetime import datetime
import thread
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def spamSTDErr():
while(True):
eprint('e: '+str(datetime.now()))
time.sleep(2)
thread.start_new_thread(spamSTDErr,())
while(True):
s = raw_input()
print('o: '+s + " GONNA GIVE IT TO YA")
from __future__ import print_function
import sys
import time
from datetime import datetime
import thread
from pylsl import StreamInfo, StreamOutlet
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def spamSTDErr():
while(True):
eprint('e: '+str(datetime.now()))
time.sleep(2)
info = StreamInfo('Handoff', 'Test', 1, 0, 'string', '8265817653173')
lslo = StreamOutlet(info)
thread.start_new_thread(spamSTDErr,())
while(True):
s = raw_input()
lslo.push_sample(s)
print('o: '+s + " GONNA GIVE IT TO YA")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment