Skip to content

Midnight Commander on Mac

To install on Mac:

curl http://rudix.googlecode.com/hg/Ports/rudix/rudix.py | sudo python - install rudix

And then

sudo rudix install mc

Thanks Dmitry.

Making Special Offers useful

I was wondering if I could use the infrastructure behind the Kindle Paperwhite Special Offers for something useful, something good, something that doesn’t involve serving advertisements. And I think I’ve figured it out🙂

To begin with, it’s simple enough to remove the advertisements, but then I’m still stuck with this error message on the Home page

“Please ensure your Kindle is registered and connect wirelessly to receive the latest Special Offers”

In my view, that is just a waste of screen space, and it really bothers me to see it every time. As I was thinking about it, I thought of another thing I wanted for my Kindle – some kind of note in case it was lost, so that whoever found the Kindle would have the details to return it back to me.

So, how about making my own Special Offer, replacing the text and the images with my own content, and placing a nice note for the finder of my lost Kindle in the banner area on the Home page? Turns out, this is very possible, and actually looks great when implemented.

Here’s what’s required to achieve it:

  1. Jailbreak the Kindle, and ssh into it (Kindle IP 192.168.15.244)
  2. Edit /var/local/adunits/admgr.json, and keep only a single ad entry (Here’s a nice JSON parser to make sense of it all)
  3. Use scp to download the advertisement assets in /mnt/base-us/system/.assets/XXXXxxxxXXXXx (whatever the number of the remaining ad is)
  4. Change the images to custom slides, using the same size files. It’s helpful to open the old files, and then paste new content into them
  5. Stop the framework (“stop framework”)
  6. Upload new images, and details.html file (if you like to have a custom message when the banner.gif is clicked on)
  7. Calculate new MD5 sums of the images (“md5sum *” inside the asset folder, and don’t forget details.html if you changed it too)
  8. Update admgr.json with the new MD5 sums
  9. Update admgr.json to add a 0 onto the end of X and Y coordinates to remove ability to click on ads (so that they are offscreen, ie. x=321 turns into x=3210)
  10. Make sure all uploaded files have aug+r permissions (“chmod aug+r *.*” inside assets folder and inside adunits folder)
  11. Start the framework (“start framework”)
  12. Voila, a custom screensaver and advertisements are on the Kindle!

So there it is. When all the steps are correctly followed, the new images and text are substituted in, and the Kindle displays both an attractive new screensaver, and a nice message urging whoever found it to return it. I like it much more than the annoying error message, or the even more annoying Special Offers.

PS: Don’t forget to turn on Airplane mode so that the Kindle doesn’t gain new advertisement content, and use Calibre to load books onto it.

No-ads on Kindle Paperwhite

Here’s how to remove the ads from a Kindle Paperwhite (firmware 5.3.4) in 5 easy steps.

1. Jailbreak the Kindle

Jailbreak: kpw_jb.zip

Kindlet-Jailbreak: kindlet-jailbreak-20121029.zip

Install Network Utilities: kindle-usbnet-0.7.N.zip

Set root password: Search box, type “;un password PASSWORD”

2. Run networking

Unplug Kindle from Mac

Search box, type “;un”

Plug Kindle into Mac, it should appear as a network device

3. On the Mac

Find the last network interface from the list: ifconfig | egrep -o “^[[:alnum:]]+”

Configure interface: sudo ifconfig INTERFACE 192.168.15.201

Connect to Kindle: ssh root@192.168.15.244

4. On the Kindle

mntroot rw

cd /var/local

ls adunits

stop framework

mv adunits adunits.bak

touch adunits

chmod 000 adunits

start framework

exit

5. Stop networking

Unplug Kindle from Mac

Search box, type “;un”

Plug Kindle into Mac, it should appear as “USB Drive Mode”

Optional: Turn off Wifi, and load books and software updates via Calibre

Karma bites back

A quick update on my earlier post about a magic stick used to find bombs. The guy who made them and peddled the devices to militaries and governments is now on trial for fraud. I called this … 4 years ago. Karma bites back.

How to make a watch

How hard would it be to make my own watch, using off-the-shelf components and some custom coding?

IMG_0836

I often travel across the country, and in the last few years I have iterated through a substantial number of watches that try to make travel easier by keeping track of multiple timezones. The more expensive watches kept breaking (I’m looking at you, low quality Tissot leather straps), and so far the best I’ve found is a cheap Casio retro 80’s calculator watch. You can see two timezones at the same time, and the watch has a nice backlight to use in the dark. The calculator keypad nicely adds geek cred to the look, and I like it.

But, I think I can make a better watch myself. How hard could it be?

STEP 1: Find a suitable micro-computer to use as a watch

After looking at a bunch of interesting watch-platforms, I have decided to use a $30 Sandisk Sansa Clip+ MP3 player as the basis for the watch. Firstly, it’s small enough to fit on my wrist. Secondly (and most important of all) it supports the open source Rockbox firmware, so I can easily develop my watch application. Finally, it looks nice, and has a bright two-color OLED display that I can use to show multiple timezones on the same screen. The iPod Nano also looked good as a possible platform, but it doesn’t support custom firmware and there is no way to keep the screen lit up all the time. I doubt there’s a Jailbreak for the Nano, so lets go with the Sansa.

9448449_sb

Step 2: Find a suitable wrist strap for the new watch

OK so now I have to find a way to attach this little gem to my wrist. Something light, comfortable and not too expensive – and this strap from STAMP watches fits the bill just right. It’s an ideal fit for the Sansa player, which I can attach to the strap using the clip on the back of the device. The strap was $20 at Macy’s, and as a bonus, you can pick one in any color you like (I went with black).

STAMPS strap

Step 3: Prepare the software to power the watch

This is a simple customization job, as much of the work has already been done by the fine team behind Rockbox. However, there isn’t a multi-time-zone app in the default Rockbox installation, so I will need to write it myself. But first things first – I need to install the Rockbox development environment on Mac OS Mountain Lion. Here’s my step-by-step guide:

  1. Install GIT on Mac OS. GIT is a tool to download the source code for Rockbox, amongst other things.
  2. Download the Rockbox source code using GIT. This is about 50Mb in size and shouldn’t take long.
  3. Install the GCC compiler. You will need a free Apple Developer account to download the toolkit, but you don’t need the entire XCode – just the command line tools.
  4. Install the AutoMake and AutoConf scripts. I copy/pasted the command line commands from that page and everything worked well.
  5. In the tools folder of the Rockbox source code, run “sudo ./rockboxdev.sh” script and watch the build magic take place. Make sure to select the “a” option during configuration to specify the ARM kernel for the Sansa device.

Rockbox compilation

Success! Now the source code is ready to compile into a binary format ready for the Sansa Clip+. Here’s another quick guide:

  1. In the Rockbox source folder, create a build folder “mkdir build;cd build”
  2. Run the configure scripts “../tools/configure” and select “62” as the option for devide (Sansa Clip+) and “N” for Normal build.
  3. All configured? Run the make scripts .. “make” and watch the compiler output scroll by.
  4. Finally, run “make fullzip” to get the install image for the device.

With all this done, I have the software image to install Rockbox on the Sansa Clip+. Yes, there is of course a quicker way of getting the default build onto the device, but since I will be modifying the source code, it’s essential to have the development environment set up first.

Step 4: Write my own clock app with support for multiple time zones

The Sansa Clip+ display supports two colors, a row in orange at the top, and a row in blue at the bottom. This dovetails nicely into my requirement to have dual timezone displays on the watch. However, I don’t need to write my app from scratch – in fact, it’s much simpler to modify the existing Clock app and make it look the way I want it on the Clip+ screen.

The source files for the Clock app are in the “rockbox/apps/plugins/clock”, and the source file I’m looking for is “clock_draw_digital.c”. There are three modes of display for the clock (Analog, Digital, Binary) and I’ll start modifying Digital first (I’ll get to the Binary mode later). It’s fairly easy to read the code (thanks to original developer Kévin Ferrare) and the changes didn’t take up much time.

A quick shortcut to compile and install the code onto the device in one command line, and set Clock to auto-run (your folder structure may vary)

make -j; make zip; rm -R /Volumes/SANSA\ 4GB/.rockbox; unzip ~/Desktop/tmp/rockbox/rockbox/build/rockbox.zip -d /Volumes/SANSA\ 4GB/; cp /Volumes/SANSA\ 4GB/.rockbox/rocks/apps/clock.rock /Volumes/SANSA\ 4GB/.rockbox/rocks/apps/autostart.rock; diskutil unmount /Volumes/SANSA\ 4GB

Download the improved source code, with added support for multiple time zones, here.

Step 5: Putting it all together

Actually, this is the simplest step here. After updating the source code for the Clock app, re-build the code (“../tools/configure; make; make fullzip”) and deploy the finished version to the device. I find that it helps to set the screen in “never-dim” mode so that it always stays on, and add the Clock app to the auto-start (define #AUTOROCK# in main.c and copy the compiled clock.rock to ./rockbox/rocks/apps/autostart.rock) so that it starts every time the watch is powered on.

The battery in the Sansa Clip+ works for a good 16-18 hours with the display on at full brightness, which suits me just fine for a full day of wear. I’m quite pleased with the final results, it looks great, the screen is easy to read in any lighting condition (even in bright sunlight) and it helps me easily keep track of two timezones.

Finished watch

Hurray! The watch works, and I’m very happy with it. It charges via USB, has a built-in music player (and a micro-SD card slot for music) and fits well on my wrist. As an added bonus, I have changed the Binary display mode so that the rows of dots are nicely aligned on the Sansa screen, as you can see on the image above, the top row of dots is orange (hours) and the bottom two rows (minutes, seconds) are blue. It takes a couple of days to natively read the binary display, but it’s a nice conversation starter and well worth doing.

Last but not least, consider putting a touch of Gorilla glue (or superglue) on the clip that attaches to the strap, to lock in in the closed position. The strap will thread through perfectly, and the clip won’t accidentally open when the watch accidentally catches on something. Enjoy the finished results!

Ethernet to 3G wireless

I wanted to connect a wireless router with a 3G modem to have an Ethernet–>3G adapter, letting me plug a normal network cable into a router that automatically connected to mobile internet. OpenWRT is a nice embedded OS I could customize for the Asus wl-500g router, and I could link a Huawei E1552 wireless 3G modem with it. This is a reliable hardware combination for both relatively small size and good performance in a noisy wireless environment. Read more…

A delicious rack of lamb

Urgent, from San Francisco to New Zealand – we are eating your lamb here!

Read more…