View setup.py
import os
def all_files(newroot, oldroot):
fdtuples = []
for root, dirs, files in os.walk(oldroot):
fds = []
for fd in files:
if not fd[0] is '.':
fds.append(os.path.join(root, fd))
View sysctl.conf
kernel.panic = 5
View test_logging.py
import logging
RED='\033[0;31m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m'
logger = logging.getLogger('myapp')
logfile = logging.FileHandler('warnings.log')
View fx_spotlight - Alarm 0
self.fadeIn += fadeStep;
if(fadeIn < fadeMax) {
alarm[0] = fadeSpeed;
}
View syndicate_data.py
#!/usr/bin/python
import MySQLdb
import csv
from boto.s3.connection import S3Connection
from boto.s3.key import Key
query = "\
select id, name, gross_amt \
from cafeteria \
View NES30 Keyboard Map - Player 1
DPAD Up -> c
DPAD Down -> d
DPAD Left -> e
DPAD Right -> f
L Analog Left -> Left Arrow
L Analog Right -> Right Arrow
L Analog Up -> Up Arrow
L Analog Down -> Down Arrow
View convert_mp4.bash
#!/bin/bash
DEST_DIR="/home/iPod"
FULL_PATH="$1"
ALBUM=$(basename "$FULL_PATH")
NEW_PATH="$DEST_DIR/$ALBUM"
echo "Transcoding into $NEW_PATH"
mkdir "$NEW_PATH"
View send_io.sh
#!/bin/sh
curl -H 'X-AIO-Key: feedfacedaedbeef' -H 'Content-Type: application/json' -X POST https://io.adafruit.com/api/feeds/myfeedname/data.json -d'{"value": 17}'
View jabtest.py
import sleekxmpp
class Jabber(sleekxmpp.ClientXMPP):
def __init__(self, username, password, instance_name=None):
jid = "%s/%s" % (username, instance_name) if instance_name else username
super(Jabber, self).__init__(jid, password)
self.instance_name = instance_name
self.add_event_handler('session_start', self.start, threaded=False, disposable=True)
self.add_event_handler('message', self.receive, threaded=True, disposable=False)
View wifi
check host gateway with address 192.168.1.1
start "/usr/sbin/service networking start"
stop "/usr/sbin/service networking stop"
if failed icmp type echo count 5 with timeout 10 seconds
then restart
if 4 restarts within 5 cycles
then exec /sbin/reboot