Skip to content

Instantly share code, notes, and snippets.

@duquesnay
duquesnay / python dynamic module url load
Last active November 17, 2017 17:51
Dynamic build module from URL
def load_module(url):
import urllib.request
from os.path import splitext, basename
from types import ModuleType
u = urllib.request.urlopen(url)
sourcename = url.split('/')[-1]
modulename = splitext(basename(sourcename))[0]
sourcecode = u.read().decode('utf-8')
code = compile(sourcecode, url, 'exec')
@duquesnay
duquesnay / pi_qemu.sh
Created March 7, 2017 11:03 — forked from JasonGhent/pi_qemu.sh
OSX raspberry pi emulation via QEMU. v2 attempt @ https://gist.github.com/JasonGhent/922f38f57c8cb77b10f3
# pulled from http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
# expanded via http://superuser.com/questions/690060/how-to-enable-network-with-a-raspberry-pi-emulated-on-qemu
# tested with 2015-02-16-raspbian-wheezy.zip on OSX Mavericks
# OSX terminal
brew install qemu
# kernel-qemu is a linux kernel compiled with ARM1176 support.
# learn more here: http://xecdesign.com/compiling-a-kernel/
curl -OL http://xecdesign.com/downloads/linux-qemu/kernel-qemu
curl -o raspbian_latest.zip -L http://downloads.raspberrypi.org/raspbian_latest