Skip to content

Instantly share code, notes, and snippets.

View SpotlightKid's full-sized avatar

Christopher Arndt SpotlightKid

View GitHub Profile
@SpotlightKid
SpotlightKid / tapklick.sh
Last active February 14, 2024 21:49
Run klick metronome and tap tempo with enter/return key
#!/bin/bash
#
# Run klick metronome and tap tempo with enter/return key
#
TEMPO="${1:-120}"
cleanup() {
stty echo
oscsend localhost 9001 /klick/metro/stop
@SpotlightKid
SpotlightKid / open-in-firefox.sh
Last active February 13, 2024 10:38
Open URL from Termux command line in Firefox Android browser
#!/bin/bash
#
# open-in-firefox.sh - open URL from Termux command line in Firefox Android browser
#
# Works with file:// URLs too, unlike with termux-open{-url}.
#
exec am start --user 0 -a android.intent.action.VIEW -n org.mozilla.firefox/.App -d "$1" >/dev/null
@SpotlightKid
SpotlightKid / AutomationTest.py
Last active December 1, 2023 16:05
Test integration of Pythonista UI and MQTT.
# coding: utf-8
from __future__ import print_function
import socket
import struct
import ui
import paho.mqtt.client as mqtt
@SpotlightKid
SpotlightKid / test.sh
Last active October 9, 2023 21:31
Making a POST request with url or form-encoded params with MicroPython
$ micropython uget.py key1=value1 key2=value2 key2=value3
{'url': 'http://httpbin.org/get?key2=value3&key1=value1', 'headers': {'Host': 'httpbin.org', 'Connection': 'close'}, 'args': {'key2': 'value3', 'key1': 'value1'}, 'origin': 'XXX.XXX.XXX.XXX'}
$ micropython upost.py foo=bar spamm=42
{'files': {}, 'headers': {'Host': 'httpbin.org', 'Content-Length': '16', 'Content-Type': 'application/x-www-form-urlencoded', 'Connection': 'close'}, 'args': {}, 'form': {'spamm': '42', 'foo': 'bar'}, 'origin': 'XXX.XXX.XXX.XXX', 'data': '', 'json': None, 'url': 'http://httpbin.org/post'}
@SpotlightKid
SpotlightKid / aescrypt.py
Created September 3, 2014 18:29
Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
Usage:
File Encryption:
aescrypt.py [-f] infile [outfile]
@SpotlightKid
SpotlightKid / MarkdownPDF.py
Last active August 25, 2023 20:55
Markdown to PDF Conversion for Pythonista
# Markdown to PDF Conversion
#
# This script converts Markdown markup to PDF directly on your iOS device.
#
# Please see the "Requirements" section in the docstring below for required
# dependencies and the "Installation" section for instructions on how to
# install them.
#
# Run this script directly or put it into the Pythonista editor action menu
# with one of the following options as the first and sole argument:
@SpotlightKid
SpotlightKid / sendsyx.py
Created August 2, 2023 14:21
Send bytes given on the command line as hexadecimal digit pairs to selected MIDI output
#!/usr/bin/env python3
import sys
from rtmidi.midiutil import open_midioutput
if sys.argv[1:]:
midiout, _ = open_midioutput()
midiout.send_message(bytearray.fromhex(" ".join(sys.argv[1:])))
@SpotlightKid
SpotlightKid / feedinfo.py
Created June 2, 2023 18:53
Examine an RSS feed retrieved from given URL
#!/usr/bin/env python
"""Examine an RSS feed retrieved from given URL."""
import sys
from xml.dom.minidom import parseString as parse_xml
import feedparser
import requests
@SpotlightKid
SpotlightKid / waveformqt.py
Created April 24, 2023 19:02
Display waveform of an audio file using PyQt/QPainter
#!/usr/bin/env python
"""Display waveform of an audio file."""
import argparse
import logging
import sys
from statistics import fmean
from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtCore import Qt
@SpotlightKid
SpotlightKid / wagenheber.py
Last active March 19, 2023 03:07
Simple PyPI package installation client for Pythonista
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# wagenheber.py
#
"""Simple PyPI package installation client for Pythonista.
Currently only supports installing pure Python packages for which a
distribution archive in bdist_wheel format is available on PyPI.