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 / livejson.py
Last active August 29, 2015 14:04
LiveJSON
# August 2014
# Adam Petrone
# This is a Sublime Text 2 plugin and was designed
# to allow live-editing of variables in my codebase
# for quicker iteration times.
# It communicates with CivetServer on the native C++ side
# and parses the incoming JSON.
@apetrone
apetrone / filter_branch.sh
Last active June 25, 2016 22:38
Git Knowledge Base
#!/bin/bash
# Adam Petrone
# May 2012
# USAGE: ./gclean.sh source_repo target_repo source_repo_subfolder git_location
# root/
local_repo=$1
# cerberus
@apetrone
apetrone / unix tips
Last active August 29, 2015 14:06
*nix tips
# We don't need dos2unix:
cat foo | col -b > foo2
# force process to background without killing it in a terminal.
$ sleep 1000
^Z
[1]+ Stopped sleep 1000
$ bg
$ disown
$ exit
@apetrone
apetrone / roomba_robot.ino
Last active September 4, 2015 01:44
roombot
// Adam Petrone, September 2014
// Robot based on original iRobot Roomba
#include <Wire.h>
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
// wired up to pins 12, and 13 of Arduino Pro Mini
SoftwareSerial ss = SoftwareSerial(13, 12);
// motor output pins
@apetrone
apetrone / ios_tips
Created October 8, 2014 00:11
iOS tips
http://stackoverflow.com/questions/25770198/archive-in-xcode-6-is-producing-a-pkg-not-ipa
Add LSRequiresIPhoneOS YES to your plist.
@apetrone
apetrone / pan_tilt_receiver.ino
Last active August 29, 2015 14:07
pan_tilt_receiver
// Adam Petrone
// October 2014
// Code to control my custom pan/tilt mechanism.
// Target Hardware: Arduino Pro Mini 8 or 16MHz should do.
#include <Servo.h>
#include <SoftwareSerial.h>
// DOUT, DIN on the XBee to pins 6 and 7 respectively on the Pro Mini.
SoftwareSerial ss = SoftwareSerial(6, 7);
@apetrone
apetrone / string_to_layers.jsx
Created October 20, 2014 23:40
Split Active Layer Text String
// Adam Petrone
// Creation date: ~2011?
// Select a text layer in Photoshop/Illustrator and it will distribute
// each letter to its own layer.
try
{
// get the active document
var doc = app.activeDocument;
}
catch( e )
@apetrone
apetrone / rpiconfiguration
Last active August 29, 2015 14:19
raspberry pi configuration
/etc/fstab
# Force raspberry pi to use tmpfs for these mounts
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0
/boot/config.txt
@apetrone
apetrone / win_tips.bat
Last active November 11, 2016 19:27
Windows tips
- Determine why Visual Studio is rebuilding a project:
-- add a block to enable debug view output (devenv.exe.config); check DebugView for the reason.
VS2010
<system.diagnostics>
<switches>
<add name="CPS" value="4" />
</switches>
</system.diagnostics>