Journey's End

Feb 08
2010

Yet Another Arduino Float Print Function

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 …
ts=13:12 tags=[arduino,code]

Dec 31
2009

Order Matters With XCode's Build Phrases

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 …

ts=09:03 tags=[code,software,osx]

Dec 07
2009

Oct 11
2009

qrbackup

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

Sep 09
2009

Dealing with rkhunter warnings

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 …

ts=05:01 tags=[code,software,linux]

Aug 05
2009

Jul 29
2009

Facebook python authentication gateway

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

May 17
2009

Apr 28
2009

Stripping trailing whitespace from XCode

![](http://shuningbian.net/files/xcode_strip_trailing_whitespace_regex.jpg)

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

Auto leveller

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

DIY digital spirit level

[](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

Jul 16
2008

Jul 04
2008

Jun 18
2008

Apr 28
2008

{} I <3 thee

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

html2pml

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 …

ts=10:15 tags=[python,code,palm]

Dec 13
2007

Computing Oddities

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 …

ts=06:36 tags=[osx,code]
← Previous Next → Page 2 of 3