Skip to content

Instantly share code, notes, and snippets.

View pdp7's full-sized avatar
💭
Linux on RISC-V

Drew Fustini pdp7

💭
Linux on RISC-V
View GitHub Profile
@pdp7
pdp7 / timetemp
Created September 17, 2012 05:00
[timetemp] init script for Raspberry Pi to start display of time and temp on 7-segment display
### BEGIN INIT INFO
# Provides: time and temp on 7-segment
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: 7-segment display
# Description: time and temp
### END INIT INFO
@pdp7
pdp7 / timetemp.sh
Created September 17, 2012 04:59
[timetemp] shell wrapper for python script for Raspberry Pi to display time and temp on 7-segment display
#!/bin/bash
LOG=/var/log/timetemp.log
echo tmp102 0x48 > /sys/class/i2c-adapter/i2c-0/new_device
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
hwclock &> $LOG
date &>> $LOG
hwclock -s &>> $LOG
date &>> $LOG
/home/pi/timetemp/timetemp.py
@pdp7
pdp7 / timetemp.py
Created September 8, 2012 10:06
[timetemp] python script for Raspberry Pi to display time and temp on 7-segment display
#!/usr/bin/env python
# element14 Blog post:
# http://www.element14.com/community/groups/raspberry-pi/blog/2012/09/26/time-temp-display-for-raspberry-pi
# Based on Simon Monk's library:
# http://www.doctormonk.com/2012/08/led-clock-using-raspberry-pi.html
#
import i2c7segment as display
import time
import sensors
from time import sleep
@walkermatt
walkermatt / debounce.py
Created June 4, 2012 21:44
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():