This file contains 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 datetime | |
def floor_to_minute(time, minutes): | |
time = time - datetime.timedelta( | |
minutes=time.minute % minutes, | |
seconds=time.second, | |
microseconds=time.microsecond) | |
return time |
This file contains 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/env python | |
# lsusb.py | |
# Displays your USB devices in reasonable form. | |
# (c) Kurt Garloff <garloff@suse.de>, 2/2009, GPL v2 or v3. | |
# (c) Kurt Garloff <kurt@garloff.de>, 9/2013, GPL v2 or v3. | |
# Usage: See usage() | |
from __future__ import print_function | |
import os |
This file contains 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
#include <SoftwareSerial.h> | |
#include <DHT.h> | |
#define DHTTYPE DHT22 | |
#define DHTPIN 12 | |
#define LED_PIN 13 | |
DHT dht(DHTPIN, DHTTYPE); | |
SoftwareSerial dbgSerial(2, 3); // RX, TX |
This file contains 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 fcntl | |
import termios | |
import sys | |
fd = sys.stdin.fileno() | |
old = termios.tcgetattr(fd) | |
new = termios.tcgetattr(fd) | |
new[3] = new[3] & ~termios.ECHO # disable echo | |
termios.tcsetattr(fd, termios.TCSANOW, new) |
This file contains 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 subprocess | |
for line in subprocess.check_output('dd if=/dev/urandom of=output.dat bs=1M count=10', shell=True, stderr=subprocess.STDOUT): | |
print line.split(" ") |
This file contains 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 asyncio | |
import requests | |
import os | |
import re | |
import time | |
progress = {} | |
chunk_size = 4096 | |
workers = 2 | |
running = 0 |
This file contains 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/env python3 | |
import argparse | |
import asyncio | |
import requests | |
import os | |
import sys | |
import re | |
import time | |
import signal | |
import configparser |
This file contains 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
normal_variable = "hello I'm a normal variable" | |
def lazy_variable(): | |
from random import randint | |
return "hello I'm a lazy variable and my favorite number is {}".format(randint(0, 1000)) | |
import sys |
This file contains 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
from collections import defaultdict | |
def deep_defaultdict(): | |
return defaultdict(deep_defaultdict) | |
d = deep_defaultdict() | |
d['x']['y']['z'] = 'foo' |
This file contains 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
#define F_CPU 8000000UL | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
#include <util/delay.h> | |
#include <avr/sleep.h> | |
#include <avr/power.h> | |
const uint8_t MINPWM = 1; | |
const uint8_t MAXPWM = 255; |