Using Percona Toolkit on a remote MySQL server via SSH tunnel

The easiest way to install Percona Toolkit on MacOS is via brew:

brew install percona-toolkit

Create an SSH Tunnel to the MySQL database server, assigning it to local port 3307 (this could however be any unused port):

ssh -fNg -L 3307:127.0.0.1:3306 <user>@<dbserver>

Test the MySQL connection via the newly created SSH tunnel:

mysql -h 127.0.0.1 -P 3307 -u<user> -p

In order to remove the SSH Tunnel, find the process running with port 3307 (or which ever port you used during the tunnel creation):

ps aux | grep ssh

Now attempt to kill the process:

kill <id>

If this doesn’t work, and only as a last resort, use the -9 flag:

kill -9 <id>

Prevent WordPress TinyMCE Editor removing Font Awesome tags

Having recently built a custom WordPress theme making use of the icon font Font Awesome, I came across an issue where the icon tag would be stripped from the TinyMCE editor.

Using the standard markup provided on the Font Awesome pages (Gamepad), the tag would be removed when alternating between Text and Visual editing mode.

fa-gamepad
<i class="fa fa-gamepad"> fa-gamepad

Continue reading “Prevent WordPress TinyMCE Editor removing Font Awesome tags”

How to import an SSH Key into Prompt for iPad via iTunes file transfer

The following steps explain how to set up your SSH Key with the Prompt SSH Client for iOS by Panic using iTunes to transfer the SSH Key file. This is a continuation of the previous post regarding the process of setting up SSH Keys within Diet Coda using the copy and paste import method.

Both the file transfer and copy / paste methods can be used in either application (Diet Coda or Prompt) and although some steps will vary in terms of how they look, the general process is very much the same.

Continue reading “How to import an SSH Key into Prompt for iPad via iTunes file transfer”

How to import an SSH Key into Diet Coda for iPad using copy and paste

Panic recently released their new Diet Coda application for iPad, a syntax highlighted remote editing tool with integrated command line support – as seen in their Prompt application – which can be used on both the iPad and iPhone.

To access your server via SSH / SFTP you will need to import your private SSH Key, which can be done in two different ways. The following process takes you through the copy and paste import method as prior to version 1.0.3 there was a bug preventing you from transferring the files via iTunes. Continue reading “How to import an SSH Key into Diet Coda for iPad using copy and paste”

UNIX Count total number of lines in all files recursively

Recently I have been working on a fairly large product alongside one other developer and out of interest was keen to discover roughly how many lines of code we had written between us.

The following snippets use the wc command and can be run on the command line to output the total number of new line characters present in all files within a directory recursively.

wc -l `find /path/to/directory/ -type f`

Continue reading “UNIX Count total number of lines in all files recursively”

Helping email get through to Hotmail / live accounts

I’ve been having a few issues reported to me regarding the sending of email through a web based email form to numerous Windows Live Hotmail accounts.

At first I assumed that they were simply getting marked as Junk until told this was not the case, so signed up for a new Hotmail account of my own to test with and found out they weren’t getting through at all. Continue reading “Helping email get through to Hotmail / live accounts”