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
@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():
@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 / 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
anonymous
anonymous / Bonescript_server.js
Created August 27, 2013 04:26
Updated server.js file for Bone101 (Bonescript) application for BeagleBone Black to enable HTTP Digest Authentication by Dan/Drew @ PS1
// Copyright (C) 2011 - Texas Instruments, Jason Kridner
//
var fs = require('fs');
var child_process = require('child_process');
var http = require('http');
var url = require('url');
var path = require('path');
var winston = require('winston');
var b = require('../bonescript');
var socketio = require('socket.io');
@davidzchen
davidzchen / sample-linux.c
Last active January 19, 2024 21:20
Sample C code using the Linux kernel coding style
/*
* Sample file using the Linux kernel coding convention.
*
* https://www.kernel.org/doc/Documentation/CodingStyle
*
* General rules:
* - Indents are tabs and must be 8 spaces wide.
* - Each line must be at most 80 characters long.
* - Use C-style comments.
* - File names should be lower-case.c
@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
geocache.service:
< https://gist.github.com/Technicus/7b7ce39254bc36711add >
statuspin_1.sh:
< https://gist.github.com/Technicus/b17d754550592ced9094 >
statuspin_0.sh:
< https://gist.github.com/Technicus/97fa961f4a3db6131a1d >
geocache.service - status:
#/bin/bash
if [$1 == ""];then
echo Need a file name!
else
fswebcam --no-banner --rotate -90 -v -r 768x1024 --jpeg 95 -D 1 $1.jpg
feh -F $1.jpg
fi
#/etc/systemd/system/geocache-shmile.service
[Unit]
Description=shmile for geocache
[Service]
Type=simple
WorkingDirectory=/home/debian/shmile
ExecStart=/home/debian/shmile/node_modules/coffee-script/bin/coffee /home/debian/shmile/app.coffee