Skip to content

Instantly share code, notes, and snippets.

@th0ma5w
th0ma5w / easing.py
Created Mar 31, 2014
Easing Equations in Python (orig by Robert Penner)
View easing.py
# ported from http://www.gizma.com/easing/
# by http://th0ma5w.github.io
#
# untested :P
import math
linearTween = lambda t, b, c, d : c*t/d + b
@th0ma5w
th0ma5w / comparer.py
Created Apr 8, 2014
CSV logging script for stock dump1090
View comparer.py
#!/usr/bin/python
#
# CSV logging script for stock dump1090
#
# Uses the Requests library to compare the state of planes in view
# and prints changes to standard out
#
# Start dump1090
# modify this script to point to your dump1090 URL if different
# run the script and pipe the output to a file eg:
@th0ma5w
th0ma5w / tzumi_server.py
Created Jun 10, 2018
Single Page Web Application and REST API for TzumiMagicTV
View tzumi_server.py
# th0ma5w at github
#
# requires:
# http://archive.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/zlib_1.2.7-1_ar71xx.ipk
# http://archive.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/python-mini_2.7.3-1_ar71xx.ipk
#
# python ./tzumi_server.py
#
import socket
@th0ma5w
th0ma5w / horoscopescrape.py
Created Jan 12, 2011
Example of Generating URLs for downloading
View horoscopescrape.py
"""
Creates a list of URLs to stdout based on repeating patterns found in the site, suitable for use with WGET or CURL.
"""
import datetime
scopes=[
"aries",
"taurus",
View BTFL_cli_QX65_20190516_180526.txt
# diff all
# Betaflight / OMNIBUS (OMNI) 4.0.2 May 5 2019 / 12:07:33 (56bdc8d26) MSP API: 1.41 / FEATURE CUT LEVEL 9
batch start
defaults nosave
mcu_id 001f001d5734570820363930
name QX65
feature -RX_PPM
feature -AIRMODE
feature RX_SERIAL
@th0ma5w
th0ma5w / addon.py
Created Aug 30, 2018
MSNBC Audio Kodi Plugin
View addon.py
import json, urllib2, sys, xbmcgui, xbmcplugin
opener = urllib2.build_opener()
opener.addheaders = [('User-Agent', 'CURL')]
tunein_json_url = "https://tunein.com/tuner/tune/?tuneType=Station&preventNextTune=true&waitForAds=false&audioPrerollEnabled=false&partnerId=qZjjnm85&stationId=297990"
tunein_data = json.loads(opener.open(tunein_json_url).read())
stream_url = tunein_data["DirectStreams"][0]["Url"]
addon_handle = int(sys.argv[1])
xbmcplugin.setContent(addon_handle, 'movies')
@th0ma5w
th0ma5w / multimon-ng-filter.py
Created Jan 25, 2014
A way that I got working of scripting the output of multimon-ng ... not sure why the pipes are weird, but things like tee or grep seem prevent multimon-ng from producing output.
View multimon-ng-filter.py
import subprocess, sys
from datetime import datetime
from time import sleep
timestamp = lambda : datetime.now().isoformat()
# # pager_rtl.sh --
# rtl_fm -M fm -f 152.48M -r22050 -s88200 -g 42 -l 30
rtl_fm = subprocess.Popen("./pager_rtl.sh",
@th0ma5w
th0ma5w / test6.py
Last active Dec 3, 2017
A Larsen Effect pattern using MQTT, Differencing LED state, and Protobufs
View test6.py
import paho.mqtt.client as mqtt
import time
bot_reply = None
def update_reply(msg):
global bot_reply
bot_reply=msg.decode('utf-8')
topics = {
@th0ma5w
th0ma5w / xmas_lights.proto
Created Dec 3, 2017
A protobuf for describing LED strip control messages
View xmas_lights.proto
syntax = "proto2";
message led {
required uint32 led = 1;
required uint32 red = 2;
required uint32 green = 3;
required uint32 blue = 4;
required uint32 intensity = 5;
}
@th0ma5w
th0ma5w / is_the_sun_up.py
Created Dec 3, 2017
Is the sun up in Columbus? Using PyEphem to figure it out
View is_the_sun_up.py
import ephem
def is_the_sun_up():
columbus = ephem.city('Columbus')
sun = ephem.Sun()
columbus.pressure = 0
sun.compute(columbus)
twilight = -6 * ephem.degree
return sun.alt > twilight