This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Count occurences of same lines read from standard input. | |
Outputs a table sorted by descending count. | |
""" | |
import sys | |
from collections import Counter | |
import natsort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Clone all gists of GitHub user with given username. | |
Clones all gist repos into the current directory, using the gist id as the | |
directory name. If the directory already exists as a git repo, try to perform a | |
'git pull' in it. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# See https://github.com/SpotlightKid/jack-matchmaker/blob/master/jackmatchmaker/jacklib.py | |
import jacklib | |
result = jacklib.jack_status_t() | |
client = jacklib.client_open("transport-query", jacklib.JackNoStartServer, result) | |
if result: | |
sys.exit("Error connecting to JACK server.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Example script which maps program change numbers.""" | |
from miditk.smf import MidiFileReader, MidiFileWriter | |
class ProgramChangeMapper(MidiFileWriter): | |
"""Change program number of Program Change events according to given mapping.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Convert joystick axis position into MIDI Control Change value in-/decrements.""" | |
import os | |
import sys | |
import pygame | |
from rtmidi.midiutil import open_midioutput | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DESTDIR ?= | |
PREFIX ?= /usr | |
LV2_DIR ?= $(PREFIX)/lib/lv2 | |
FAUSTFLAGS ?= -nvoices 4 | |
NAME ?= mydsp | |
FAUST_DSP = $(NAME).dsp | |
LV2_BUNDLE = $(NAME).lv2 | |
ROOT_DIR:=$(shell dirname "$(realpath $(firstword $(MAKEFILE_LIST)))") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# rofi-selectfile | |
# | |
# Use rofi to select file or folder until file is selected, then print it. | |
# | |
# Arguments | |
# $1=directory to start, defaults to "." (specified in variable default_dir) | |
# | |
# Adapted from: https://gist.github.com/thingsiplay/6c4bd13a106a4a609d69c402e675c137 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Template for a minimal FastAPI app serving just one page from a Jinja2 template and a favicon. | |
Place the Jinja2 "index.html" template in "templates/jinja2" and a "favicon.ico" icon file in | |
"static/img" and additional static files (JavaScript, CSS, images) below "static". You can then | |
reference them in the template like this ("path" is relative to "static"): | |
{{ url_for('static', path='/dir/file.txt') }} | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
NewerOlder