Skip to content

Instantly share code, notes, and snippets.

@apetrone
apetrone / graylog2_proxy.py
Created April 28, 2014 00:27
graylog2 proxy which bridges the gap between Java compression and minizip.
# Adam Petrone, May 2012
import socket
import json
import zlib
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
host = "0.0.0.0"
port = 12202
sock.bind((host,port))
@apetrone
apetrone / led_heart.ino
Created February 14, 2014 07:29
Firmware for the LED Heart, Valentine's Day 2014
/*
Date: February 2014
Author: Adam Petrone
Valentine's Day LED Heart
*/
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
const uint8_t NUM_PIXELS = 6;
@apetrone
apetrone / aquarium_thermostat.ino
Created January 19, 2014 01:23
aquarium_thermostat
/*
Date: January 2014
Author: Adam Petrone
Aquarium Thermostat
*/
#include <Wire.h>
#include <LiquidCrystal.h>
#include <TinyDHT.h>
#include <OneWire.h>
@apetrone
apetrone / new_years_hat.ino
Last active January 1, 2016 21:19
2014 New Years Hat
/*
Date: December 2013
Author: Adam Petrone
New Year's Hat
*/
#include <Adafruit_NeoPixel.h>
const uint8_t NUM_PIXELS = 16;
const uint8_t PIXEL_DATA_PIN = 3;
@apetrone
apetrone / holiday_lights
Created December 24, 2013 20:51
LPD8806 Holiday Lights
/* So I had 5 meters of LPD8806 lying around with no plans to ever use them.
They will be my holiday lights this year, driven by an Arduino Pro Mini 5v.
Date: December 2013
Author: Adam Petrone
*/
#include <SPI.h>
#include <LPD8806.h>
@apetrone
apetrone / arduino_motor_controller_lightbar
Last active December 24, 2015 20:09
arduino_motor_controller (with red/blue lightbar)
// Arduino-based motor controller
// This was designed to work with a Spektrum AR6200 receiver, but any receiver should work
// with proper calibration and setup of available channels.
#include <Adafruit_NeoPixel.h>
const uint8_t DATA_PIN = 7;
const uint8_t N_PIXELS = 8;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
uint8_t cpix = 0;
int8_t dir = 1;
@apetrone
apetrone / arduino_motor_controller.ino
Last active December 24, 2015 08:49
arduino controller (wip)
// Arduino-based motor controller
// This was designed to work with a Spektrum AR6200 receiver, but any receiver should work
// with proper calibration and setup of available channels.
uint8_t GEAR_INPUT = 5;
uint8_t FLAPS_INPUT = 6;
uint8_t GEAR_OUTPUT = 7;
uint8_t FLAPS_OUTPUT = 8;
@apetrone
apetrone / matrix_transpose.py
Created July 5, 2013 20:25
Matrix transpose to C code
# This was created as a matrix utility to create C code from matrix notations
colMajor = {
11 : 0, 12 : 4, 13 : 8, 14 : 12,
21 : 1, 22 : 5, 23 : 9, 24 : 13,
31 : 2, 32 : 6, 33 : 10, 34 : 14,
41 : 3, 42 : 7, 43 : 11, 44 : 15
}
rowMajor = {
@apetrone
apetrone / winpath_startup.py
Last active May 14, 2022 14:51
Set win32 environment variable on startup via python
# This must be run with Administrator privileges in order to set environment variables
# http://code.activestate.com/recipes/55993/, Wolfgang Strobl
import _winreg
import sys
import traceback
import win32gui
import win32api
# this ensures that changes propagate immediately
@apetrone
apetrone / rpi_board_revisions.md
Last active December 18, 2015 21:49
Raspberry Pi Board Revisions

(Original post by dom, Raspberry Pi forums)

There are three manufacturers of the boards, and they have unique board revs:

'0002' => 'Model B Revision 1.0',
'0003' => 'Model B Revision 1.0 + Fuses mod and D14 removed',
'0004' => 'Model B Revision 2.0 256MB', (Sony)
'0005' => 'Model B Revision 2.0 256MB', (Qisda)
'0006' => 'Model B Revision 2.0 256MB', (Egoman)
'0007' => 'Model A Revision 2.0 256MB', (Egoman)