Skip to content

Instantly share code, notes, and snippets.

@tehmaze
tehmaze / wx.py
Created April 20, 2014 20:35
WX report generator for PyMultimonAPRS
#!/usr/bin/env python
import json
import pywapi
import sys
import time
LOCATION_ID = sys.argv[1]
wxs = pywapi.get_weather_from_weather_com('NLXX0250', 'metric')

Keybase proof

I hereby claim:

  • I am tehmaze on github.
  • I am maze (https://keybase.io/maze) on keybase.
  • I have a public key whose fingerprint is 07E4 0BB3 3D63 D490 4797 3421 ED7B 1576 294D F221

To claim this, I am signing this object:

@tehmaze
tehmaze / c64xbin.py
Last active August 29, 2015 14:16
C64 PRG to XBIN converter
#!/usr/bin/env python
#
# (c) 2015 Wijnand Modderman-Lenstra, https://maze.io/
#
# Convert a C64 memory dump (VICE) to eXtended Binary (XBIN)
#
# To capture a dump in VICE, attach to the monitor, and run the following::
# > $01 $35
# save "dump.ram" 0 $0000 $FFFF
#
@tehmaze
tehmaze / asciifix.py
Created August 18, 2015 08:45
Fix broken ASCIIs interpreted as ANSi by PabloDraw
#!/usr/bin/python
import sys
lines = []
overflow = False
with open(sys.argv[1]) as i:
for line in i:
line = line.rstrip('\r\n')
if overflow:
@tehmaze
tehmaze / google-chrome.sh
Created December 30, 2010 22:34
Google Chrome Profile launcher for OSX
#! /bin/bash
#
# Put this script in ~/bin/google-chrome for example, then create
# a symlink to start using it, for example:
#
# shell% cd bin
# shell% ln -s google-chrome google-chrome-test
# shell% ./google-chrome-test
# Try to locate Google Chrome
@tehmaze
tehmaze / chip_packages.py
Created January 6, 2011 22:29
Chip package types
PACKAGE_ALIAS = {
'DIL': 'DIP',
'CERDIP': 'CDIP',
'TDSP': 'TCSP',
'UCSP': 'BGA',
'uMAX': 'SOIC',
}
PACKAGE_DEFAULT = {
'BCC': 'Bump Chip Carrier',
'BGA': 'Ball Grid Array',
Request.Twitter = new Class({
Extends: Request.JSONP,
options: {
linkify: true,
url: '/twitter/statuses/user_timeline/{term}.json',
data: {
count: 5
}
@tehmaze
tehmaze / Ticker.Twitter.js
Created January 9, 2011 14:16
MooTools Twitter ticker based on the JSONP protocol
/*
* This requires https://gist.github.com/771026
*/
var Ticker = new Class({
Implements: [Options],
options: {
delay: 5000
@tehmaze
tehmaze / singleton.py
Created January 9, 2011 21:57
Singleton Class decorator
def singleton(cls):
instances = {}
def instance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return instance
@tehmaze
tehmaze / ternary.py
Created January 9, 2011 21:59
Python Ternary operator
class Ternary(object):
'''
Ternary-ish emulation, it looks like C-style ternary operator::
x = a ? b : c
In Python we would write::
>>> x = a and b or c