Feb 08
2010
Note: in arduino-0017, floating point printing is supported by default. The function below is not necessary.
``` brush:c
void floatPrint(float f, int places=6)
{
int _d;
if (f < 0)
{
Serial.print("-");
f*=-1;
}
_d = (int)f;
if (!places)
{
return;
}
Serial.print(_d, DEC);
Serial.print('.');
while(places--)
{
f-=_d …
Dec 31
2009
I use a custom script to insert the current git commit into GeoNote, so when I get bug reports I have a better idea of which version the user is running. The script is as below:
``` brush:c
import os
from Foundation import NSMutableDictionary
version = os.popen4("/sw/bin/git …
Dec 07
2009
If one source file is sourcecode.c.objc and another is sourcecode.cpp.objcpp, you will have problems if you try to call function defined in one file from the other. The resolve this either make them the same source type, or follow this guide.
This drove me nutty because …
Oct 11
2009
I generated a gpg keypair for myself today, and I was looking for a fairly safe way to back it up. I don't particularly trust DVD/CDs, and keeping it on flash is even more worrying. I wanted a means of backup I can see and touch.
Paperbak would be …
Sep 21
2009
gnuplot can be used to fit a fourier series to a series of data points. In my case it was an observation log for the star BE Lyncis from the Bossom Observatory, curtsey of Geir Klingenberg.
Firstly one needs to define a time function t(x) such that as x …
Sep 09
2009
rkhunter often warns on file property changes after upgrade and such, and sometimes you just aren't sure whether it is due to recent upgrades, or because you really were compromised. The following script was written to compare the checksum of all files rkhunter warns about against the originals in a …
Aug 05
2009
Annoyingly git-daemon-run requires runit on debian, but runit will fail to install properly in a debian vserver because it doesn't have init.
One solution is to reconfigure vserver to use plain init style.
However I didn't want to this because I don't want to take down my vserver just yet …
Jul 29
2009
Edit: it occurred to me what I have below is the basics of a thin facebook api wrapper. I might make it into one at some point in the future.
If you don't know what this does, you don't need it. Hope this helps some one. Written because pyfacebook is …
Jun 01
2009
Code to drive it is avaliable under GPL.
An updated version of the schematic as a .sch file is available also.
Cheers,
Steve
May 17
2009
Got my hands on a ADJD-S371 on a breakout board from Sparkfun. The code below can be used to calibrate it. The most up-to-date version of the code can be found at my git repository under colour_sensor_calibration.
``` brush:cpp
include
/ Calibrates the sensor to get white balance. Pin 2 should …
Apr 28
2009

Firstly, my usual approach of s/\s+$//g doesn't work since it eats up the newline too. s/\s+$/\n/g doesn't work either because the Replace: field in the find dialogue doesn't escape the \n.
Final solution is as shown: s/[ \t]+$//g …
Feb 09
2009
A simple 2 DoF setup with an accelerometer (LIS302DL) attached to the effector. The seeeduino attempts to drive the servos so the Z and Y axis measure zero acceleration. The sketch is available at the usual place.
The algorithm employed is a simple PD controller with pseduo-gradient stepping to determine …
Dec 25
2008
[

](http://www.flickr.com/photos/sentientintelligence/3134648563/ "photo sharing")
[DIY digital spirit level](http://www.flickr.com/photos/sentientintelligence/3134648563/)
Originally uploaded by [sentientintelligence](http://www.flickr.com/people/sentientintelligence/)
A simply digital spirit level using a LIS302DL accelerometer from nkcelectronics coupled with a seeeduino for processing and a 2x16 …
Oct 09
2008
But you can get the current function's name by using:
sys._getframe().f_code.co_name
Seems to work alright for debugging purposes. See the link embedded in the title for the origins and 3 other methods.
Cheers,
Steve
Jul 16
2008
I have set up an unofficial git respository for libfg patches and new swig generated python interface, as Gavin Baker (the author) appears to be busy with other things. This is a maintance only repository as far as libfg goes - I don't plan on adding any more features (since all …
Jul 04
2008
Thats right, another webapp! This time using google's app engine, so feel free to abuse it, somewhat :P
Rank'em is its name, and it basically lets you create a collection of Things then allow other people to rank each Thing against each other, producing an overall ranking of Things …
Jun 18
2008
An follow up on the last round of language personifications, this time contributed by brett.
PHP
The crazy party girl you meet at Uni; she's easy to get along with at the beginning; she reminds you of other girls you've known before and hey, its a bit of fun; you're …
Apr 28
2008
Firstly, I am the kind of guy who likes tabs over spaces, because I don't like forcing my particular preferences on to other people. To wax poetic, I like to give other people the freedom of choosing how they want their code indented. This of course brings me into the …
Dec 31
2007
I was tired of converting all my HTML ebooks to rtf, then to pdb using Palm Doc Converter only to lose all the nice touches like bold, italics and headings. Since there didn't seem to be a HTML to PML converter for OS X, I wrote one to get more …
Dec 13
2007
Two strange and weird things happened to me recently. One is my /dev/null disappearing from leopard!
A large number of programs, both Cocoa and *nix relies on /dev/null being present. As you can see I could not gain root privileges, and thus could not recreate /dev/null (character …