Skip to content

Instantly share code, notes, and snippets.

View SpotlightKid's full-sized avatar

Christopher Arndt SpotlightKid

View GitHub Profile
@SpotlightKid
SpotlightKid / panic.py
Last active November 23, 2017 10:50
Send AllSoundOff and ResetAllControllers on all JACK MIDI ouputs on all channels.
#!/usr/bin/env python
"""Send AllSoundOff and ResetAllControllers on all JACK MIDI outputs on all channels."""
import rtmidi
from rtmidi.midiconstants import (ALL_SOUND_OFF, CONTROL_CHANGE,
RESET_ALL_CONTROLLERS)
mo = rtmidi.MidiOut(rtapi=rtmidi.API_UNIX_JACK)
print(__doc__)
@SpotlightKid
SpotlightKid / rest-server.py
Last active May 12, 2016 00:39 — forked from miguelgrinberg/rest-server.py
The code from my article on building RESTful web services with Python and the Flask microframework (this fork is Python 3 compatible). See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
@SpotlightKid
SpotlightKid / noteon2osc.py
Last active November 23, 2017 10:52
Send an OSC message when a MIDI Note On message is received using python-rtmidi and pyliblo.
#!/usr/bin/env python
#
# noteon2osc.py
#
"""Send an OSC message when a MIDI Note On message is received."""
import time
import liblo
from rtmidi.midiconstants import NOTE_ON
from rtmidi.midiutil import open_midiinput
@SpotlightKid
SpotlightKid / noembed.plugin
Created April 27, 2016 16:38
Nikola plugin for embedding content from popular sites with micawber and Noembed
[Core]
name = rest_noembed
module = noembed
[Nikola]
compiler = rest
plugincategory = CompilerExtension
[Documentation]
author = Christopher Arndt
@SpotlightKid
SpotlightKid / getch.py
Created April 26, 2016 14:03
Get a single char from (POSIX) console input in a blocking or non-blocking way.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Get a single char from console input in a blocking or non-blocking way."""
from __future__ import print_function
import sys
import select
import tty
import termios
@SpotlightKid
SpotlightKid / virtualenv-select
Last active December 21, 2016 14:28
Run either pyvenv or virtualenv depending on the version of Python used.
#!/usr/bin/env python
"""Run either pyvenv or virtualenv depending on the version of Python used.
To use this with virtualenvwrappper, install it into a directory on your
``PATH`` as 'virtualenv-select' and add the following to your
``~/.bashrc``:
export VIRTUALENVWRAPPER_VIRTUALENV=virtualenv-select
.. note::
@SpotlightKid
SpotlightKid / audio.tmpl
Last active September 12, 2017 14:11
A Jinja2 template-based shortcode for Nikola to embed a HTML5 audio player and download links
{#
Usage:
{{% audio src=http://example.com/my-track.mp3 %}}
Or:
{{% audio src=http://example.com/my-track.mp3 formats=mp3,ogg %}}
Sorry, your browser does not seem to support the HTML 5 audio element.
@SpotlightKid
SpotlightKid / indexed_odict.ipynb
Last active May 11, 2016 14:24
Index access to OrderedDicts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding=UTF-8
from __future__ import division
import nltk
from collections import Counter
# This is a simple tool for adding automatic hashtags into an article title
# Created by Shlomi Babluki
# Sep, 2013
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ntppeerstats.py
#
# Copyright 2016 Christopher Arndt <chris- at- chrisarndt -dot- de>
#
"""Get NTP daemon peer statistics and graph time offsets.
Documentation of the file format: