Finding the most recently modified files with find

Posted on Tue 19 October 2010 in misc • Tagged with find

I recently needed to check that no files had been modified since I last made an archive of a certain directory. Here's a good one for getting a list of files by last modified date, newest at the top.

find . -type f -printf "%TY-%Tm-%Td %TT %pn\\n" | sort …


Continue reading

ctrl-a and ctrl-b not working in tmux on RHEL 5.5

Posted on Tue 24 August 2010 in misc • Tagged with RHEL, tmux

Rather than moving to the beginning of a line and the end of a line, ctrl-a and ctrl-b were just print ^A and ^B to the screen. Not sure why, I don't really have time to investigate, but this seems to fix the issue when run within the tmux session …


Continue reading

MySQL Grants grant and revoke

Posted on Wed 18 August 2010 in misc • Tagged with mysql

I'm not really a fan of MySQL but here is a simple problem I always forget the syntax for which is really a SQL issue.

An installation of MediaWiki has an update script which requires the DROP privilege on the database, so I wanted to add the DROP privilege, run …


Continue reading

Simple SSH Tunneling

Posted on Tue 20 July 2010 in misc • Tagged with ssh

Today I had a problem where the office firewall would not let out traffic to the fibs.com server on port 4321 (Shame on them!)

Luckerly a remote machine comes in handy. I then just tell my Fibs client to connect on localhost port 4444

ssh -f -L 4444:fibs …


Continue reading

In-place file editing with sed

Posted on Wed 17 March 2010 in misc • Tagged with sed

This took me a while to work out why this would not work. When using the -i option with sed you need to specify a backup extension to be used (at least on my 10.5 mac you do!)

e.g.

sed -i '' -e 's/something/something else/g' -e …


Continue reading

Nested List Comprehension

Posted on Mon 04 January 2010 in misc • Tagged with Python

I never really feel like i'm any good at using Python unless I am doing cool things with List Comprehension.

Here's a quick example of nested list comprehension I used today to create a new list from a list containing lists of three items

Visually:-

[['mostly cloudy (day)', 'cloudy3.png …

Continue reading

Sharing media for Xbox360 on Linux/Mac

Posted on Fri 04 December 2009 in misc • Tagged with xbox

Ok, so you can't use samba with Xbox360 and there is no-way I am gonna use Windows. Luckerly, after some dedicated google-ing I came across 2 solutions, both of which did work, but at present the uShare seems to be the tidiest.

http://netou.co.uk/?p=28 Tested on …


Continue reading

Xbox Live Firewall Rules

Posted on Tue 10 November 2009 in misc • Tagged with xbox

A google for xbox live firewall ports never gave me specific ports requirements so here they are as I have discovered them.

Inbound

(A Nat based router/firewall these will need direct port forwarding. On my Juniper I set up a VIP.)

88 UDP

3074 UDP

3074 TCP

Outbound

(I …


Continue reading

A Question Of Python Style

Posted on Sun 11 October 2009 in misc • Tagged with python

Having ended up almost solely with Python at the end of a journey of many languages I have learnt and used; style has been something important to me.

Python has pep8 which states something's definitively such as:-

  • Use 4 spaces per indentation level" (I was actually using 2 until now …

Continue reading

Python function args

Posted on Tue 29 September 2009 in misc • Tagged with Python

I rarely use anything beyond named parameters, but this post captures what you need to know.

http://kbyanc.blogspot.com/2007/07/python-aggregating-function-arguments.html


Continue reading