Friday, August 28, 2015

Shell Productivity Hack

I got really sick of iTerm2 (and other terminals) not giving me an easy key-combo to move forward or backward a word at a time; having to hold down the left- or right-arrow key, for what feels like forever, to fix a typo in the middle of a really long one-liner (or a MySQL query, as was often the case) was becoming way too annoying, especially when I do it multiple times a day. So a few months ago I added this little nugget to my ~/.inputrc:

"\e[1;9C": forward-word
"\e[1;9D": backward-word

This lets me press alt-left or alt-right to move word-by-word rather than character-by-character. And now I can't live without it.

Saturday, July 25, 2015

Handy Skills: (Very) Basic Car Maintenance

I'm that guy who didn't get his license until his mid-20s and thus, never owned a car before, so I didn't really learn any of this stuff when everyone else did.

sigh

By basic car maintenance, I mean checking for blown fuses, replacing light bulbs, replacing batteries, checking the oil, checking tire pressure, etc... Things that are easy to do yourself without the need for overly-specialist tools and without having to fork out extra money at the mechanic.

A lot of this came in handy when, in the space of a few days, both low-beam headlights blew, the front left tire went flat and the battery (on the car we were using until we replaced the headlights on our primary car) went flat.

When it rains, it pours...

Saturday, June 27, 2015

Early Mornings Again

About six years ago, when I started working full-time, I got into the habit of waking up at around 5am (along with the habit of going to sleep early), but slowly, over time, that creeped up and up until I was finally getting out of bed at 7am, which left me with just enough time to quickly put some clothes on and run out to the bus stop by 7:15am so I can go to work and still get there just barely on time at 8:30am.

I was still tired when I woke up. I was getting to sleep later. I was skipping breakfast until I got to work to buy something from a cafe. I was coming home still tired and exhausted. Add basketball and strongman training on top of that and I was a bit of a mess. And the worst part is that I was spending less time with Cherie.

Well, as of about six weeks ago, I've started waking up at 5am again, getting to work by 7:30am and leaving work just after 4pm. From there, I go past Cherie's work and we travel home together.

I go to sleep earlier, I get home earlier (which gives me more time each night to do things), I see Cherie more and, overall, I feel so so so very much better during the day than I did before.

Feels like a win to me.

"If you want to get shit done, wake up before the sun comes up." - Jim Wendler

Friday, May 22, 2015

First Steps with AnyEvent

Nearly 10 years ago, while I was at university, I was first introduced to event-driven programming with Twisted, an event-driven framework for Python. At the time, I was thoroughly confused by the whole thing and didn't really get it (Not allowed to block? But I want my user input now, dammit!). I persisted for a while, but ultimately gave up.

The second time around it made a lot more sense and, since then, I've been exposed to libev (via the EV Perl module) and POE. It's a powerful programming paradigm, and super worthy of being a part of any programmer's toolbox. And this is where AnyEvent can be of service.

AnyEvent isn't exactly an event framework itself, but it can sit on top of other event frameworks; the self-described "DBI of event loop programming". So, because we have a ton of legacy EV code at work, I can write AnyEvent code alongside it, and AnyEvent will integrate with EV's event loop and everything will just work. This a huge benefit and an obvious reason why adopting AnyEvent into an existing system can be a good idea.

Experimenting at Home

I wrote some code to hit my wireless internet router's web server a bunch of times and it wasn't long before I came across my first issue with AnyEvent::HTTP; my router (by Huawei, so take what you will from that) only accepts the content length header in exactly the form 'Content-Length'. However, AnyEvent::HTTP issues 'Content-length' (note lowercased 'L') and my router issues a 404 response for this. Diving into the AnyEvent::HTTP source, I found that there's no way to override this behaviour, as AnyEvent::HTTP lowercases all headers you pass in (plus a couple of default ones) and then ucfirst's them on output.

So what was my workaround for this? To use AnyEvent::Handle and HTTP::Request to talk HTTP. I could have used AnyEvent::Socket alongside AnyEvent::Handle, but AnyEvent::Handle can make TCP connections aswell, which is handy.

That worked! Making many many many HTTP requests? AnyEvent handles it like a champ. That's great!

But the server didn't handle the number of connections very well, so there were lots of failed and closed connections. That's bad.

My first instinct was to write code to retry a connection if it failed for any reason. This worked for a while, but eventually EV (the event backend that AnyEvent had chosen to use, since it was installed) would die with a critical error. That's also bad.

In the end, the solution was to throttle the number of connections I was making, and everything started working again. Great!

How do you throttle? Something like this:


use AnyEvent;
use AnyEvent::HTTP;

my $cv = AE::cv;
my $num_connections = 0;

my $w; $w = AE::io \*DATA, 0, sub {
    return if $num_connections >= 2;

    my $url = <DATA>;

    unless (defined $url) {
        AE::log info => "Finished reading DATA";
        undef $w;
        return;
    }

    chomp $url;
    AE::log info => "Trying $url";

    $num_connections += 1;
    $cv->begin;

    my $hw; $hw = http_head $url, sub {
        my ($data, $headers) = @_;
        AE::log info => "Result from $url: $headers->{Status}";

        $num_connections -= 1;
        $cv->end;
        undef $hw;
    };

};

$cv->recv;

__DATA__
http://google.com
http://reddit.com
http://facebook.com
http://twitter.com
http://gmail.com

Closing Thoughts

I've been wanting to use AnyEvent for something work-related recently, but I want to experiment a little more before I go down that rabbit hole, or perhaps just use it in something non-critical.

Condition variables are great!

I've heard that IO::Async (with futures) is another great way to go as far as Perl asynchronous programming frameworks go, so I might experiment with that some time soon, but for now I'll stick with AnyEvent.

Saturday, April 11, 2015

Victorian Strongman Grand Prix Round One Post-Mortem

Nearly two weeks ago, I competed at Round One of the 2015 Victorian Strongman Grand Prix at StrongMelbourne. I did a write-up of the events and how I went on my strongman-focused tumblr account. tl;dr I came 3rd in the heavyweight division, video below:

Hindsight is a wonderful and terrible thing. And that's what this blog post is going to be; a list of all the things I did right and wrong, the things I'd changed and the things I wouldn't change in the lead up to what was my fourth strongman competition. Hopefully these lessons can be carried forward.

Practice the Events

This is a pretty obvious one. The big problem I had when trying to train the events was that my regular strongman gym, Definition Fitness Centre, didn't have a lot of the equipment to practice with, and some of the equipment wasn't even built when the competition was announced, so there wasn't a lot that I could do about that.

A week before the competition, I only got one practice session in at StrongMelbourne with the actual implements, and I probably should've gotten in at least one or two more training days in there in the earlier weeks.

Why is this so crucial: if I hadn't have practiced the sandbag loading race, figuring out what the best way to setup and pick up the sandbags was for me, I would've screwed the event up entirely. Also, a 260kg frame carry is very different to a 130kg per hand farmer's walk.

Dig Deeper

This is a recurring problem for me, and it's obvious when rewatching myself on video; I don't have a sense of urgency during an event. I look too casual. I'm not aggressive. I'm not angry. I don't look like I actually realise that I'm in a competition trying to beat other people. This is in stark contrast to when I play basketball - something I've done for 20 years now - where I'm very aggressive.

During the sandbag loading event, the first two sandbags were carried and loaded pretty easily, and I was happy with my performance up to that point. But on the last sandbag, I hesitated before picking it up, and again after lapping the sandbag before finally walking with it and loading it. Those couple of seconds cost me second place in that event, and, all else being equal, second place overall on count-backs. This is a mistake I need to stop making.

Overhead Strength Was Great

The overhead strength training I did for this competition was fantastic. I've never felt so strong overhead before, and I credit the lesson I learned again earlier this year for the progress I've made.

I didn't practice the overhead medley at all - just the individual implements separately - and if I had practiced the full medley (or something similar to it), I probably would've figured out that my belt was going to cause breathing problems by the time I got to the axle. So my mistake with this event more so reiterates the first point: Practice the Events.

Sometimes just being strong enough isn't enough.

Conditioning Was Great, But Not Excellent

Conditioning is something I've put a lot of time into in the past year, and it has improved by leaps and bounds. Having said that, it needs to be better. Or more accurately: it needs to be more specific. I can push a prowler for 15-20 minutes, snatch a kettlebell for 5 straight minutes and clean+press an axle every minute on the minute for 15 minutes with the best of them, but nothing gets you better conditioned for sandbag carries like actually carrying sandbags.

I don't know when my next competition will be, but I've got plenty to work on before then.

Saturday, March 28, 2015

Handy Skills: Sharpening a Kitchen Knife?

I know, I know! How the hell could I be 29 years old and not know hot to use one of them knife sharpening rods that every household ever has?

Well, truth be told, my dad has shown me how to use a sharpening steel a few times in the past, but I'd just forgotten by the time I moved out of home and had my own knives to sharpen. I also didn't have a sharpening steel for the first couple of years out of home, but you can be damn sure that as soon as I forked out the money for one (and it was more expensive than I thought it was going to be, but worth it in the end), I jumped on YouTube, found some videos, and spent an hour sharpening every knife in the house, which greatly pleased my girlfriend.

The videos listed here are on the longer side, and there are undoubtedly shorter videos that'll get right to the point, but these videos go into honing vs sharpening, various blade shapes, various honing rods, and all sorts of details that I never would've known to consider. Sure, most of it doesn't apply to me, but it's worth knowing what you don't know, right?

And now I make sure our kitchen knives are sharp on a regular basis. And my girlfriend thinks I'm obsessed.

In the future I'd like to learn how to sharpen knives on a whetstone too...

Wednesday, March 11, 2015

Handy Skills: Knots

Handy skills... you know... those skills that are probably easy to learn, but you just never took the time to actually learn, despite being in many situations where said skill would come in handy.

One of my goals for this year is to learn a bunch of these skills and then, of course, blog about them. These blogs will be super short; I'm mostly just going to briefly explain what the skill is, when I would use it and then throw down a few links that helped me out.

First skill of the series: knots.

A few weeks ago, my mate Dave asked a bunch of us to help him move into his new house. Between my group of mates, we've all helped each other move dozens of times, so we all got involved again. Dave hired a three ton truck, we started loading up his furniture on a scorchin' Sunday morning and so presented our problem: none of us knew how to properly secure the furniture inside the truck.

It was a little frustrating because I'd watched my dad tie all kinds of knots hundreds of times since I was a kid.

Michael, another mate who was helping out on the day, and I jumped on Google and quickly picked up how to tie a clove hitch. It turns out that's not the best knot to use for that kind of work, but it mostly served its purpose for the day: we got the furniture where it needed to go without damaging any of it.

Anyway, that night, fed up with not knowing something so useful, I jumped on the internets and sat there with a piece of rope tying and retying knots over and over again:

Monday, February 2, 2015

The Push Press Does NOT Carry Over to the Log Press

For the last couple of days I've been repeating those words in my head again and again and again. About a year ago I was doing the same thing.

On January 25 2014, I was training events with a couple of other strongmen, and I got stapled on the log press by 115kg five times. I could clean it just fine, but no matter how psyched up I got, and no matter how angry I got, I couldn't press it out. At that point, I had been training the push press almost exclusively for my pressing movements. Saad, a very strong presser around here, told me afterwards to stop push pressing and do more strict pressing.

Just over a month later, on February 26 2014, I pressed a 120kg log, the heaviest weight I had held over my head at that point, without a belt or wrist wraps or weightlifting shoes.

That was the day I realised: the push press does NOT carry over to the log press.

For a solid month, I pressed only once a week, with heavy log pressing for sets of 2-3 reps followed up by either strict overhead presses or incline bench presses for sets of 5 reps and some heavy upper-back work, either in the form of barbell or dumbbell rows.

But later in the year, I seemed I had forgotten all of that. For the past few months I've been training the push press and push jerk as my only overhead movements, but I was still benching, which I had hoped would help maintain some of my strict pressing strength.

A couple of weeks ago I used the log again, for the first time since April 2014, and it went okay. Not great, but not bad. But then, a couple of days ago, I decided to take a max on the log again, just to see where I was at before I start my next training cycle. I was hoping to get a top-set of 2-3 reps of somewhere around 110kg. I doubled 105kg a couple of weeks prior, so I figured I could at least double 110kg.

Welp, the first attempt at 110kg, with a belt, weightlifting shoes and wrist wraps on, I missed the press woefully. And then I took the belt off, got super angry, and with a bit of knee rebend, I grinded out 110kg on the second attempt.

It sucked. I sucked.

Immediately I knew what I had done wrong; I stopped strict pressing. So I followed up my terrible performance with 5 sets of 5 on the overhead press as punishment.

So here I am again, about to embark on two months of solid overhead training in preparation for the state qualifiers for the Australian Log Lifting Championships. At least this time I know how to get my log pressing strength back up.

Monday, January 12, 2015

The Year Ahead

Happy New Year! Last year was a lot of fun, with two strongman competitions and my first powerlifting meet in the books, reigniting my interest in assembly language, reverse engineering and online wargames, and a hell of a lot of food and cooking with my best friend and girlfriend, Cherie.

So what's on for the year ahead?

More strongman and powerlifting competitions! Furthering my skills in reverse engineering and assembly language! Some more basic game development for fun! Breaking into some new territory where computer security is concerned, specifically around RF hacking! Some handyman skills for home! A tiny bit more blogging than last year! And hopefully more!

I'm planning on having a productive year!

Thursday, December 11, 2014

"Getting Fit" - Which Direction?

Just to continue on from the final thought in my previous blog post:

Usually when asked by friends what piece of gym equipment they should buy to "get fit" at home, a kettlebell (and Pavel's book) is my first recommendation.

Let's partly ignore the "what to buy for home" part and focus on the "get fit" part. See, here's the thing: I enjoy reading about all different ways to train. It's fun, but it's also a gigantic pain in the ass, because when someone asks me for advice on how and where to get started, I'm overwhelmed with so many thoughts, so many training philosophies and so many articles and books by so many coaches and athletes that I don't actually know what advice to give!

It goes without saying that fixing up your diet is the most important thing, and if it wasn't obvious before, it should be, but I'm no diet expert, so I won't give any recommendations here other than to cut out as much processed crap as you can and eat as much whole foods as you can. Your body will thank you.

Now, onto the stuff I feel like I'm in a better position to talk about...

Plain ol' bodyweight exercises? Anyone can learn to do push-ups, planks, squats and pull-ups and there are all sorts of variations to make them easier or harder, depending on where you're at. They have such a low systemic stress on the body that they can be done every day to failure and they can be done pretty much anywhere, from your own lounge room to a hotel room overseas to a patch of grass at a park. Paired with 30-60 minutes of daily walking, this is a solid starting position for a complete novice.

What about kettlebells? The great thing about having a kettlebell is the bang-for-buck factor; it takes up almost zero space, the same kettlebell can be used for years no matter how "good" you get at it and you can learn just a few movements (swing, clean+press, snatch and TGU) to strengthen and condition your entire body with a few short sessions per week in the comfort of your own home. There's a small learning curve, because there's a little bit of technique to swinging a kettlebell effectively, but, being easy to learn, it's still a very accessible option for the general population. Along with Pavel's book, Enter the Kettlebell, this is my recommendation for most people.

Basic barbell training? Squatting, benching, overhead pressing, deadlifting and rowing will get you fit and strong, whether you're a man or a woman, whether you want to get bigger or smaller, whether you have any interest in competing in strength sports or not. It really is a one-stop shop to better health and better performance and there are tons of resources to teach you how to perform each movement. I would love it if most people eventually headed in this direction, but some people just can't be convinced to get under a barbell.

Any of the above options can be paired with hill sprints to really push your conditioning (your "cardio"). Why hill sprints? Because most people can find a hill anywhere they go, there's nothing technical to learn (assuming you know how to run), it costs nothing and they work. Live in a flat area with literally no hills? Make a sled (a tire, a plank of wood to put in the middle of the tire, a rope and a few bricks or a big stone for some weight) and drag it around. Want another option? Put together a sandbag and carry it a bunch of times. Or just sprint. These are all cheap (if not free) options and all of them are super effective.

Any of those options will work if you consistently put in the hard yards. There are many options to "get fit". You don't have to walk into a gym, you don't have to buy all sorts of expensive equipment and you don't need to read tons of books about exercise and muscle physiology. Sure, having access to a gym and reading up on how your body works would be great, but you don't need to.

Most people are surprised when I suggest some of these things, usually because of how simple they are, because we're mostly made to believe that you need a personal trainer because exercise is some big complicated thing and you will hurt yourself if someone isn't watching and correcting your every move. But that's bullshit.

Tuesday, November 25, 2014

Yet Another "Go To" Workouts Post

Mid-way through 2013, I blogged about a few of my "go to" workouts, and then earlier this year I posted a few more.

The original idea was quick workouts with a lot of bang-for-buck for when I'm short of time or for when I can only get to the gym once a week, if at all,, so following some kind of program isn't really worth the time. Well, I've been going through one of those periods recently, which will continue until January, so here's a few more!

Push Press Volume and Farmer's Walks

In these sessions, most of my time is spent doing push presses. And there's really no rules as far as how much volume to do. Last time I did this I worked up to a very heavy single, then did a few drop sets of triples, and then dropped the weight a bit more to do a max-effort rep-out and then I worked back up to a heavy single, attempting to hit the original heavy single from the start of the workout (I missed it).

The rest of my energy is spent doing farmer's walks. Farmer's walks are an awesome conditioner and will help build and strengthen the upper-back and traps, which means I can combine my upper-back and my conditioning work together. I mean, it may not be perfectly ideal, but it'll get the job done. Heavy, light, short, long, sprints or waddles... it doesn't really matter how you do them. Just do them. At the moment I prefer to do 8-10 short sprints (around 20m) and/or 2-3 longer walks (at least 50m) to finish it off.

Squat, Bench, DB Rows

The holy trinity of strength training? When I haven't trained for an extended period of time (I'm talking weeks or months), this is the thing I do the first time I step into the gym again.

I prefer to squat narrow and deep with a high-bar position, I prefer bench with a close grip, and I much prefer dumbbell rows over any other kind of upper-back work. Done for high volume, these three are my go-to mass-builders and a solid way to kick off a high-volume training block.

It seems weird, given that I usually prefer any kind of overhead pressing to bench pressing, but I just feel like the bench fits better here.

Kettlebell Snatches

Whether I only have a few minutes to get some conditioning in at the end of a training session, or if I can't get to the gym at all and need to do get some solid work done in the backyard at home, I can always depend on the cannonball with a handle, i.e. a kettlebell.

After reading about the Secret Service Snatch Test in Pavel's book Enter The Kettlebell, I've been doing 2-5 minute continuous snatch-fests with my 20kg kettlebell as a way to build my conditioning, and it has worked pretty damn well, anecdotally. One day I'd love to work up to 10 continuous minutes with a 24kg bell.

It's actually really convenient for something to do at home while dinner's slowly cooking in the oven or on the stove.

Usually when asked by friends what piece of gym equipment they should buy to "get fit" at home, a kettlebell (and Pavel's book) is my first recommendation.

Thursday, November 20, 2014

Excited About Spring and Summer

Every year, I look forward to the end of winter. No shit, right? Doesn't everybody? Well Cherie loves winter, but she seems to be the exception.

What do I get excited about?

The days get longer and daylight savings kicks in. That means when I wake up at 6am for work, the sun is already out. It means I don't need to cover myself in 5 layers of warmth for fear of freezing during the night. And if it gets hot, just having a fan turned on is good enough most of the time. It also means when I get home after work I still have an hour or two of sunlight to do stuff. Perhaps I'll get in a quick conditioning workout in the backyard with my kettlebell, or perhaps Cherie and I will eat dinner outside before it cools down.

Oh and speaking of food, in the warmer months I love lighter meals. It's a great time to grill everything; steaks, lamb chops, chicken breasts, fish (when it's cheap) and all kinds of vegetables. This is also when avocados start to taste amazing, so they're a quick addition to many meals, although the price goes up accordingly to the point of ridiculous around here, so maybe not every week. Even a fresh bowl of rice with a can of tuna thrown in with a pinch of lemon juice hits the spot.

It's a great time to be a strongman, given that a lot of our training happens outside. Training outside is hard in the wetter, colder months and spending any more than an hour training starts to suck, but once spring gets here, training is a lot more enjoyable. Even if I don't have to, I'll train outside.

It's just a great time to be outside in general! I can go for a nice walk on my lunch break rather than hang around at my desk and look stuff up on the internet (or write blog posts). My group of friends can have a BBQ together and actually sit outside together because it's still sunny and not freezing cold. I actually like Christmas time with my family and friends for the same reason (sorry USA, you can keep your White Christmas).

Yeah, I think it's safe to say I'm a summer person.