Skip to content

Instantly share code, notes, and snippets.

@atx
atx / build-orangepipc-gentoo.py
Last active November 17, 2023 19:41
Script for building a Gentoo image for the Allwinner H3, use at your own risk
#! /bin/bash
# This script builds a Gentoo image for the Allwinner H3
# Based on http://linux-sunxi.org/H3_Manual_build_howto
# Tested on Orange Pi PC
set -e
function green {
echo -e '\033[0;32m'$@'\033[0m'
#! /usr/bin/python3
import struct
import sys
def to_int(l, signed=False):
ret = 0
for x in l[1:] if signed else l:
ret = (ret << 1) | x
if signed and l[0]:
@atx
atx / demod.py
Created September 20, 2014 12:55
import scipy.io.wavfile
import sys
for fname in sys.argv[1:]:
rate, data = scipy.io.wavfile.read(fname)
silence = 0
for x in data:
if x and silence:
print(silence)
silence = 0
import numpy
import scipy.io.wavfile
import sys
rate, inp = scipy.io.wavfile.read(sys.argv[1])
inp = [x[0] for x in inp]
print("Loaded...")
lowpass = numpy.convolve(inp, [1 / 20] * 20, mode="same")
@atx
atx / mqttirc.py
Created August 16, 2014 12:19
mqttirc.py
#!/usr/bin/python3
import mosquitto
import select
import socket
import time
import os
IRC_HOST = "192.168.66.1"
IRC_PORT = 6667
NICK = "HomeBot"
#!/usr/bin/python3
import time
import json
import urllib.request
raw = urllib.request.urlopen("http://api.openweathermap.org/data/2.5/forecast?q=Pardubice").read()
js = json.loads(raw.decode("UTF-8"))
future = [x for x in js["list"] if x["dt"] > time.time()]