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;

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.



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.