The most token of token gestures

Due to regular disruptions in the Sony PlayStation Network (PSN), Sony have kindly offered to extend my PlayStation Plus membership by one single day.

I know the DDOS attacks on their network weren’t their fault, and I don’t condone the actions of imbeciles with axes to grind. But a PlayStation Plus membership currently costs $69.95AUD. Divide that by 365 days in a year and you get: 0.19 cents. Sorry for messing you around, but here’s 19 cents.

I’m not even going to waste my time typing in that code for 19 cents. So if anyone else wants it, please, have my code, it is (as posted) un-redeemed:

Sony 1 day extension

Thanks, Sony.


Addendum: My VPS provider, Linode, were also under sustained DDOS attack over the Christmas period. I wasn’t aware of this when I sent them a support request wondering why this site was getting rather wobbly, but they explained the situation and I let them deal with it and ride it out. When it was over, I received an email saying that they were sorry for the disruption to service (again, entirely not their fault) – and that they’d credited me $10 on my VPS hosting:

Support Ticket [REDACTED] regarding account ‘[REDACTED]’ has been updated by ‘tkelso’

————————————————–
Hi,

You recently requested a credit for the downtime that your Linode(s) incurred. First we would like to start by apologizing for the outages and the disruptions the downtime may have caused. As you may already know the downtime was caused by multiple large scale DDoS attacks. We’ve done our best to communicate the details of these attacks on our status page, and we’ll be releasing a full post mortem.

http://status.linode.com/incidents/mmdbljlglnfd

We’ve put various safeguards in place to protect our infrastructure and above all else you, our customer, from being negatively impacted by future attacks. It’s our belief that the considerable protections we’ve leveraged have already been successful in deterring further attempts to disrupt our networks. Because of this we’re now able to precisely calculate the amount of downtime suffered by each Linode.

In accordance with our SLA, each Linode that experienced disruption of service would be entitled to a credit based on its established hourly rate, for however long the downtime occurred outside of the 45 minute window defined by our 99.9% uptime guarantee. However since this was a departure from the standard of reliability you’ve come to expect from us, we’ve chosen to exceed our SLA guarantees. Instead we’ve made an effort to offer reimbursement that demonstrates our appreciation for the patience and understanding you’ve shown, as well as for your continued business. With that in mind, we have applied the following credit to your account for your Linodes in London:

$10.00

We consider it a privilege to be your hosting provider, and we’ll continue working to ensure that you’re receiving the best service possible. If you have any questions or concerns, please feel free to let us know.

Kind Regards,
Tim

I didn’t request a credit at all – I just enquired why the site seemed to be up/down/up/down a lot – and they explained the situation and gave me a generous credit instead of a token gesture – which is why Linode have yet again grown in my estimation, and Sony have not.

How To: Copy a file to a FTP server from the command line

A nice, easy way to upload files to FTP servers is via some graphical client like FileZilla, but should issues occur or you need to transfer the file without a GUI, then can also upload files via scp like this:

For example, if I want to upload a file proving bigfoot exists (in the imaginatively named file: bigfoot_exists.mp4) to the domain example.com on port 1234 to the user (on that site) somefool in their home directory (i.e. ~), then I’d use:

Job done.

Addendum – Copy from server to local

$ scp -P 1234 remote_host_username@remotehost.foo:some_file.txt /some/local/directory

For example, if remotehost.foo’s ssh daemon operates on port 1234, I could copy php.ini from /srv/ftp to the “bar” directory in my local user’s home directory as follows:

Useful SQL Commands

I recently needed to take a database with separate date and time columns, convert that combined date-time data into Unix time format (i.e. seconds since the epoch [1st Jan 1970]), and add a new column to the database with that data. It took me a fair bit of googling to get it all working, so here’s my notes.

Sorry this isn’t really in an article format – but I need this written down and available for the future… Also, I wrote a small Java app to read the separate date and time text files and spit out a timezone-correct unixtime text file, which I then added to a spreadsheet containing just the the primary key rows and exported it as tab-separated values suitable for MySQL (or really, MariaDB in this case) import.

Show the table structure for the ‘accidents’ table

Count unique values in the UNIX_TIME column in the accidents table

Find duplicate values in a column (cannot make column a primary key if there are dupes!)

Make a column be the primary key for a table

Drop the UNIX_TIME column

Add a new column UNIX_TIME to the accidents table after the last column (STAT_DIV_NAME)

Add an empty column with no default value

Create a temporary table in memory with a single column called UNIX_TIME which is of type BIGINT

Import from local CSV file

I created a tab-separated CSV file which had just the ACCIDENT_NO as primary key and the UNIX_TIME field. We can then import that data into the temptable with:

Load all the single-line data values fromthe UNIX_TIME.txt file into the UNIX_TIME column of our temp table

Merge the temptable with just the ACCIDENT_NO and UNIX_TIME into the accidents table using ACCIDENT_NO as the primary key

So in this particular instance where I had a partial update, I was missing 13,375 UNIX_TIME values!

Make sure this worked by setting all the UNIX_TIME values in the accidents table to zero, and then re-importing

Now finally, we can drop the in-memory temptable!

Export the database

To export the database we can use the mysqldump utility (this is NOT within the MySQL command line!):

Then to import this dump, let’s say we don’t have a govhack2015 database

Followed by (in the MySQL command line):

It all works! =D

How to stop a MySQL action which is taking forever… (like when I bodge a merge) – in a different MySQL commandline interface

How-To: Fix WordPress plugin updates and DB backups not working

If you, like me, got too big for your boots and tried to lock down your server using ‘best practice’ pre-rolled apache server config settings without fully understanding how they work – then good on us both for trying, but let’s never do it again.

Specifically, I tried to lock-down click-jacking like this in my httpd.conf:

There’s lots to read about click-jacking, but what was most important to me was that it pretty much knackered my WordPress install to the point where I could only update a single plugin at a time, and after every plugin updated I had to delete the “.maintenance” file to get the site back running. That and WordPress and theme updates would complete, but never TELL me they’d completed, so I’d just have to wait a while then go back to the admin page and hope for the best.

Anyway – if you have this issue, and have used X-Frame twiddling stuff in your apache config, the short answer is: Don’t.