May 232013
 

Open the Chrome Settings page, then go to the Search section and click “Manage search engines”.

In the “Other search engines” section, click in the empty “Add a new search engine” text box and fill in the following (no quotes):

  1. Give it the name “DuckDuckGo”.
  2. Enter “duckduckgo.com” as the Keyword.
  3. Enter “https://duckduckgo.com/?q=%s” as the URL.

Click “Done”.

(These instructions also work for Chromium.)

 Posted by at 9:14 am
Jan 312013
 

Handy when you have multiple XTerms open, and need to keep track of where you are when you switch between them.

Edit your .profile (or .bashrc, as the case may be):

vi .profile

Add this if you want to show symbolic directory links in relative form:

case $TERM in
xterm*|rxvt)
PROMPT_COMMAND='echo -ne "\033]0;${USER} ${HOSTNAME}: ${PWD}\007"'
;;
esac

If you’d prefer to see the physical path of a symbolic link, use this instead:

case $TERM in
xterm*|rxvt)
PROMPT_COMMAND='echo -ne "\033]0;${USER} ${HOSTNAME}: $( pwd -P )\007"'
;;
esac

For example, given the following symbolic link:

data -> /cygdrive/c/data

The first version will display it like this:

[user] [host]: ~/[user]/data

…and the second version will display it like this:

[user] [host]: /cygdrive/c/data

 

 Posted by at 10:19 am
Jan 202013
 

It will take a minute to configure Google Docs as an uptime monitor for your website.

  1. Assuming that you are signed-in to your Google Account, click here to make a copy of the Google Docs sheet.
  2. Put your website’s URL in cell E3 and your email address in cell E5. This is the address where you wish to receive notifications for downtime and uptime.
  3. Go to Tools – > Script Editor – > Resources – > Current Script’s Triggers and set a Time-Driven trigger for every minute (or 5 minutes).
  4. Save the Trigger and Google Docs will show a big red warning asking for authorization. Just accept it and Save the trigger again.

That’s it. The Google Docs sheet will monitor your website in the background at all times and will send an email alert whenever it has trouble accessing the website. If the issue is resolved, you’ll get another notification saying “all’s well.”

Also, the downtime details (including the server responses) are logged in the Google Docs sheet itself so you can later analyze the downtime in greater detail. You can browse the source code to understand how monitoring works behind the scenes.

(Taken from here.)

 Posted by at 8:55 am
Dec 042012
 

(NOTE: This assumes that you’re using GRUB.)

sudo vi /etc/default/grub

Change these lines:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="text"

to:

# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="text"

Save the file, then:

sudo update-grub
 
sudo reboot

When you’re ready to go back to booting into graphical mode, just follow these steps again, but uncomment the “quiet splash” line.

 Posted by at 8:26 am
Aug 152012
 

If you have more than one version of Java installed in Linux, you may need to modify the default version.  You can display the installed versions, and optionally modify the default, by invoking the following in a terminal session:

sudo update-alternatives --config java

 

 Posted by at 9:15 pm
Jul 052012
 

Adblock Plus is a very useful extension, but it has the unfortunate side-effect of disabling the automatic package-tracking links that appear next to a message containing tracking numbers in Gmail.  The good news is that it requires only a small change to a single rule in Adblock to bring the tracking links back:

  1. Open the Adblock Plus Preferences.  (Add-Ons, click the Preferences button for Adblock Plus)
  2. Click the “Filter preferences” button.
  3. If the filter list isn’t displayed, click the “Actions” dropdown and click “Show/hide filters”.
  4. Click the “Find” button.
  5. Search for this text: &view=ad
  6. Disable the rule.

 

 Posted by at 8:39 am
May 272012
 

The default look-and-feel for the NetBeans IDE does not render optimally in newer versions of Gnome (borders do not display on menus).  The Nimbus look-and-feel looks nicer.  If you’d like to automatically start NetBeans with Nimbus, use the following on the command line:

/bin/sh "/path/to/netbeans/bin/netbeans" --laf Nimbus

 

 Posted by at 6:49 pm
May 152012
 

Getting a basic development environment for the Arduino Uno up and running in Linux is quite straightforward:

  1. Open up Synaptic and install the “arduino” package.  This will also install “arduino-core” and other dependencies.
  2. Grab your arduino, a breadboard, some wires, a resistor, and an LED, and wire up a quick test.  (I used the CIRC-01 project from the Sparkfun Inventor’s Kit guide) :
  3. Connect the Arduino USB cable to your PC, then plug in the Arduino board.
  4. Start up the Arduino IDE.
  5. Go to “Tools”, “Board”, and make sure “Arduino Uno” is selected.
  6. Go to “Tools”, “Serial Port” and select the port that your Arduino board is using.
  7. Go to “File”, “Examples”, “Basics” and click “Blink”.  This will load a very simple bit of code that will cause the LED you wired up to blink on and off.
  8. Click the “Upload” button.  If all is well, then the LED on the breadboard should start blinking.

 

 Posted by at 8:08 pm
Feb 262012
 

For several years, I’ve kept a duplicate copy of my important files on a secondary hard drive.  I’d been using a crude “purge-re-copy” script to do this, and it was, obviously, extremely slow for anything but a small number of files.  So, I kept my backups small.  I wasn’t really happy with this, since I would have preferred to keep a synchronized copy of all of my files.

I dabbled with writing a utility to do the copying, something that would only copy the changed files, but the complexity kept stopping me.  Then I discovered that such a utility already exists.

Rsync is a command-line utility that synchronizes sets of directories and files between file systems.  It was written primarily for remote file copying, but it works really well for local file copies too.

Here’s an example, showing how I use it for backups:

rsync -lrt --delete /home/jimc/Documents /media/HD2/fullsync

When you issue this command, you end up with a synchronized copy of the Documents folder on HD2 (HD2 is the target, /home/jimc/Document is the source/working copy).  The target path ends up being /media/HD2/fullsync/Documents.

The command line arguments are as follows:

  • -l   copy symlinks as symlinks
  • -r   recurse into directories
  • -t   preserve modification times
  • –delete   delete extraneous files from destination directories (this ensures that when you delete a file in your source directory, it doesn’t hang around in your target directory)

There are plenty of additional command line arguments, but these are just the ones I use for my needs.

I’ve also created a Python script to simplify the backup process.  You can download a copy here.  (Look for “FullSync”.)

I use rsync in Linux, but there are various implementations available for Windows.  You can find a list in the rsync Wikipedia entry here.  If you want to use rsync in Windows, I’d personally recommend installing Cygwin.  It will give you rsync, and also a lot of other really useful utilities.

 Posted by at 1:01 pm