The Latest

Explore the Russian Troll Tweet Dump

NBC has published a database of the deleted Russian troll tweets. There’s even a nifty graph database for exploring them, Neo4j.

But what if you want to explore the data in your own PostgreSQL database? Here is some SQL to create the database and tables, import the CSV files, and convert text data to more convenient formats:

Tested on PostgreSQL 9.3.21, may require adaptation to work with other RDBMSs or versions. Enjoy!

New Tool: SQL to CSV

I write a lot of SQL queries at work and, quite regularly, find myself exporting them to CSV files. PostgreSQL’s command line client, psql, has a command to handle this task – \COPY – that you can use to output the results of a SELECT statement to a local CSV file. It looks like this:

\COPY (SELECT * FROM foo) TO '~/output.csv' CSV

That works well, but it’s tedious to constantly convert commented, indented SQL into a one-line COPY command. Sure, I could create a macro in my text editor to handle this. Since I’m probably not the only person annoyed by this though, I created a simple tool anyone can use to automate the conversion: SQL to CSV. Give it a try!

Screenshot of SQL to CSV tool

Desk Hacks

My wife and I have, between us, four laptops, two phones, and a number of other USB accessories. It’s hard to keep them all charged, and traditional power strips located on the floor are inconvenient. There was definitely room for improvement. Here’s what I came up with! More…

Onboarding New Hires

Words every onboarder (and team member) should live by:

Treat every question as an opportunity for a conversation.

Cheers to for the delightful discussion that produced this bit of wisdom.

Certbot Renewal Script

Now on GitHub: certbot-renew, my super-simple bash script for renewing Let’s Encrypt certs.