Clean Up File Names Via Python


Today I would like to share a tiny script that I use to tidy my folders. As an example, I am generally not interested in the year the film was made e.g. BladeRunner(1982) and prefer it listed as BladeRunner in my films directory. This script will do just that, modify the file names of files, without changing the internal contents. Here is an example of the script in action:

python_rename_CK That definitely looks better, to me at least. Here’s a run-down of what just happened and how:

  1. ls – displays the basic (non-hidden) contents of a folder
  2. python && ls – This runs the python script on the folder it is placed in. For me, it was my working folder i.e. ~/Documents/…/brackets_backup then it uses && to run multiple command on line line, followed by ls to view the results
  3. Results displayed

The python script can be found here:

Future Plans:

  • Add a recursive modifier, so that it is able to go inside various sub-folders and continue the good work
  • Rewrite in C for fun
  • Make good use of the script via ssh

Body Dysmorphia

Dody Dysmorphia

As someone training for strength and loosely following the Starting Strength routine (which doesn’t involve a lot of arm isolation exercises, but the triceps, shoulders and biceps all do get heavily worked via the compound exercises), I haven’t really made the conscious effort to focus on arm size. In-fact, I often see guys at the gym hammering curls for hours on end and wonder to myself if I should change my routine and join in!

I’ve found that the Starting Strength routine has enabled my body to build muscle proportionately, albeit especially legs. Because of this, I’ve always viewed my arms as ‘small’ and when I compare myself to some people’s amazing physiques online, they are. It wasn’t until I recently attended a party and was snapped into a picture that I got a different perspective.

Dody Dysmorphia

That’s me not featuring the black eclipse

Note, I am friends with the man in front of me, and I’m not here to comment on his physique. What intrigued me was how it wasn’t until I was in a photo with a regular guy that my perspective changed regarding my own body. Until this photo I had always thought my arms were on the smaller size, they are definitely no 18″ cannons. The point being that sometimes it’s important to take a step back and analyze things from another perspective.

Body dysmorphia can be an especially dangerous perspective, so this is just a message to all those currently on their fitness journey, to keep at it and remember to sometimes zoom out, and take a look at things from a different angle.

– Carl

Preparing For Technical Coding Interviews


It’s almost July, meaning that my break between semesters is closing in. I’ve decided to use a proportion of that time studying and practicing for technical interviews. As this is my last year at university, I’m looking to secure an enjoyment and challenging programming job for the summer and beyond!

The two books I’ve chosen to work through are: Cracking the Coding Interview and Elements of Programming Interviews. If I feel either of them helped me succeed, I’ll definitely do a review later. If you judge a book by it’s cover, here are the fronts:

Cracking The Coding Interview

That’s my update for now. Better return to studying for those finals in a few weeks.

Good luck to all!


Starting Strength, Week 2


After completing my running goal, I’ve been keen to get back into the strength training. After reading the Starting Strength (vol 2), I’ve decided to give this version a go:


  • Squat
  • Bench Press / Overhead Press (Alternating)
  • Chin-Ups


  • Squat
  • Bench Press / Overhead Press (Alternating)
  • Deadlift
  • Dips*


  • Squat
  • Bench Press / Overhead Press (Alternating)
  • Pull Ups
  • Leg press or Weighted Plank*

*  = Only if feeling extra strong that day, and have met all daily criteria *** These are not in the original program but I really enjoy doing them. Sorry, Rip

I have added a few extra exercises into the routine. Importantly, these are accessory lifts and have been delicately picked to help me improve my main lifts (Bench, squat, deadlift and overhead press). I have made a personal promise to only do these lifts if I complete all my daily goals.

Each SS workout only takes around 45 minutes if the gym is quiet, so it usually isn’t a problem adding extra training in, obviously the extra accessories will be dropped if the gym is packed out.

Carl Kenny | Starting Strength | (click to see in full size)

Carl Kenny | Starting Strength | (click to see in full size)

Here is a screenshot of the excel file I’m using to help track my progress (click to see in full size)

I’m using a spreadsheet freely available over on the Starting Strength wiki.

For a direct link to the Spreadsheet (Excel) file, click here.

Please note, I’ve adapted my version to be in kilograms, the original link provided is in pounds. The amount of increase is all that needs to be changed.

My current lifts are:

  • BP: 70kg
  • DL: 100kg
  • SQ: 65kg
  • PR: 45kg

You may have noticed that this program includes squatting 3 times a week. Personally I’m really excited about this, as I’ve only recently worked up flexibility to a point where I can legitimately squat below parallel. Whenever I remembered I basically held myself in a world third squat position for as long as possible (excuse the not so politically correct label), that looks like this:

T Nation | Third World Squats

T Nation | Third World Squats












Be sure to check out the articles on third world squats (and where the above image came from), over at T-Nation: Here and here

I will be on this program for approximately 10 weeks. Hoping to achieve the following at the end of the journey:

  • Bench:100
  • Squat: 120
  • Deadlift: 140
  • Press: 60

I’ll be sure to update how the progress is going. If anyone is interesting in reading the book, then you can buy it here or read the detailed wiki. The books is especially handy for those interested in performing the big lifts safely and don’t mind somewhat lengthy anatomical descriptions. It is really worth the investment for learning the lifts.

If you have done a Starting Strength variant, then I’d love to hear from you! Leave a comment.


Python Solves Group Financials

Python Solves Group Living Finances

Are you looking for a way to simplify your flat’s finances? Well I have the right script (i.e. small program) for you! To run this script you will need the following:

  • Programming Experience Required: None
  • Python 3 or higher installed on your machine
  • Access to your shared bank account via internet banking (don’t worry, this script won’t need your credentials, just the transaction data to sort out the mishaps!)

I’m currently studying towards a bachelor science in Computer Science and Psychology. Throughout my studies I have chosen to experience flatting i.e. living with a bunch of friends. This has always been a great experience, however there’s one topic that tends to be avoided to keep people happy:  money.

If you’ve had similar experiences in the past or are experiencing this right now then please keep reading, as this script can help you logically solve them. I would like to point out that I built this script for my own programming pleasure and it is very likely that you can get the same result a lot faster by using a tool you’re comfortable with.

This script is open-source and I promise it doesn’t send your valuable information /or finances across the internet. If you don’t trust it, ask someone with programming experience to take a look at it or don’t use. Better to be safe 🙂

This script requires a few things:

  • The .csv file which can be downloaded from your bank’s website
  • The Python script
  • Very basic command line ability (I will explain everything)
  • Python 3 to be installed

Regarding the command line, I’ll be attacking this from a Windows perspective, as I’m assuming anyone who has a distribution of Linux is well versed with the terminal. Just be careful with the direction of the slashes…

Download the .csv file and the .py script to a place you where you can find it. e.g. C:\Users\USERNAME\Documents\Python

It will also be helpful to rename the file to something smaller and that contains no spaces.
e.g. bankaccount_2014.csv

Now, using the file explorer, locate to where you’ve saved the .csv file and the .py file. It should look like this:explorer_cli_python_csv

Now we need to open up the Windows command line. Don’t worry, I like walk you through this and we will be using minimal commands. As a side note the command line can be very useful, so if this example feels fun, head over to your favourite search engine and do some research!

Now, hold down [SHIFT] on your keyboard, right click the folder and select ‘Open Command Window Here’

A window will open up with a very limited visual interface, but it’s very powerful once you know how to use it!

C:\Users\YourUsername\YourFolderPath is where you have opened the command line. To check that everything we want is there. Type dir /b and then press enter. What you should now see printed to the command line is all the files in the current directory, the /b is an argument given to display only the minimal presentation of files. If you’re interested try “dir” own it’s own and observe the difference.

Quickly we’ll check that you have Python 3 installed and accessible. Type python and press enter. If it displays Python 3.x.x, great! Press [CTRL] + [z] to end the Python interpreter. *If it displays “python is not recognized as a internal or external command, …” then you need to go install Python and add it to your path (The GUI installer has a drop-down entry for this)

Almost there! Below I will use XXX as a placeholder for the name of your .csv file. If that confuses you, rename the .csv file to XXX.csv (however, this might seem dodgy when you look back through your documents…)

To run the script on your data, type: python XXX.csv 

If you’re rushing to look at the result, type: output.txt and press enter! This should open up the output of the script in your standard text editor (probably Notepad or Word, for most). Great, now go analyze those mischievous transactions and the fairness of everyone’s contributions. Stop here if you’ve had enough of the command line and just want to get to the number crunching!

Yay, you’ve made it. If you’re interested in attempting to understand the code, have a read over at GitHub,I originally made this script just for myself then I had friends complaining about similar problems, so I adapted it and sent it off to them. The “>” writes all the print calls to an output file. This should have been placed into the script, however I prefer to send the output through many programs in my spare-time. In the GNU/Linux terminal, this is referred to as ‘piping’ which uses the | key

I’ve now changed the script, so that it writes a file on it’s own.

It has been tested with Westpac and KiwiBank .csv files. I’m sure other banks format their data differently, as I couldn’t find a universal standard anywhere. Comment if the script doesn’t work on your particular .csv file and I’ll do my best to adapt it to your situation! You won’t need to give the .csv file, just one row (change the people’s names and figures at your will, it’s just the columns that are important)

Future Plans:

  • Optimize the code, so it runs more efficiently. E.g. use less nested for-loops, create a list for original name, upper and lower at the beginning instead of on the fly (i.e. pre-processing)
  • Add a Java GUI on-top of the Python code, so that the user can drag and drop their .csv file into the application without having to open up the command line
  • Format the output nicely (i.e. line-by-line) and possibly convert back to readable .csv
  • Create a ‘smarter’ version, that dynamically locates the name/date/input/total/description fields and can run without the user having to input the people’s names (dictionaries will be key here)

Hope it helps! Leave a comment below if you need assistance or would like to show your appreciation.