For what the heck im talking about see Number Forms

Note that most glyphs portray these as 1/2 where the numbers sit to the left and right of the fraction slash.

However some fonts have what are called stacked fractions, nut fractions, or vertical fractions.

Here are some from the Google Fonts library:


	echo "p2c: angle=36.8699 distance=5 [$p2c[0]] [$p2c[1]]\n";

	echo "c2p: x=4 y=3 [$c2p[0]] [$c2p[1]]\n";

function degreesToRadians($degrees)
	return $radians;
function radiansToDegrees($radians)
	return $degrees;
function polartoCartesian($deg,$radius)


	$X= cos($radians) * $radius;
	$Y= sin($radians) * $radius;


	return $retVal;
function cartesiantoPolar($x,$y)

	$C=sqrt( ($x*$x) + ($y*$y) );

	$angle=90-$angle; // to set 0deg at north;


	return $retV;


function map($value, $fromLow, $fromHigh, $toLow, $toHigh) 
    $fromRange = $fromHigh - $fromLow;
    $toRange = $toHigh - $toLow;
    $scaleFactor = $toRange / $fromRange;
    $tmpValue = $value - $fromLow;
    $tmpValue *= $scaleFactor;
    return $tmpValue + $toLow;

I was working on a program and needed the user to be able to select from over 12 choices of pre-recorded patters.

I chose to use a absolute position rotary encoder that had 16 detents.

The particular one I chose was the Alps EC18AGB20401 Unfortunately the code that it returned was not quite binary so I had to use a look up table to go from 0-15.

int rotLUT[]={0,1,15,14,3,2,4,5,11,10,12,13,8,9,7,6};

Based on this table:

# #0 pin pin pin pin decodes as
4 3 2 1 dec
4 3 2 1 dec
1 0 0 0 0 0 0
2 1 0 0 0 1 1 clockwise
3 2 0 1 0 1 5
4 3 0 1 0 0 4
5 4 0 1 1 0 6
6 5 0 1 1 1 7
7 6 1 1 1 1 15
8 7 1 1 1 0 14
9 8 1 1 0 0 12
10 9 1 1 0 1 13
11 10 1 0 0 1 9
12 11 1 0 0 0 8
13 12 1 0 1 0 10
14 13 1 0 1 1 11
15 14 0 0 1 1 3
16 15 0 0 1 0 2



bc – An arbitrary precision calculator language

Here is how to use bc to convert from one base to another.

bc -l



Here the obase = A is in hex for 10.


Some times I like to have different versions of the Arduino IDE installed. I would also like them not to use the same preferences file and Sketchbook directory.


In the lib/preferences.txt file is hiddien this little piece of cryptic note:

# if you don't want settings to go into "application data" on windows
# and "library" on macosx, set this to the alternate location.

What that is trying to say… as it is not obvious. Is that if I want to store my preferences.txt file in a directory relative to the current IDE… uncomment that line.

This now allows me to keep all settings and sketchbooks relative to the IDE.



I am currently working on a project involving QR codes and a Raspberry Pi.

I have QR codes printed on business card size media. When the card is far enough away for the camera to see the whole code it was out of focus.

Luckily I had some cheap ($1.50) lenses that happen to have a 4.5″ focal length laying around from a previous project.  These worked perfectly for me as the distance from the card to the lens was ~4″. The nice thing about this mod is that it does not require modification of the original raspberry pi camera lens.

Before and After:



These worked perfectly. I am now able to reliably read the QR code using the zbarimg program from the repository.

sudo apt-get install zbar-tools

With this step out of the way I can get back to my project.

mapping in the bc calculator taken from Arduino 
bc -l An arbitrary precision calculator language
define map(x,in_min,in_max,out_min,out_max) { (x-in_min)*(out_max-out_min)/(in_max-in_min)+out_min }
gives 5.097…

I always forget how to make a poster using ghostscript.

the command is ‘poster’

sample usage:

poster -v -mletter -c5% -s1 -o

This will enlarge the original and put crop marks on the resulting pages.


I created a LibreOffice cheat sheet to help me quickly learn and recall the syntax.

It covers some very useful things:


Getting the Sheet

Getting A Cell

Iterate over a range of cells:

Getting Form Elements
Set a Cell to current timestamp

HTTP Method GET call and store data
Reading And Writing A File


Trying out a new category: Snippets

These will be tiny shell scripts or pieces of code.

The first one is how to have linux convert GPS NMEA text files to kml format.


gpsbabel -i NMEA -f $1 -o openoffice -F test.csv
gpsbabel -i openoffice -f ./test.csv -o kml -F test.kml


Im sure there is a better way…but this one works and gives a .csv file as an intermediate.



Next Page »