Linux ‘date’ stuff I didn’t know until recently.

I’ve been using Linux for a long time but I had no idea you could do this.

evan@evbox:~$ date -d yesterday
Thu Jul 25 12:44:39 EDT 2013
evan@evbox:~$ date -d '42 days ago'
Fri Jun 14 12:44:51 EDT 2013
evan@evbox:~$ date -d '65 minutes ago'
Fri Jul 26 11:41:18 EDT 2013

As epoch:

evan@evbox:~$ date -d '65 minutes ago' +%s


Digital Ocean – First Impressions

For the past few years I’ve been hosting this site on an old desktop in my basement on my FiOS connection. This was one of the things I really liked when I switched from Cablevision to Verizon – they don’t block port 80 inbound, so I didn’t have to pay for separate hosting. My “server” was an old AMD desktop with 1 gig ram and a sata drive. It was ok; my site was slow but I was ok with that. I configured Nginx to cache the static assets which sped most things up to “ok” levels but it was never fast.

This setup had a bunch of problems though, and the biggest one was power. Namely, it goes out in my house all the time. I probably have 4 or 5 brief outages each month, and my old box doesn’t come back up properly on reboot (some bios conflict with an eSATA disk I have hooked up to it). Plus, since my basement became a huge bathtub during Sandy, my site was down for about a month, but that wasn’t really a big concern at the time.

Anyway, via a “Promoted Tweet” on Twitter I found Digital Ocean, a VPS provider with rates starting at $5/month for an SSD-backed VM. They also had a promo at the time for a $10 credit, so I figured I’d give it a try.

Account creation was simple and I didn’t need to enter my CC until I actually created a server (“droplet” in their parlance). Server creation was pretty trivial: select the OS image (I chose CentOS 6.4 but they offer Ubuntu, Arch, Debian and Fedora as well), the size (512 MB ram through 16 GB), the region (San Francisco, New York, or Amsterdam), enter a hostname and your SSH pubkey. In about 60 seconds your server is ready to go, with a public IP and everything. My VM has a 20 GB disk and the base OS install was about 900 MB. I installed Apache, Nginx, MySQL and some other stuff, then dumped my WordPress DB and uploaded it to the new VM and copied the entire Apache docroot over as well. Within about 30 minutes of spinning up the VM I had everything up on the new box, and I made the DNS changes shortly after that. Pretty straightforward.

It’s only been a couple of days but so far I’m really liking the performance. My site doesn’t get a lot of traffic to begin with, but since I cache most stuff to disk, and the disk is SSD, it’s really quick. I’ll keep an eye on it but so far this is looking like a great choice for small website hosting. The only thing is I’ll need to setup some sort of offsite backups, but I can just cron an rsync to my home machine for now.


Why I love and hate Citibike

When I first heard about Citibike, I had just started working in Manhattan. I walk about ten blocks each way between Penn Station and my office on 6th Ave & West 23rd Street, which takes about 15 minutes or so, so the prospect of reducing that time was pretty appealing. Also, I should add that I just fundamentally hate walking. It’s just too slow. Before I got a car at the age of 17 I rode my bike everywhere. When I went to college I rode my bike to every class, even in 3-foot snowdrifts of a New Hampshire winter. After I took this job I looked into some folding bikes that I could actually bring with me on the train to work. That’s kind of a huge pain in the ass, plus the folding bikes start at around $700, so that wasn’t realistic for me. So I was pretty excited at the prospect of Citibike.

After it rolled out a few weeks ago, I did a 24-hour rental and rode from 33rd & 7th Ave (across from Penn) down to Broadway & 24th. It was fun and it was really quick. Actually, I didn’t save much wall time over just walking, but that was due to the time I spent getting the bike and getting used to riding a bike down 7th ave and then down Broadway, which was a bit jarring my first time. But that test was a enough for me to decide it was worth the $95 to sign up for a year.

My key came over the July 4th weekend and I’ve attempted to bike from Penn to the office every day this week, and back up to Penn in the afternoon. For the most part, I love it. The main thing I don’t love is exactly what I suspected would be the entire program’s downfall: lack of bikes where you need them, when you need them. Today’s Friday, and this is the second morning this week where there hasn’t been a single functional bike in a 5 block radius of Penn Station when I got in. On the LIRR on my way in, the Citibike app showed 12 bikes available at the 7th Ave & 31st Street station. By the time I got to street level (15 minutes later) there was only one bike in the dock and it had a red light indicating it was broken or otherwise unavailable. This was frustrating, but I checked the app and it showed there were 5 bikes available at the Broadway & 29th Street station, so I walked over there. This is kind of out of the way, but even biking 5 blocks is worth it (especially since I paid for the pass, and I like to use what I paid for). When I got there, one of the bikes was completely flat and the other four showed red lights. So even though there were 5 physical bikes there, as the app said, there were none I could get. I understand that things break, and as long as they get fixed I don’t have a problem with that, but if the dock knows the bike is broken (as evidenced by the red LED) why show it in the app?

Screenshot of the citibike app showing no bikes available between 34th&7th and 23rd&6th.
Screenshot of the citibike app showing no bikes available between 34th&7th and 23rd&6th.

After that, I just decided to walk the rest of the way since there were no other stations on my way. Maybe “hate” is too strong of a word; I still think Citibike is a great idea and I think they’ve done a great job for the most part, but none of that helps me if I can’t actually get a bike when I want one. I don’t know if there’s a solution to this, maybe they could incentivize people to drop bikes off at high-traffic sites during off-peak times so they’re available during peak times? Or maybe they just need more docks at the major hub areas. In any case, on my walk in this morning I started reconsidering buying my own folding bike.