Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Arndt SpotlightKid

View GitHub Profile
@SpotlightKid
SpotlightKid / github_download.py
Created Aug 6, 2014
Github file viewer / general URL download script for Pythonista
View github_download.py
"""Prompt user for URL and filename and download the remote resource to a file.
If the clipboard contains a HTTP(S) or FTP(S) URL, the URL input dialog is
pre-filled with it.
The suggested local filename is extracted from the URL, if possible.
If a github file viewer URL is given, it is transformed into the matching
raw file access URL, which makes it easier to download files on github you
are viewing in your browser. Just copy the URL to the clipboard, change to
@SpotlightKid
SpotlightKid / lua.env
Last active Oct 27, 2020
Lua environment variables for multiple version support
View lua.env
# Lua dev
LUA_DIR="$HOME/share/lua"
LUA_CDIR="$HOME/lib/lua"
if which lua5.1 >/dev/null 2>&1; then
if which luarocks >/dev/null 2>&1; then
LUA_PATH_5_1="$(luarocks --lua-version 5.1 --local path --lr-path)"
LUA_CPATH_5_1="$(luarocks --lua-version 5.1 --local path --lr-cpath)"
fi
@SpotlightKid
SpotlightKid / bash_aliases.sh
Last active Oct 27, 2020
Some handy bash aliases / functions I don't see elsewhere often
View bash_aliases.sh
# configure some commands via env variables
# (usually located in another file)
# export EDITOR=micro
# export VISUAL=$EDITOR
# export XEDITOR="geany"
# export BROWSER=xdg-open
# To open any file type via app registered in desktop system
alias xo='xdg-open'
@SpotlightKid
SpotlightKid / debounce.py
Last active Oct 27, 2020
Debounced switch using pin and timer IRQs on MicroPython
View debounce.py
#
# inspired by: https://forum.micropython.org/viewtopic.php?t=1938#p10931
#
import micropython
try:
from machine import Timer
timer_init = lambda t, p, cb: t.init(period=p, callback=cb)
except ImportError:
from pyb import Timer
@SpotlightKid
SpotlightKid / stereocrossdelay.dsp
Last active Oct 23, 2020
A FAUST stereo delay with feedback and cross-mixing
View stereocrossdelay.dsp
declare name "StereoCrossDelay";
declare description "A stereo delay with feedback and cross-mixing";
declare author "Christopher Arndt";
declare license "MIT license";
import("stdfaust.lib");
MAX_DELAY = 2.0;
time_l = ba.sec2samp(hslider("[0]Delay Left[symbol: delay_l][unit: ms]", 250.0, 0, MAX_DELAY * 1000, 0.1) * 0.001 : si.smoo);
@SpotlightKid
SpotlightKid / getdocstrings.py
Created Sep 1, 2014
Parse Python source code and get or print docstrings.
View getdocstrings.py
# -*- coding: utf-8 -*-
"""Parse Python source code and get or print docstrings."""
__all__ = ('get_docstrings', 'print_docstrings')
import ast
from itertools import groupby
from os.path import basename, splitext
@SpotlightKid
SpotlightKid / PKGBUILD-kicad-packages3d-git.sh
Last active Oct 15, 2020
Updated PKGBUILD for kicad-packages3d-git
View PKGBUILD-kicad-packages3d-git.sh
# Maintainer: Frederic Van Assche <frederic@fredericva.com>
# Contributor: Christopher Arndt <aur -at- chrisarndt -dot- de>
_pkgname=kicad-packages3d
pkgname="${_pkgname}-git"
pkgver=r2020.10.06.27d653ce
pkgrel=1
pkgdesc="KiCad component 3D model libraries from the official git repo"
arch=('any')
url="https://github.com/KiCad/kicad-packages3D"
@SpotlightKid
SpotlightKid / .gitignore
Last active Oct 8, 2020
Updated PKGBUILD for python2-lupa 1.9
View .gitignore
pkg/
src/
lupa-*.tar.gz
python2-lupa-*.pkg.tar.xz
python2-lupa-*.pkg.tar.zst
@SpotlightKid
SpotlightKid / Makefile-cython-embed.make
Created Oct 7, 2020
Makefile for creating a standalone program via Cython from a *.py / *.pyx file
View Makefile-cython-embed.make
# Makefile for creating a standalone program via Cython from a *.py / *.pyx file
PYX ?= main.pyx
PROG ?= $(basename $(PYX))
PYTHON ?= python
PYVERSION = $(shell $(PYTHON) -c 'import sys;print("%d.%d" % sys.version_info[:2])')
PYMAJOR = $(shell $(PYTHON) -c 'import sys;print(sys.version_info[0])')
PYPREFIX = /usr
INCLUDES = -I$(PYPREFIX)/include/python$(PYVERSION)
@SpotlightKid
SpotlightKid / wavefile.py
Created Jun 25, 2020
Python WAV file decoder
View wavefile.py
# -*- coding: utf-8 -*-
__all_ = [
'Error',
'FmtChunk',
'ParsingError',
'SmplChunk',
'UnsupportedCompressionError',
'WavChunk',
'WavFile'
You can’t perform that action at this time.