Tuesday, April 10, 2012

Attack of the Phone Scam?

Yesterday afternoon, my girlfriend, Cherie, and I walk into her home. Her dad was on the phone with his laptop in front of him. He's not the most computer savvy person in the world, so he asks us to help him with this person on the phone. I sit down at the laptop and take the phone. MSConfig is open (alarm bells start ringing), as is the "run program" box with "www.ammyy.com" typed in (ding ding ding).

"Hello?" No answer... "Hello?"

A man with a thick Indian accent finally speaks. "Hello, are you the manager of this laptop?" I respond, "No" The man repeats his question and I repeat my answer.

"Who are you? Where are you calling from?" Apparently he is from my Windows service provider (which I never got the name of) and apparently the laptop had made several attempts to access forbidden sites (which I never got the addresses of) and they needed to fix the problem for me.

"Ok, so what do you need me to do?"

After a bit of confusion on his part - apparently "all the programs are closed, I can only see the desktop" is a little confusing - he asks me to press the Window button and "R" at the same time. I then have to type "www.ammyy.com" and press Enter. I don't, of course, because I'm a critical thinking human being who knows that Microsoft don't have the resources to call the billions of end users that they have around the world to remove a virus, which their Microsoft Security Essentials product is supposed to take care of anyway, and certainly not via some non-Microsoft owned remote desktop software.

I Google the address, and quickly find out that the site hosts some kind of remote desktop software and that there are forums all over the internet talking about getting phone calls, having the same story spun to them, and attempting to coax the mark into downloading some software and some people even getting charged a small fee.

While stalling him, I hear him put me on mute a couple of times, I assume because he's annoyed that it's taken me a good five minutes just to press Enter.

He starts talking again. I hang up.

Cherie and I tell her dad that it's a scam and to hang up on him if he calls back, and we head out for a few minutes. When we return, her dad is on the phone with this guy again. Cherie grabs the phone.

"Hello, we have looked up the site that you asked us to go to and it's quite obviously a scam. Stop calling." She's pretty awesome like that. I would've preferred to mess around with him a little, but time is precious. The man responds with something along the lines of "I will call every day." Fine, whatever. The more time you spend failing to scam us is less time you spend successfully scamming others.

I'd always read about phone scams like this happening in other countries, but never in Australia.

Monday, April 2, 2012

Tough Mudder, Melbourne 2012

On Saturday, March 31 2012, I ran my, and Australia's, first Tough Mudder at Phillip Island.

What the Hell is it?

You can find out more on the website, but in brief, Tough Mudder is a, roughly, 20km obstacle course with obstacles ranging from ice baths to 4m high walls to electric wires designed to test your muscular endurance and mental strength.

So last October I sent out a message to my closest friends asking who wanted to do it with me. I ended up recruiting two mates, Gordon and Andrew.

Training

Although early on we had discussed training together for it, our schedules clashed a lot, so we ended up mostly training separately.

How did I train for it? Mostly strength training; I've been on Wendler's 5/3/1 for about 12 months now, so all I changed up was adding in a lot more upper-body assistance work, in the way of rows, pull-ups, lat pulldowns and high-rep push presses, to help with pull-ups and endurance.

I relied on my endurance and running/sprinting ability from 16 years of basketball to get me through the running, although this didn't work very well. I'm good a short distance sprints, but not long distance running.

Injury

Six days before, the three of us, accompanied by our wonderful partners, did an obstacle course out in Gembrook. On the first obstacle, a rope net, my left foot got caught and I twisted it. It hurt a lot! I jumped up and down on it a few times, felt the pain setting in, and in my stubborn ways, decided to keep going. I went to a physio during the week, who told me I had pulled some of the tendons in my ankle on the inner side, instead of the usual outer. She strapped up my foot, told me to go easy on it and sent me on my way. I decided that, even if I wasn't going to be able to run, I would, at least, go down and start the thing. After all, I paid for it, dammit!

Pre-game Nutrition

The night before the big day, I ate a decent meal (from the advice in this article), prepared by my lovely girlfriend, consisting of a t-bone steak, leafy green vegetables and a lot of a sweet potato. This worked out spectacularly; I had a lot of energy throughout almost the entire thing, with exception to the last few kilometers, for which I relied on the bananas provided by Tough Mudder staff.

Before the Start

My girlfriend and I had tickets to see Avenue Q on Friday night, so we didn't leave Melbourne until about 10:30pm, and after a few stops on the way, we arrived at Phillip Island to the house we were staying at, which Andrew had organised, at about 1:30am.

Five hours later, we all woke up, suited up and headed off.

As soon as we parked our cars, we had to walk for a good ten minutes to get to the entrance, which meant we were cutting it pretty close because it was almost 8am, which was my designated start time. Luckily, registration was super quick, as was the bag drop. I quickly jumped into the back of the pack as they were counting down from 10 and headed off. Due to a bit of a mix up, I started earlier than Andrew and Gordon, who ended up sneaking into the 8:15am pack.

The Obstacles

I'm not going to go through all of the obstacles or every bit of my experience, so I'll just outline the favorite and not-so-favorite obstacles.

The 4 metre high Berlin Walls were a lot easier than I thought they were going to be. There was a little edge to get your feet onto, which was more than enough for me to launch myself from, grab the top of wall and pull myself up and over. However, it was good to see teams helping out others, and I stuck around at one of the walls to help up the last members of a couple of teams who couldn't get up by themselves.

The pinnacle of team work, however, was the tight rope net we had to crawl under. Three teams and a couple of lone rangers (myself included, as I hadn't met up with Gordon and Andrew yet) all grouped together to completely annihilate this obstacle.

The ice bath was my downfall. My right calf muscle cramped up as soon as I tried to get out and my left ankle started to ache a lot even when I just walked on it. And this was only at about the 5km mark. I thought I was done. If I couldn't even walk without it hurting, how was I making it through another 15km of this? After a couple of kms of walking, the pain went down enough (or did the pain in the rest of my body go up?) and I decided to keep going.

The mud crawls, with barbed wires a few inches above me, scraped up my knees a lot. The mud was mixed with some kind of gravel, although this seemed necessary as the mud was stubborn and impossible to push yourself off of. Soon after this point, we stopped to stretch out our legs a bit, and Gordon decided to lean on a fence. Turns out it was an electric fence. Good work, Gordon!

By the time I reached the hay bales (a little over half-way through), both of my calves were cramping, as were my adductors. A lot of other people around were suffering from muscle cramps too by this point.

The mile of mud. If ever there was something to tire out my legs and mid-section, this was it. By the time I got out of this, walking out of mud felt like floating on air.

Everest. A quarter pipe that made the Berlin Walls look like a warmup. My first two attempts at this were in the middle of the pack, where the grass was quite muddy. When attempting to push off with my left foot to get a hand onto the top, I slipped and face-planted instead. Oops! My third attempt was on one of the ends, where the grass was dry. And it was a success!

Last but not least; electro shock. I shat myself coming up to this, because I didn't know how much it was going to hurt and I couldn't see any gaps to minimize the number of wires I would hit. So I just ran through it and got zapped what felt like a dozen times and had my muscles flailing all over the place, without any say from me.

The End... Nearly

As soon as I crossed the finish line, with a hurt left ankle, muscle cramps, a giant blister on my right foot, scratched up knees, some gashes on my arms and a whole lot of mud on my clothes, I shook hands with the MC at the end, grabbed my free beer, which I necked in about ten seconds, grabbed my head-band and t-shirt, let my girlfriend take a few pictures and then headed for the nearest patch of grass to fall over and die.

After waiting for over an hour to get my backpack, my girlfriend and I finally made our way to the car. Or, at least, we tried to. We got lost! All I wanted to do was take my shoes off, unstrap my left ankle and relax! It took us about half an hour of walking around to find it, and with my backpack on my back the entire time, there wasn't a single part of my body that didn't have something to say.

Recovery

Back at the house, Andrew, Gordon and myself were dead tired. We had our long-awaited showers (separately, of course) and let the recovery begin. Our girlfriends all did wonderful jobs looking after the three of us, and we wouldn't have made it through the rest of the Saturday or Sunday without them doing things for us, and shopping for lunch and dinner for everyone.

For me, recovery food that night consisted of a bowl of chunky soup (provided free by Tough Mudder), a pack of Oreos, an iced coffee Big M, chicken, bread and a shitload of water.

Next Year?

Would I do it again next year if they come back to Melbourne? Absolutely. As much as it hurt, I really want to do it again with a healthy ankle, just to see how much better I could do. It also made me realise how fun trail running is compared to road running.

And that's it! That's my Tough Mudder 2012 report. I can't wait to do it again! Now I'm off to take more fish oil and stretch my damn calves before my lunch break is over...

Friday, March 2, 2012

Getting Some Quick Experience with a New Programming Language

One of the biggest problems I have when I mess around with a new programming language is deciding what to do with it after I've been through the examples and official tutorials. What do you do when you just want to get more comfortable with the language and you just can't think of anything, or don't have any ideas that this language would fit nicely?

My solution? Use it for odds and ends. If the implementation has one, fire up a REPL and keep it running in the background while you work on other things. Need to do some kind of simple calculation? Need to transform some data? Jump into the REPL and figure out how to do it with your new, shiny toy. It may take a little longer than if you used something you're more fluent in, but the reward is often worth it.

Tuesday, February 28, 2012

Future Blog Posts

In my spare time I've put down a lot of the programming-related stuff I was doing in favor of other things. I started playing guitar a couple of years ago, I started lifting weights (to get better at basketball at first, but now with a focus to compete in strongman) and I started having more of a social life with my girlfriend. So I'm going to broaden my range when it comes to blog posts. No longer will this blog be solely for tech-related topics. I will start writing about various things in my life, which may include lessons I learned on the basketball court, reviews for cafes and restaurants around Melbourne and little tidbits about weight lifting and guitar and music theory.

I always wanted to blog about some of these topics, and I always thought about keeping it to separate blogs. But I've decided that this blog isn't busy enough and doesn't have many (if any) readers, so I'll mix it up with the tech talk.

Tuesday, February 7, 2012

Dock Stopped Working in OS X?

It doesn't happen often, but when it does, I don't want to have to restart my computer to fix it (or anything, really).

Every now and then, on OS X, my Dock disappears and I can't Cmd+Tab between applications anymore. After a bit of searching around on forums, I found the solution; kill the Dock process from Terminal.

killall -KILL Dock

After killing the process, a new Dock will automatically start up.

Problem solved!

Monday, January 2, 2012

How I Deal with Lots of Data

Just for some context, by "lots of data", I mean a couple hundred million rows in a table joined to other tables of similar size. By no means is it a lot compared to what other people deal with, but it's certainly enough to warrant some forethought instead of just diving right in.

Late last year, I was tasked with a few one-off reports that required me to summarise data that was stored over a couple hundred million rows in a database. Knowing that it was going to be a long process to retrieve the data for these reports, I had to come up with a game plan to do this as quickly and as efficiently as possible. In the process of doing this, as always when handling relatively large quantities of data, a few things were learned. None of these lessons/ideas are new or original, but I wanted to write them down somewhere, and here feels like as good a place as any.

Extracting the data that I needed (which, in one instance, was a subset of a couple of ~300 million row tables) into a local database meant I was able to modify the data (like cleaning up dirty, inconsistent spellings of suburbs, states and countries) and modify the schema (like adding new indexes which, because of the odd nature of the reports, the production databases didn't have or ever need previously).

Assuming that you don't require something like schema changes, that local database doesn't even need to be a relational database. CSV files work perfectly fine a lot of the time. For a couple of reports I wrote a handful of scripts, the first of which was to pull the data out of the MySQL database, perform some simple operations on the data and output it into a CSV file. The other scripts that needed to operate on the same data could then easily (thanks to Text::CSV_XS) read the CSV data, which was a lot quicker than reading it from a relational database.

Why do CSVs lend themselves nicely to this kind of task? Because with reports like these, in my experience, you very rarely perform complicated operations on the data after extracting it from the original data source(s); you just want to suck the data up, summarise the data, output the summary, and then output the nitty gritty details on subsequent pages or into a separate file.

An obvious advantage to storing the data like this is the speed in which you can retrieve and process the data. That improvement made a huge difference for me because I like to run my scripts very often throughout the development process, no matter how small the change.

Of course, depending on the size of the data (in bytes), extracting the data into a local database of some sort may not always be possible.

The last big win I had was not using object-relational mappers (Class::DBI in this case). They're great a lot of the time and save on code and development time, but when dealing with millions of rows, they just add bloat and everything runs much slower than it should.

That's all I can think of now, a few months later.

Tuesday, June 28, 2011

Crappy IRC and Unicode

I use MacIrssi as my IRC client at work and at home. It's mostly great. By mostly, I mean, I wish when people sent smart-ass messages on IRC filled with unicode characters, I could actually appreciate how much of a smart-ass they are being. Instead, all I see is this:

< ganeshanator> gonna go to the \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
    and \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
    getting those \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
    and the \u2588\u2588\u2588\u2588\u2588
    on \u2588\u2588\u2588\u2588\u2588

I always forget how to convert it, so I wrote this, and now I never have to remember again:

#!/usr/bin/env perl

use warnings;
use strict;

use Encode;

sub unicode_plz { encode( 'UTF-8', pack( 'U', hex shift ) ) }

( my $message = shift ) =~ s{\\u([a-fA-F0-9]+)}{unicode_plz($1)}ge;
print "$message\n";

And, BAM!

Crappy was a harsh word. MacIrssi is pretty great, except for this.

Thursday, March 31, 2011

DateTime Woes

This morning, I hate DateTime for this.

$ perl -MDateTime -wle'$a = DateTime->today( time_zone => "Australia/Melbourne" ); $b = DateTime->today; $b->set_time_zone("Australia/Melbourne"); print $a->iso8601; print $b->iso8601'
2011-03-31T00:00:00
2011-03-30T11:00:00

I understand why it happens, but it's still an annoying, pissy, little bug to find. sigh...

Thursday, February 3, 2011

Update to an Old Post

A past post about tweeting from the command line with the Net::Twitter Perl module is one of my most visited entries. Anytime I check my traffic, it is always the second most visited entry for the day/week/whatever. However, it has a problem. The code does not work anymore for a simple, yet annoying, reason.

Last year, Twitter turned off its basic authentication support and now requires application developers to use OAuth. More detail about how that affected Net::Twitter can be read here. This kinda sucks because it's not longer as simple as providing a username/password combination. You need consumer keys/secrets and access tokens/secrets and that makes things a tad messier.

The original code I posted uses basic authentication and, obviously, will not work anymore. However, if anyone is interested, the code for that small side-project, Twitsh.pm, is on github and I recently updated it to use OAuth so that it works again, however the configuration file requires you to add your own consumer/access keys/tokens/secrets. Enjoy.

Sunday, January 23, 2011

Goal for the Year: IPv6

First blog post for the year! Yay? And I'm only setting myself one goal for the year: Learn everything about IPv6 and set it up at home.

And by everything, I mean everything; from IPv6 packet headers to the implementation complexities to the business issues to the security issues to the political issues.

Why? Because, potentially, in the next decade, migrating from IPv4 to IPv6 will become important, and considering that it's a topic that I know next-to-nothing about, other than what I've read in passing on IRC, it's a knowledge gap that needs filling.

It's certainly possible that this will all take me less than a month, assuming enough free time. When that time comes, perhaps I'll pick a non-geek goal to spend my time on this year.

Wednesday, December 1, 2010

Host Discovery via SPF Records?

So... my once-a-month posts OCD issue went unsatisfied for the past 2 months. Oh well. Back to business...

Sender Policy Framework (SPF) records are often used as one method of combatting spam; specifically, spam that wants to look like it has been sent by your company. The general idea is that your SPF records specify which hosts and IP addresses are allowed to send email using your domain(s) in the envelope 'from' address. Any other host, which is not contained within the SPF policies, that attempts to send mail from your domain will fail the SPF check and, hopefully, get picked up by some kind of spam detection software further down the track. It is highly recommended that you setup SPF records for any domains that you own.

How are SPF records requested? Via DNS. They are usually contained within the TXT record, however they can also, occasionally, be found in the SPF record aswell. The format is very easy to understand. An typical example to look at would be optus.com.au:

IN TXT "v=spf1 mx/24 include:opt01._spf.optin2.com.au ip4:180.92.216.0/21 include:rightnowtech.com include:rnmk.com include:custhelp.com ~all"

Do the hosts (and the range of IP addresses) in the policies belong to optus.com.au? Maybe. Maybe not. We cannot discern that just by looking at the host names, nor can we, within any real degree of certainty, determine it programmatically. However, the hosts' SPF records have been trusted to send mail on behalf of optus.com.au, so they remain hosts of interest for penetration testers and may not pop up in other DNS requests (A, MX, AFXR, etc..)

What is a common example of a host who would be in a domain's SPF policies but not actually part of the company who owns the policy? Any mail filtering company who filters outbound mail.

Just a thought that has been floating around in my head...

Thursday, September 30, 2010

End of the Month...

Well, it's the end of the month, which seems to have become the day that I write a new blog entry (I feel somewhat empty if there's a month missing from the sidebar over there), but I don't have anything very interesting to post, so I'll post something a little less interesting: A github project I use for testing libraries, Mazer.

Mazer is a rewrite of an old assignment I did years ago in C++. Originally it just had to automatically solve a maze step-by-step, as if simulating a human walking through the maze. I often write this same program when I start learning a new programming language (which I did for Haskell and Common Lisp), or, as was the case this time around, to play around with libraries. It was the first bit of code I wrote using Moose, Test::Class (the tests actually pass!) and, most recently, Curses::UI.

There's nothing special about it. It has basically become my sandbox for Perl libraries. Perhaps others would find it useful, though.