Skip to content

Instantly share code, notes, and snippets.

@derpston
derpston / gist:1494015
Created December 18, 2011 17:41
Bifferboard BIFFROOT menu example
BIFFBOOT v3.3 00B3F600379E 32-bit Loader by bifferos (c) 2010
Redistribution prohibited, all rights reserved.
Press <ESC>
'help' or '?' for a list of commands
BIFFBOOT> ?
Available commands:
help Print this help
? Alias for 'help'
credits Print credits
analyser Run a simple logic analyser on JTAG/button GPIO
@derpston
derpston / sparkfun-freeday-metricfire.py
Created January 12, 2012 14:55
SparkFun Free Day / Pachube / Metricfire data scraper
import urllib
import time
import metricfire
from BeautifulSoup import BeautifulSoup
metricfire.init("[API key redacted]")
previous_values = None
while True:
@derpston
derpston / mf_benchmark.py
Created March 7, 2012 02:28
Metricfire Python benchmarking
import metricfire
import time
# Send to a nonexistant Metricfire aggregation server on this machine.
metricfire.init("deadbeef-dead-beef-dead-deadcafebabe", server = "127.0.0.1:6334")
before = time.time()
for index in xrange(100000):
pass
after = time.time()
@derpston
derpston / crontab
Created March 8, 2012 00:04
Quick and dirty implementation of a smokeping-like tool on top of Metricfire
* * * * * curl -s https://your-api-key@api.metricfire.com/v1/metric/smokecheap/tog-dot-ie --data-binary "[$(ping -c 20 tog.ie | awk '/bytes from/{print $8}' | cut -b6-10 | xargs | tr ' ' ',')]"
@derpston
derpston / gist:2772494
Created May 23, 2012 00:20
Node.js: sending memory usage data to Metricfire
// Send process memory usage to Metricfire every ten seconds.
var metricfire = require("metricfire");
metricfire.init("your-api-key");
setInterval(function(){
memusage = process.memoryUsage();
metricfire.send("memoryusage.rss", memusage.rss);
metricfire.send("memoryusage.heaptotal", memusage.heapTotal);
metricfire.send("memoryusage.heapused", memusage.heapUsed);
@derpston
derpston / riakcollector.py
Last active December 28, 2015 01:29
Plugin for diamond, collects stats from riak over http locally and submits to Graphite.
# Plugin for the diamond to collect stats from Riak over HTTP.
#
# Copyright (c) 2013, Metricfire Ltd (Hosted Graphite)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@derpston
derpston / cursestest.py
Created April 11, 2012 17:56
Python curses example
# Scatters dots randomly on your terminal as a quick demo of curses.
import curses
import random
import time
window = curses.initscr()
try:
(h, w) = window.getmaxyx()
@derpston
derpston / gist:2069716
Created March 18, 2012 07:42
Unpacking and repacking initramfs images
# Unpack
gzip -cd /boot/initramfs.example | cpio -i
# Repack
find . | cpio --dereference -o -H newc | gzip > /boot/initramfs.example
@derpston
derpston / button.py
Created May 24, 2012 00:29
Python libusb interface for getting key up/down events from USB HIDs like keyboards.
import sys
import time
import usb
class Button:
def __init__(self, vendor_id, device_id):
"""
Find and open a USB HID device.
"""