Skip to content

Instantly share code, notes, and snippets.

View microtherion's full-sized avatar

Matthias Neeracher microtherion

View GitHub Profile
@microtherion
microtherion / nested_containers.rb
Created February 23, 2014 22:02
Perl-style autovivication for Ruby hashes and Arrays
#!/usr/bin/ruby
class Array
def self.of(cclass)
return Class.new(Array) do
const_set :NESTED, cclass
def self.new(size, *args)
super(size) do |idx|
self::NESTED.new(*args)
end
//
// Light show "Trittst im Morgenrot daher"
//
enum {
kFlagRed1 = 2,
kFlagRed2,
kFlagRed3,
kFlagWhite,
kMountainBlue,
#include <SPI.h>
//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>
//and the MP3 Shield Library
#include <SFEMP3Shield.h>
/**
@microtherion
microtherion / components_separated_by_string.cpp
Created August 10, 2015 21:18
Implement C++ equivalent of ObjC componentsSeparatedByString:
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
template <typename String, typename OutputIt>
void components_separated_by_string(const String & string, const String & separator, OutputIt out)
{
typename String::size_type comp_start=0, comp_end;
while ((comp_end = string.find(separator, comp_start)) != String::npos) {
//
// MadHat - Lilypad Simple based LED hat.
//
// Makes use of Charlieplexing, due to the limited number of pins available.
//
class LEDPlex {
public:
LEDPlex(int numPins, const int pins[], const char * patterns);
/*
* FacyFlashlight - control an RGB LED with an ATtiny85.
* Matthias Neeracher 2013
*
* Needs Arduino-tiny core http://code.google.com/p/arduino-tiny/
* (The attiny core only supports 2 PWM outputs for the ATtiny85)
*
* This code is in the public domain.
*/
@microtherion
microtherion / programmers.txt
Created February 18, 2013 17:39
Arduino IDE configuration file for Bus Pirate (put into hardware/buspirate folder in your sketch directory)
buspirate.name=Buspirate
buspirate.communication=serial
buspirate.protocol=buspirate
@microtherion
microtherion / ols-fwloader-compile.sh
Last active December 16, 2015 22:09
Compiling ols-fwloader
git clone https://github.com/robots/ols-fwloader.git
cd ols-fwloader
autoreconf --install
./configure
make
sudo cp -r MacOSX_DiolanDeviceDriver/DiolanDeviceDriver.kext /System/Library/Extensions/
sudo kextutil /System/Library/Extensions/DiolanDeviceDriver.kext
sudo touch /System/Library/Extensions
ols_fwloader -f APP -P /dev/tty.usbXXXXX -W -w FPGAROM/logic_sniffer_3.07-Demon-Core.bit -t BIN
ols_fwloader -f BOOT -n -P /dev/tty.usbXXXXX -V -W -w PIC_firmware/OLSv1.firmware.v3.0.hex