Generate some easy to remember passwords

Do not use this for sending sensitive data! For that please use a public key encryption scheme like PGP or GnuPG. This below is suitable for things such as online logins etc.

Obtain word list

Prepare a text file with dictionary words. Here we download some word lists from Scowl.

wget "" && \
tar -zxvf scowl-2016.01.19.tar.gz --wildcards --strip-components=2 scowl-2016.01.19/final/english-words.*

We grab the file english-words.10 and english-words.20 which contain a lot of popular words, filter it and remove the words we don’t want. There are other files here too which you can use as well, though they may contain less commonly used words which may be more difficult to remember.

To make a word list from english-words.10 and english-words.20 with 5 chars or more

cat english-words.10 english-words.20 | grep -v "'" | grep -e "....." | uniq | xz -9 -e > words.txt.xz

On Mac OSX, you’ll need to set LANG=C otherwise you’ll get a charset error with uniq.

Count the number of words in the list. For my current test, there is 9481 words.

xz -dc words.txt.xz | wc -l

Generate a 4 word password

Let’s random sort and create a password with 4 words. We’ll capitalise the first letter as well.

On Mac OSX, install coreutils and gnu-sed on Homebrew.


xz -dc words.txt.xz | sort -R | head -n 4 | sed 's/^\(.\)/\U\1/' | tr -d '\n'


xz -dc words.txt.xz | gsort -R | head -n 4 | gsed 's/^\(.\)/\U\1/' | tr -d '\n'

Make 10 random 4 word passwords

The above command repeated 10 times.


for i in {0..9}; do xz -dc words.txt.xz | sort -R | head -n 4 | sed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

Generate 10 random 3 word passwords

Make 10 random 3 word passwords


for i in {0..9}; do xz -dc words.txt.xz | sort -R | head -n 3 | sed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done


for i in {0..9}; do xz -dc words.txt.xz | gsort -R | head -n 3 | gsed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

Shutter Actuation Count using gPhoto2

This method can be used to obtain the shutter actuation count on the following cameras:

  • Canon 1D Mark II
  • Canon 50D
  • Canon 5D Mark II
  • Canon 5D Mark III
  • Canon 7D
  • Canon T2i

There may be a few other compatible cameras too. Let me know if you have confirmed another model which works using this method.

Jump to instructions for: Mac | Linux | Windows

Mac OS X

gPhoto2 can be installed using MacPorts or Homebrew. This is how to do it using MacPorts. You’ll need to be connected to the internet while you do this.

  1. Install XCode Developer Tools for your version of OS X from the Apple Developer web site. Skip this if you already have it installed.
  2. Visit the MacPorts web site and download the .pkg installer. Run the installer and follow the instructions and install it to your computer.
  3. Open the Terminal.
  4. Update macports if needed, by running the command sudo port -v selfupdate
  5. Install the gphoto2 package by running the command sudo port install gphoto2
  6. Test whether gphoto2 is properly installed by typing gphoto2 --version
  7. Connect your camera to the USB port, using a USB cable
  8. Wait a few seconds after connecting your camera, and type killall PTPCamera – every time you replug your camera to the computer, you’ll need to type this before using gphoto2. This is needed, to kill any running processes connected to the USB device.
  9. To check the number of actuations, on the attached camera, type gphoto2 --get-config /main/status/shuttercounter
  10. If your camera is compatible, the shutter actuation count will be displayed.


Install gPhoto2 using package manager of our distribution.

For Centos, RHEL and other distributions which use the yum package manager:

yum install gphoto2

For Debian, Ubuntu and other distributions which use the apt package manager:

apt-get install gphoto2

Some Linux distributions may not have gphoto2 as precompiled package in which case you’ll need to download and compile it from source.


Using a LiveCD

This is the simplest way for non tech heads. Download the live CD, I have created and write it to a CD or DVD. You can do this by right clicking on the ISO file in Windows Explorer and selecting “Burn disc image”.

Reboot your computer boot from the CD. To boot your computer from a CD, there is usually key you can press to change the boot device (e.g F12). This usually flashes up on the monitor when it boots up.

Alternatively, you can enter the BIOS settings and change the boot order, and set the CD/DVD drive as the first device.

Once you have rebooted, it should start up in Debian (on the live CD), and a command prompt will be shown along with a message.

live_cdPlug the camera into the computer using a USB cord, some messages may be displayed on scren as you do this. You can check whether the computer has detected the camera by typing dmesg.

To check shutter count, type shuttercounter, to read camera information, you can type camerainfo, this will display information such as the camera’s serial number. These commands shortcuts to the gphoto2 program. You can also run all other gphoto2 commands if needed. See the full features by typing man gphoto2.

Using a Virtual Machine

If you have experience using virtualisation software such as Virtualbox or VMWare Workstation, then another way is to install or use an existing virtual Linux installation of your choice. Install gphoto2 from inside the virtual machine.

Moving WordPress blog across domains using the shell

Here’s a rundown, or more accurately a set of personal notes I made, for moving a WordPress blog from one domain name to another. This will also work when moving from one web host to another.

First you’ll need to know some details of your old database:

  • database host name, e.g or localhost
  • database name
  • username
  • password

You can find these details in wp-config.php on the old WordPress site.

Create a new database on the new web host, and an appropriate user account which can be used to manage the database. You may need to do this in a web interface, e.g cPanel, as some web hosting companies only allow database creation and deletion via a web interface. Make note of these details of the new database, you’ll need these new details for the new site.

We’ll assume here that on your web host, web served files are stored in a subdirectory named the same as the domain name.

Old Blog

Save WordPress files from the old blog to blog_old.tar.gz:

tar -zcvf blog_old.tar.gz -C OLDDOMAIN.COM .

Save the old database to blog_db_old.sql. Use the details from the old database here.

mysqldump -uUSERNAME -p -h DBSERVER DBNAME --quick > blog_db_old.sql

Check the database dump is okay, we’ll just read the first couple of lines just to make sure all is well.

head blog_db_old.sql

New blog

Now we get to work on the new site. First up the archive of the WordPress files and database dump, move those onto the new server if required.

Write to new database and WordPress directory

Import the dumped SQL file from the old database, into the new database. You’ll need to type in here the details of the new database that was just created, and use a appropriate path to the archive files (the .tar.gz and .sql files).

mysql -h DB_SERVER -uUSERNAME -p DB_NAME < blog_db_old.sql

Extract contents of WordPress install into the new domain.

tar xvf blog_old.tar.gz -C NEWDOMAIN.COM/

Edit wp-config.php and enter in the new database details.

vim wp-config.php

Search and replace operation on database

The database still references the old domain in its URLs. So we need to replace the domain name and URLs in database. There is a PHP script by interconnectit you can use, as a search and replace tool.

Download this handy database search and replace tool, unzip the single PHP file, and rename it:

mv searchreplacedb2.php sr.php

Visit your new domain http://NEWDOMAIN.COM/sr.php to run the search and replace script.

  1. Select script to obtain database parameters from wp-config.php. Use this option, only if you have already edited wp-config.php on the new site with the new database details.
  2. Select all tables to perform the search and replace in.
  3. Type your search and replace parameters. Search for your old URLs and replace with your new URL. Take note of www. at the start of addresses. Some sites use it and some don’t (normally set in cPanel or equivalent interface). For example when I was moving sites from my old domain to this one, I searched for and replace it with
  4. Check your web site on the new domain and check all is working fine.

Remove the search and replace script once completed. Don’t leave this script on your web site.

rm sr.php

Alternate method

As an alternate method to using the above PHP script, we could have performed a search and replace on the SQL dump file, or peformed some search and replace commands directly on the databse using SQL queries.

Test web site

After performing the search and replace, the new site should work as normal. All media and user accounts should be as before. Visit your new site and check that it is all working fine.

Redirect the old domain

Once we know the new domain is working okay, we can remove the old files (remember you still backups from earlier). Make sure you’re in the right directory before doing the mass delete!

rm -rf *

Set up a .htaccess file for the old domain.

touch .htaccess
vim .htaccess

Insert the following but replace with your site domain names:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Test the redirection, by visiting an old URL, your browser should automatically redirect to the new domain name. This will redirect all pages. Search engines crawling your site should recognise this 301 redirect code, and update its indexes appropriately.

Finishing up

You can now delete the old database as well. This can be done via cPanel or similar web host interface, if that is the only method your web host allows.

Copy your old site archive (.tar.gz) and database dump (.sql) somewhere for safekeeping.

If you were using Google Analytics, remember to go and change the settings in there, you are able to change the site name and URL for a Google Analytics account / property. Also fix any linking with Google Webmaster Tools.