Skip to content

Instantly share code, notes, and snippets.

I'll be slow to respond - I operate a notification pull (not push) policy

Phil Elson pelson

I'll be slow to respond - I operate a notification pull (not push) policy
Block or report user

Report or block pelson

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
phizaz /
Last active Nov 8, 2019
Python turn sync functions to async (and async to sync)
import functools
def force_async(fn):
turns a sync function to async function using threads
from concurrent.futures import ThreadPoolExecutor
import asyncio
pool = ThreadPoolExecutor()
ericdill /
Last active Sep 16, 2019
Render the dependency graph for your conda environment (needs graphviz!)
import json
import glob
from os.path import join, basename
# install this with "conda install -c conda-forge python-graphviz"
import graphviz as gv
# path to your conda environment
path = '/tmp/foo'
dg = gv.Digraph(filename='env-%s' % basename(path), format='svg')
mrocklin /
Created Jul 11, 2016 — forked from jcrist/
Dask Execution Tracer
import os
from dask.callbacks import Callback
from import dot_graph
class Track(Callback):
def __init__(self, path='dasks'):
self.path = path
self.n = 0
jcrist /
Last active Dec 15, 2017
Dask Execution Tracer
import os
from dask.callbacks import Callback
from import dot_graph
class Track(Callback):
def __init__(self, path='dasks', save_every=1):
self.path = path
self.save_every = save_every
bastman /
Created Mar 31, 2016
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
HeinrichHartmann /
Created Dec 14, 2014
Raspbery Pi Analog Input with ADC0832
#!/usr/bin/env python
# Analog Input with ADC0832 chip
# Datasheet:
# Part of SunFounder LCD StarterKit
import time
psmay /
Created Dec 2, 2014
Notes on mass-importing SVG outlines into FontForge via Python

Notes on dumping SVG outlines into a FontForge file

Sources I've looked at:

I have a hunch that createMappedChar() doesn't work unless you've done loadNameList('glyphlist.txt') or loadNameList('aglfn.txt') (BSD-licensed Adobe glyph lists). An alternative seems to be to go by codepoint with createChar().

drgarcia1986 /
Last active Nov 7, 2019
Example of OAuth2 autentication server with Client Credentials grant (using python-oauth2 and tornado)
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Diego Garcia'
import tornado.web
import tornado.ioloop
import oauth2.tokengenerator
import oauth2.grant
ozh / xkcd.css
Created Mar 12, 2014
XKCD font
View xkcd.css
/* font from
* converted to web font in base64 with
@font-face {
font-family: 'xkcdregular';
lrhache /
Last active Nov 13, 2019
Python Selenium - Open new tab / focus tab / close tab

On a recent project, I ran into an issue with Python Selenium webdriver. There's no easy way to open a new tab, grab whatever you need and return to original window opener.

Here's a couple people who ran into the same complication:

So, after many minutes (read about an hour) of searching, I decided to do find a quick solution to this problem.

You can’t perform that action at this time.