The popular clock module is uses the DS1307 real time clock chip, which is not very precise. For just a few dollars more, you can get a module with a much more precise DS3231 RTC chip. The one I got was SunFounder's module from Amazon for $9 (free shipping for Prime). It plugs right onto the Raspberry Pi's 40 pin header and doesn't even interfere with the plastic case I have. I have a Model B, but this module should also work on Model A and Model B+. The instructions refer to DS1307, but the chips use the same I2C commands, so it also works for DS3231. I changed some references that appear in 'standard' instruction from ds1307 to ds3231, but you could instead leave them as ds1307 just as well.

To install the module, run the following commands (from SunFounder's instructions). Turns out Amazon's product page also has good comments and perhaps more up-to-date than SunFounder's.

# Comment out the blacklist entry so the module can be loaded on boot 
sudo sed -i 's/blacklist i2c-bcm2708/#blacklist i2c-bcm2708/' /etc/modprobe.d/raspi-blacklist.conf
# Load the module now
sudo modprobe i2c-bcm2708
# Notify Linux of the Dallas RTC device (use -0 for Model A or -1 for Model B)
echo ds3231 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
# Test whether Linux can see our RTC module.
sudo hwclock

You should see a response with what the chip thinks is the date. I think mine said 1999 or some such. No problem.

If your system date is NOT correct (if you don't have an internet connection or something), set the date using ONE of the following commands, with the appropriate date and time, of course:

# Only do ONE of two the below:
sudo dpkg-reconfigure tzdata
sudo date -s "Sep 27 2014 12:46:00"
# Now that your system date is correct, simply use this command to transfer the system date to the chip:
sudo hwclock -w

 

Next, to read the time from the RTC chip and set the system time from it at every boot, open /etc/rc.local and add these two lines above the exit 0 line:

echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -s

We can also disable the ntp daemon and fake-hwclock during boot. 

sudo update-rc.d ntp disable
sudo update-rc.d fake-hwclock disable

That's it. Pretty easy.

 

You can still sync the system time from the internet using...

sudo ntpd -gq
sudo hwclock -w

 

Selecting PHP command line version on HostGator shared host

This took me a while to find, so I'm saving it somewhere I can find it again.

The easy way to select the PHP version used for web applications is to use the CPanel configuration tool. However, that doesn't work if you're using SSH and need PHP on the command line. Also, on HostGator, you can't create a symlink outside of your directory (such as to the global php).

You can find out what version you have with

$ php --version

If that's not the version you want, try a specific version like this (php55 is 5.5, etc):

Book Scanning Process

 

Just to document this for next time. For reference, my books are 8 x 10.75 inches and other dimension below work for this. For approximately 100 pages, It takes me about 45 minutes to scan, an hour to crop and rotate, and 30 minutes to organize and generate the PDF.

Fixing features for hotfolder

Here is some documentation about the process I used to solve some issues with hotfolder and the features module. I was doing this partly through the web interface and partly through a console, so this is a reconstruction of what I remember and the console log. 

 

I was getting the following error message when I tried to check hotfolder watches (see https://www.drupal.org/node/2453659):

Notice: Undefined property: stdClass::$field_watch_config_scheme

 

GIMP for Kids

 

My daughter likes to draw on the computer. I don't remember exactly how it started, but she draws in GIMP using my Genius pen tablet, on my secondary monitor. I used to have Linux running in a VirtualBox with GIMP running on my second monitor for her, but VB doesn't completely work in Windows 10 yet. A while back I tried running GIMP on one of my Raspberry Pi's but it was just too sluggish to be useful, frustratingly slow for a (then) 3-year-old. It runs much better on a Raspberry Pi 2. It still lags if she goes crazy with a big brush, but it works.

Die Fly: Designing a better fly swatter

I was looking through some of my old stuff for something and ran across this gem. If you need to put together a quick flyswatter, try this one I designed for a class in college (the famous Rube Goldberg project).

Here are a few excerpts from the attached PDF. If this doesn't convince you to build one (perhaps with several improvements as noted in the document), I don't know what will.