Interviewing at Google

I’m sick and tired of seeing Google’s bullshit “this stuff matters” advertising as part of their latest privacy policy update (which I’ve been doing my best to ignore).

As I was complaining about it I thought I’d try and find some examples of their hypocrisy. I’m fairly sure I’ve seen articles before where people said their job for a Google interview was to process gigabytes of web logs. If you’re data-mining web logs to *spy* on people on the one hand and then telling people you’re protecting their privacy on the other hand then you’re a lying sack of shit really, aren’t you?

Anyway, I didn’t find what I was looking for in a big hurry and I don’t really have time for this, so I’m giving up on my little fact finding mission and just going back to ignoring the whole thing.

However, during my web search I found this article, My Job Interview at Google, which seems like a fairly content rich article. I’m particularly interested in the resources that the guy linked to in his post. So figured I’d swing by my blog and make a note so that when I have some free time (hey, could happen) I can go over that post and read the reference material.

Using gzip, or bzip2, or..?

Wanted to know a little more about the pros and cons of different compression tools and strategies.

Found this article A Quick Benchmark: Gzip vs. Bzip2 vs. LZMA and looking at that gzip is a pretty clear winner I think wrt my concerns (i.e. fast compression over high compression). Also found gzip vs. bzip2 which concluded basically the same.

Removing colour code special characters with sed

I want to post-process the output of an ‘ls’ command with ‘sed’ so that I can remove the ‘./’ prefixes that I can’t avoid going into the ls output (this is a result of using ‘find’ safely).

The thing is, if I pipe ls output to sed, then the default –color=auto setting applies and ls detects that it’s not talking to a terminal so doesn’t output colour codes. But I want colour codes, usually, so I need to change the ls command to use –colour=always, which I’ve done. This means I can have colour and also have sed format the ls output.

The problem is then what happens if I want to pipe my output to ‘less’? Then the colour code commands appear as garbage in the output stream. So, usually I want colour codes, and sometimes I don’t.

I found this article, Remove color codes (special characters) with sed, which helped me come up with the following bash alias:

 alias noco='sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"'

So now that I have the ‘noco’ alias (short for “no colour”) I can pipe my output through that if I want the colour codes removed, which I can apply before piping output to less.

It’s a little bit annoying that I have to do things this way but I haven’t been able to think of a better way to make it all work and this all seems to get the job done.

phpMyAdmin QueryHistoryDB

The SQL History feature of my phpMyAdmin setup wasn’t working, the history table had been configured correctly as ‘pma_history’ but there was no data being written into that table when I ran queries and the SQL History tab of the query window just showed a blank.

Eventually I figured out that in order for the pma_history table to be populated I needed to set the QueryHistoryDB setting to true. So I did that and now SQL History is working!

MySQL SSL connections not working with phpMyAdmin and mysqli

I had a problem with phpMyAdmin not using encrypted connections.

My server was correctly configured for SSL as indicated by:

SHOW VARIABLES LIKE '%ssl%'

Which returned:

Variable_name Value
have_openssl YES
have_ssl YES
ssl_ca /etc/mysql/cacert.pem
ssl_capath
ssl_cert /etc/mysql/server-cert.pem
ssl_cipher
ssl_key /etc/mysql/server-key.pem

However when I ran:

SHOW STATUS LIKE 'Ssl_cipher'

I got back a null result, indicating that the connection was not encrypted.

Eventually I figured out that the problem was caused by using the ‘mysqli’ provider for my connections in phpMyAdmin. When I switched my connections to use ‘mysql’ instead then encryption started working and an Ssl_cipher was reported.

I’d love to know what the actual problem is, but for now I’m just happy that my connections are actually encrypted. I spent a while hacking on the mysqli dbi interface to try and get it to play nice with SSL but I didn’t make any progress.