Skip to content

Instantly share code, notes, and snippets.

💭
Life cannot just be about solving one sad problem after another.

Norman E. NormanEdance

💭
Life cannot just be about solving one sad problem after another.
Block or report user

Report or block NormanEdance

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NormanEdance
NormanEdance / subprocess_filter.py
Created Feb 12, 2018 — forked from DGrady/subprocess_filter.py
Stream data asynchronously through a subprocess in Python
View subprocess_filter.py
"""
Problem: provide two-way communication with a subprocess in Python.
See also:
- https://kevinmccarthy.org/2016/07/25/streaming-subprocess-stdin-and-stdout-with-asyncio-in-python/
- http://eli.thegreenplace.net/2017/interacting-with-a-long-running-child-process-in-python/
"""
import asyncio
import sys
@NormanEdance
NormanEdance / cubism-websockets.html
Created Feb 20, 2018 — forked from cuadue/cubism-websockets.html
Streaming data to cubism.js with websockets
View cubism-websockets.html
<!DOCTYPE html>
<meta charset='utf-8'>
<head>
<title>Cubism + Websockets</title>
<script language='javascript' src='d3.min.js'></script>
<script language='javascript' src='cubism.v1.js'></script>
<script language='javascript'>
/* I can never seem to remember:
Array.push() appends to the end, and returns the new length
@NormanEdance
NormanEdance / asyncio_shutdown_loop.py
Created Mar 13, 2018 — forked from nvgoldin/asyncio_shutdown_loop.py
Python 3.5 asyncio - shutdown all tasks safely using signal handler
View asyncio_shutdown_loop.py
import signal
import functools
async def looping_task(loop, task_num):
try:
while True:
print('{0}:in looping_task'.format(task_num))
await asyncio.sleep(5.0, loop=loop)
except asyncio.CancelledError:
return "{0}: I was cancelled!".format(task_num)
You can’t perform that action at this time.