Thursday, 31 August 2006

ASCII character conversion

The ord command can be used after a fashion to convert from a character to its character code:

 echo -ne "A" | od -t u1 | sed -e "s/^[0-9]* *//"

But more awkward is converting from a decimal character code back to the character, but this does the trick, and took about 3 minutes to come up with:

$ X=65 $ HEX=(0 1 2 3 4 5 6 7 8 9 a b c d e f) $ echo -e "x${HEX[$(( $X / 16))]}${HEX[$(( $X % 16 ))]}"

It works by converting which is less than 255 to hexadecimal, and then making use of echo -e which interprets \x as indicating an 8 bit character expressed in hexadecimal.

Tuesday, 1 August 2006

Online Textbooks


Like many geeks I collect knowledge so that I will be able to do things if the need comes up, whatever things they are. Here’s a good list of refererences books supplied by nTensify who wrote:

There are a lot of free textbooks out there, some of them are better than others, but a lot are quickly becoming very good.

Plain and simple, everyone should have access to education, money shouldn’t dictate how educated someone can become.

Some other free books:
http://www.physicsforfree.com/ (three physics books from beginning physics to general relativity).
http://www.lightandmatter.com/area1.html (six physics books, variety of topics)
http://www.motionmountain.net/ (notably one of the best free physics books ever "published").
http://www.math.wisc.edu/~keisler/calc.html (intro to calc book under Creative Commons)
http://www.allaboutcircuits.com/ (a really cool free circuit design book I ran across a few years ago when I was leaving college).
http://www.gutenberg.org/ (obligatory gutenburg link, aggrigator of books out of copyright or otherwise set free).

(there are plenty more, but to spare you the boredom of a huge list here… go to google and search for digital library books, you’ll have a few million hits to look through ;) )