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 <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <netinet/in.h> | |
#include <net/if.h> | |
#include <sys/socket.h> | |
#include <sys/un.h> | |
#include <arpa/inet.h> | |
#include <errno.h> | |
#include <stdio.h> |
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
// arc is defined by the inner radius | |
small = 1; | |
$fa = 4; | |
//$fs = 1; | |
segmentInnerRadius = 300; | |
segmentArc = 10; // degrees | |
segmentWidth = 40; |
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 "LPD8806.h" | |
#include "SPI.h" | |
// Example to control LPD8806-based RGB LED Modules in a strip | |
/*****************************************************************************/ | |
// Number of RGB LEDs in strand: | |
int nLEDs = 32; | |
// number that we will not be writing to |
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/python | |
from xml.etree import ElementTree as ET | |
import sys | |
def compareString(a,b): | |
aLower = a.lower() | |
bLower = b.lower() | |
order = 0 | |
if aLower > bLower: |
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
unsigned long hTime = 0; // integer for storing high time | |
unsigned long lTime = 0; // integer for storing low time | |
const int window = 4; // sliding window size | |
const int shift = 3; // reject pulses if width < sum * (window / 2^shift) or 1/2 of mean pulse | |
unsigned long highFilter[window]; | |
int highIndex = 0; | |
unsigned long lowFilter[window]; | |
int lowIndex = 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 bash | |
# When sourced, this script will export the AWS_ACCESS_KEY_ID and | |
# AWS_SECRET_ACCESS_KEY credentials from the a specific profile in | |
# ~/.aws/credentials. | |
# | |
# Usage: | |
# | |
# export-aws-credentials [PROFILE] | |
# |
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 wiringpi | |
import time | |
# 1M external pull-up resistor | |
# 1) set pin low and to output to discharge | |
# 2) make the pin an input without the internal pull-up on | |
# 3) read input and see how long it takes to go high | |
# ref: https://github.com/WiringPi/WiringPi-Python | |
# pins: https://projects.drogon.net/raspberry-pi/wiringpi/pins/ |
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 | |
# Picasa sometimes duplicates imports and it adds a -NNN | |
# suffix (older versions seemed to use -N). This code | |
# finds files with this naming scheme, and looks for the base | |
# file in the same dirctory. If it finds the base, and the | |
# base has the same length, same md5 hash, the duplicate | |
# is suggested for deletion. | |
# Output is a set of 'rm <filename>' commands that can |
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
#!./env/bin/python | |
import base64 | |
import sys | |
def encode_user_data(lines): | |
""" | |
Input is an array of lines that together make a script. | |
Output is a base64 encoded block suitable for the userdata parameter | |
of an instance config. | |
""" |
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
#!./env/bin/python | |
import boto3 | |
import sys | |
def format_filter(fils=None, tags=None): | |
f = [] | |
if fils is not None: | |
for k, v in fils.items(): | |
f.append({'Name': k, 'Values': [v]}) |