This file contains hidden or 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/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]: |
This file contains hidden or 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 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 |
This file contains hidden or 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 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") |
This file contains hidden or 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/python3 | |
import mosquitto | |
import select | |
import socket | |
import time | |
import os | |
IRC_HOST = "192.168.66.1" | |
IRC_PORT = 6667 | |
NICK = "HomeBot" |
This file contains hidden or 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/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()] |
NewerOlder