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 / rpi_gpio.sh
Created July 12, 2012 15:46
Raspberry Pi GPIO demo shell script
#!/bin/sh
# Updated for foo feature
#
# GPIO numbers should be from this list
# 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25
# Note that the GPIO numbers that you program here refer to the pins
# of the BCM2835 and *not* the numbers on the pin header.
# So, if you want to activate GPIO7 on the header you should be
# using GPIO4 in this script. Likewise if you want to activate GPIO0
@pdp7
pdp7 / pidemo.py
Created August 2, 2012 18:13
pi demo
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
DEBUG = 1
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
@pdp7
pdp7 / test
Created August 28, 2012 15:44
test
test
@pdp7
pdp7 / GistMacro.java
Created September 4, 2012 22:18
GistMacro
public void execute(Element element, RenderContext renderContext) {
if (element.getTextContent() == null || element.getTextContent().length() == 0) {
return;
}
String id = (String) getParameters().get(GIST_ID);
if (id != null && !id.trim().equals("")) {
Element wrapper = JAXPUtils.createElement(element.getOwnerDocument(), "span");
Element script = JAXPUtils.createElement(element, "script");
@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
@pdp7
pdp7 / locate.sh
Created September 10, 2012 15:01
Latitude location export for chumby
LOCATE_HOME="$HOME/locate"
UPLOADR_HOME="${LOCATE_HOME}/uploadr"
CUTY_HOME="${LOCATE_HOME}/CutyCapt"
IMAGE_DIR="${HOME}/images"
VDISPLAY=87
URL='http://www.google.com/latitude/apps/badge/api?user=9019870671957975903&type=iframe&maptype=roadmap'
export FLICKR_UPLOADR_PY_API_KEY=515af04789bacc913dfd1eefaf1923ee
export FLICKR_UPLOADR_PY_SECRET=cceb46e3419eeb96
rm -rf ${IMAGE_DIR}/*.png
pkill -9 Xvfb
@pdp7
pdp7 / cleanup.sh
Created September 10, 2012 15:02
Cleanup latitude image captures (Chumby)
#!/bin/bash
for i in `wget -qO- 'http://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=3ddb378de0dae3d12f1f9ec4e135827e&user_id=75040169@N05&page=1&per_page=500' |grep '<photo id=' |sed 's#.*<photo id="##' | sed 's#".*##'| tr '\t' ' ' | sed 's/ //g' | perl -ne 'print if ($i>1); $i++;'`; do echo deleting $i; sleep 1; flickcurl photos.delete $i; done
@pdp7
pdp7 / test
Created September 12, 2012 00:10
test
test
@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
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