Blocking China

Tired of seeing Chinese IP addresses in my server logs trying SSH access, I decided to completly block it off.

Easy way todo this? Yup.


cd /home/michael/System\ Scripts/Sineo_IPTABLES_Block/


sed -i 's/INPUT/SINEO/g' /home/michael/System\ Scripts/Sineo_IPTABLES_Block/rc.firewall.sinokorea

sed -i '/iptables -A SINEO -m state --state ESTABLISHED,RELATED -j ACCEPT/d' /home/michael/System\ Scripts/Sineo_IPTABLES_Block/rc.firewall.sinokorea

chmod +x /home/michael/System\ Scripts/Sineo_IPTABLES_Block/rc.firewall.sinokorea

sudo /home/michael/System\ Scripts/Sineo_IPTABLES_Block/rc.firewall.sinokorea

This will download a formatted list of chinese and Korean IP addresses, change the iptables chain to point to a new chain rather than the input chain, remove the now pointless established rule, and install the chain. Obviously, change the file paths to suit your structure.

It will however, require root to install the chain.

Ongoing Back pain

The back pain saga continues. The last week, it’s been almost unbearable. When it starts I can barely get 2 miles before I have to stop and stretch it out.

I’ve played with saddle setback and height, neither seemed to help in any great way. So I’m going to try a change in stem length to see if I’m too cramped on the bike. I’ve ordered a set of 80,100 and 110mm stems to try. Hopefully, an extra 10mm will help.

Currently I’m running a 90mm stem. So maybe that extra reach might put my back in a better line. I do also need to lose some weight, and improve my core.

There was a time where my right leg would get tired quicker than my left, so maybe I’ve started to compensate with out realising for a leg length issue. When I was in speedplay cleats, I had to install a wedge in the shoe to avoid foot pain. So I guess there maybe more issues to work out than just stem length.

But let’s wait and see how a different stem feels and go from there.

Backup, Its Important!

Recently I switched my last computer over to linux, and this meant I had to rethink my backup strategy. I like to copy all important files over to a central area, maybe even to a remote NAS box. In windows this was done via a simple batch file each user ran when they felt like it to copy it to a shared drive on the network. On linux, I can utilise the power of rsync, and do it all from a local terminal. So I cooked up the following bash script.
There are a few dependencies this has, it requires the following:

  1. s3cmd installed and configured to the S3 account
  2. rsync installed on all machines. (Not installed as standard on Debian systems.)
  3. An available drive or NAS box attached.
  4. If passwordless required for connecting to the other boxes, you will need to set up passwordless SSH, which I’ll not cover here, but there are countless other tutorials to cover this.

It can be run from a simple cron job, or manually when required. There are command line options that can be run

  1. -clean
    1. -clean command line will cause rsync to delete any files that are no longer on the source from the archive. It will also remove any files that have been copied, but now excluded from the exclusion file.
  2. -s3
    1. Will cause an upload event and syncronise the Amazon S3 archive with the local. This will not however trigger a local update event
  3. Empty command line
    1. Will simply backup files to the target machine from the sources, this will not clean the archives, nor will it trigger a S3 upload.

So, lets break down the source and have a look.

</p><p>if mountpoint -q $BCK_DEST<br>then<br>echo "Backup Location is mounted"</p><p>if [ -z "$1" ];<br>then<br>echo rsync command is: -$RSYNC_CMD_STD<br>#--------------------------------------------------------------------------------------<br>#Copy To Local Storage<br>echo Backing Up<br>rsync -$RSYNC_CMD_STD -e ssh --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/1<br>echo Backing up $HOSTNAME<br>rsync -$RSYNC_CMD_STD --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/2</p><p>#--------------------------------------------------------------------------------------<br>fi</p><p>

This first section is the overall backup, responsible for copying the source to the target. We initially connect the rsync over to the target via SSH, and copy the entire home folder, minus the excluded files and directories. Its only run, should the command line be empty, the default run if you like. The variable $1 is the first command line option passed to the script. One of the important things we do here, is ensure that the drive is actually mounted in the system. If this is not mounted, everything else will fail.

<br>if [ "$1" = "-clean" ];<br>then<br>echo RSync Clean Command is: -$RSYNC_CMD_STD$RSYNC_CMD_CLEAN<br>echo Backing Up<br>rsync -$RSYNC_CMD_STD$RSYNC_CMD_CLEAN --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/1<br>echo Backing up $HOSTNAME<br>rsync -$RSYNC_CMD_STD$RSYNC_CMD_CLEAN --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/2<br>fi<br>

This section is the clean up. It runs the standard backup, along with the rsync options “–delete-after –delete-excluded” which clean up the archives.

<br>if [ "$1" = "-s3" ];<br>then<br>echo S3 destination is: $S3_BUCKET<br>echo Amazon Upload Proceding<br>s3cmd sync $S3_CMD $BCK_DEST/1 $S3_BUCKET/1<br>exit<br>fi</p><p>

This section is the amazon upload. Its not quite complete,.and there are more directories to add to the upload. However, uploading to amazon, is not the quickest thing in the world, and I’ll add the other important directories as and when the uploads complete.

And here it is, in its entire bash like glory.

<br>#!/bin/bash</p><p>#VARIABLES<br>BCK_DEST=/mnt/sdc1<br>EXCLUDE_FILE=rsync_exclude<br>S3_BUCKET=S3 Bucket<br>RSYNC_CMD_STD=avzh<br>RSYNC_CMD_CLEAN=" --delete-after --delete-excluded"<br>S3_CMD="-rH --skip-existing --delete-removed --acl-private"</p><p>echo backing up systems<br>echo ______________<br>echo Exclude File Path: $EXCLUDE_FILE<br>echo running on: $HOSTNAME<br>echo destibation is: $BCK_DEST<br>echo Command line passed: $1</p><p>#ENSURE DRIVE IS MOUNTED<br>if mountpoint -q $BCK_DEST<br>then<br>echo "Backup Location is mounted"</p><p>if [ -z "$1" ];<br>then<br>echo rsync command is: -$RSYNC_CMD_STD<br>#--------------------------------------------------------------------------------------<br>#Copy To Local Storage<br>echo Backing Up<br>rsync -$RSYNC_CMD_STD --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/1<br>echo Backing up $HOSTNAME<br>rsync -$RSYNC_CMD_STD --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/2</p><p>#--------------------------------------------------------------------------------------<br>fi</p><p>if [ "$1" = "-clean" ];<br>then<br>echo RSync Clean Command is: -$RSYNC_CMD_STD$RSYNC_CMD_CLEAN<br>echo Backing Up 1<br>rsync -$RSYNC_CMD_STD$RSYNC_CMD_CLEAN --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/1<br>echo Backing up $HOSTNAME<br>rsync -$RSYNC_CMD_STD$RSYNC_CMD_CLEAN --exclude-from $EXCLUDE_FILE REMOTE SYSTEM $BCK_DEST/2<br>fi</p><p>if [ "$1" = "-s3" ];<br>then<br>echo S3 destination is: $S3_BUCKET<br>echo Amazon Upload Proceding<br>s3cmd sync $S3_CMD $BCK_DEST/1 $S3_BUCKET/1<br>exit<br>fi</p><p>else<br>echo "Backup Location is not mounted"<br>exit<br>fi<br>

Hope you find this useful, and if you have any ideas how to improve it, let me know.


You know it’s bloody cold when you notice icicles hanging on your walk home from work.

The wind was lethal. It was cutting right through. I only hope we have seen the last of the cold eastern weather, as it’s stopping a lot of riding..

Pedals make the man

For a long time I’ve been an avid speed play user,but my love affair with then has slowly wained. There are a few reasons for this.


First off, maintenance. Speed play pedals are quite maintenance heavy in keeping the cleats clean and lubricated, to lubricate the pedal bodies with grease. This isn’t a major issue, but one that started to bug me as I started to lose interest. Interestingly, the maintenance issue showed the wear on the pedal bodies with grease leaking out from wear points.

I also found myself having to constantly clean out the cleats, as they would very easily clog up.

Now we move on to one of the biggest issues, cost. A pair of speed play cleats is just shy of £50, for the walk able cleats. That’s a lot of cash. While the cleats do last a long time, it’s still a outlay I have to cut back on. With the Yellow Shimano cleats costing around £12, less if you shop about its a cost winner.


So, out came the pedal wrench, and off come the speed plays. I had a pair of unused R550’s kicking around in the parts bin so put them on. I had previously tried a pair of look keo’s and absolutely hated them, they where, in part, my reason to move into speedplay so my thoughts on going back to SL pedals where grim.

However, the first ride with the R550’s where an absolute revelation. They where comfortable, I was clipping in reasonably easily. In fact, I’d say I was finding them more comfortable than the speedplay. Maybe due to the wider platform, which to me was immediately noticeable. I’d used an older pair of shoes with out any inserts or special foot-beds, and I’d not thought about my feet for a short 10 mile ride. Clipping in was easier, maybe as I had got used to the action of finding the pedal on the opposite down stroke, or the fact the pedal is larger than the Look Keo. Unclipping took more force than the speedplay, possibly due to newer mechanisms. I had put on the cleats, on a reasonably neutral position, and it was comfortable without any tweaks, I felt like I wanted to slightly rotate the cleat, but the position was fine as was. This was in stark contrast to the Look Keo cleats, which made my knees ache. Perhaps it was due to having more knowledge of cleat position than when I had the Keos, but that has always stuck in my mind and has forever ruled out the Keos again.

So, apart from hill starts which I still find quite difficult, I actually enjoyed using the new pedals, and in all honesty will strongly consider them to replace the speedplay.