Bookmarks, Domains, and Blogs

I was feeling extra ambitious last night so I knocked out a bunch of things that have been on my todo list for awhile but never had gotten around to.

I went through my 1,200+ bookmarks that have accumulated over the years and purged just about every single one. I made a backup first, which helped me be aggressive. Down the road, should I need to dig one up, I’ll be able to. Otherwise that file will sit quietly on Dropbox, out of sight and out of mind.

I found most of my bookmarks fell into one of two categories: a news article I saved to read later and resources I discover when I’m diving into a new project or learning about a new technology. Going forward, I’m going to start clearing out unread news articles after about a week. For technical resources, once I’m finished with a project I’m going to cull the bookmarks to the especially helpful ones and then toss them up to Pinboard.

After that, I went through my collection of domains and disabled auto-renew for the ones I’m not using anymore. Starting in February 2018, I’ll be down to ericdavis.io, hnrss.org, and a domain/email package I set up for my parents. While the .io TLD is pricier than more common TLDs, I love that it has my full name in it. My goal is to eventually shift all my side projects into subdomains of ericdavis.io. I also started a new project. I created links.ericdavis.io, the future home of a linkblog I’ve had on my mind for awhile. I think linkblogs are an underutilized style of blogging, and I’m hoping I can breathe some life into the format. Stay tuned.

Finally, I took the posts from my two previous blogs and imported them into blog.ericdavis.io. The importer was a bit on the slow side (I have this blog hosted on wordpress.com), but overall they came in just fine. Also, I simplified the categories down to Technology and Sports.

Advertisements
Posted in Technology | Leave a comment

Golang in one word? Productivity

I’ve been batting around this idea over the past few days. Golang is a great language and it has many superb features, but if I had to distill what I like so much about Golang into one word, that word would be “productive.” I feel so incredibly productive writing Golang code.

Start with the documentation. I love Golang’s documentation. I don’t know how much of it was a conscious decision by the developers, but the “culture of documentation” that I loved in Python is very much alive in the Golang community. Reading the documentation of standard library packages on godoc.org made a language I didn’t know just a few weeks ago much more understandable. I’ve been able to easily integrate third-party packages into my code because they were all well documented.

Coming from older languages, the tooling around Golang feels so modern. go get and you’ve got the package on your system, ready to use. go fmt and you don’t have to waste cycles on getting the format just right. go install and you’ve got a binary or a library in a few seconds. And the Github support! We developers love our Github, so why not make use of it to host code? It’s brilliant.

Then there’s the parts of the language spec itself. At first, I didn’t care for struct tags, but now I’ve seen the light. So much of programming is slinging bits around in XML or JSON — why not include that info front and center? The way pointers are automatically dereferenced when needed lets me focus on what my code is trying to solve, not the nuts and bolts of memory management.

I’m still getting my feet wet with Golang but I haven’t felt this productive in a new language in a long time.

Posted in Technology | Leave a comment

How to track traffic in Google Analytics without JS

I’ve long wanted to hook up the RSS feeds on hnrss.org to Google Analytics so I could get a better sense of what kind of traffic the site got. But because the feeds are delivered as XML, I had to figure out a way to do it without JavaScript.

After some poking around yesterday, I finally figured out a way.

Google Analytics has a Measurement Protocol API built for this sort of thing. You send a HTTP request (POST and GET both work) with the necessary parameters, and it’ll register the hit in your Analytics property.

After testing it out locally using curl and seeing it all work, it was time to integrate with the app.

After searching around for awhile, the eureka moment came when I discovered the post_action feature of NGINX. This enabled me to hit the Measurement Protocol API after serving the feed.

Here’s the necessary bits that I had to add to my NGINX config to get it all working:

# replace UA-XXXXXXXX-Y with your Analytics property ID
location @GA {
  internal;
  resolver 8.8.8.8 ipv6=off;
  proxy_pass https://www.google-analytics.com/collect?v=1&tid=UA-XXXXXXXX-Y&cid=$remote_addr&t=pageview&dp=$request_uri&uip=$remote_addr;
}

server {
  # the standard stuff (server_name, listen, etc.)
  location / {
    # no changes needed other than adding post_action
    post_action @GA;
  }
}

Also, directly passing the User-Agent (e.g., ua=$http_user_agent) gave me all sorts of problems (I think it wasn’t being properly URL encoded) so I sanitized them with a map:

# N.B. maps have to exist in the http context
map $http_user_agent $user_agent {
  ""                    empty;
  "~Android"            android;
  "~^Slackbot"          slackbot;
  "~^curl"              curl;
  "~^Feedbin"           feedbin;
  "~^Tiny Tiny"         ttrss;
  "~^NewsBlur"          newsblur;
  "~^Feedly"            feedly;
  "~^Go-http"           golang;
  "~^UniversalFeed"     feedparser;
  "~^Zapier"            zapier;
  "~^PHP"               php;
  "~^python-requests"   python-requests;
  "~^Mozilla"           mozilla;
  default               other;
}

Then I added ua=$user_agent to the URL. Not ideal, but good enough for me.

Posted in Technology | Leave a comment

Introducing my college basketball ratings system

With conference play starting up, I’ve finally put the finishing touches on my college basketball ratings system: EJD CBB Ratings. I wrote a bit about the technical details and how it came about here.

Its goal is to predict the outcome of game featuring any two college basketball teams. It also serves as a way to teach myself more about sports ratings systems in general and matrices/systems of equations in particular.

Posted in Sports, Technology | Leave a comment

Good luck, UNLV

When you’re a UNLV basketball fan, you’re used to knots in your stomach. No lead feels safe until the final buzzer rings. Opposing players put up career days with alarming regularity. Bottom feeder teams come out swinging against the former World Champs and steal one on your home floor. But those knots usually subside once the season wraps up.

When Mick Cronin flew back to Cincinnati without being announced as the new head coach, I knew the knots would be here to stay during the offseason, too.

Spurned by Cronin, Chris Beard and Marvin Menzies interview for the job and Beard is hired within 48 hours. The ponderous Board of Regents begins its approval process while players — current and future — get as far away from the program as possible. After a jaw-droppingly awkward meeting where the contact is finally approved, Beard gets to work stabilizing the program. Nearly every remaining recruit in the country with a pulse is offered. It’s going to be tough and the first year will be ugly, but if anybody can do it, it’ll be Beard. The Rebel mustache now has a matching Beard. The dumpster fire appears extinguished when Tubby Smith gets a call from Memphis.

Smith to Memphis happens quickly and the hypotheticals begin appearing immediately. “What if Beard jumps ship to Texas Tech? Wouldn’t that be wild?” Hours without any official word from Beard or UNLV turn into days. The odds-on outcome is no longer Beard staying, but Beard leaving. A jet from Texas arrives. This is really happening. The Chris Beard era at UNLV is coming to an end. An official announcement is made and the coaching search hopes the third time is the charm.

Menzies gets on a flight to Las Vegas so quick there is a trail of dust following him. This is his dream job and he doesn’t care how bad of shape the program is in. Menzies should have doubled his salary request. Could UNLV have said no? I doubt it. The program starts from scratch, again. Menzies gets an early win by convincing Morgan to stay. Every little bit helps. Recruits and transfers start becoming official. Slowly, the program begins to turn around.

But as UNLV begins conference play tonight, I feel more disconnected from the program than I can ever remember. Nervousness about games has taken a back seat to apathy. Outside of a handful of players, it’s all new faces. It’s going to take a few years for Menzies to get the players he wants, I understand that. And Las Vegas is an easier sell than Las Cruces so I have no doubt he’ll get the players eventually. One day, we’ll have a team with the Marvin Menzies stamp of approval. But until then, this season feels like going through the motions. It’ll be a slog through a bad, one-bid Mountain West Conference. At best, we’ll pin some losses on the bad teams and stay close with the good ones. Most painful of all is watching UNR become the new powerhouse with a chance of winning the league championship inside the Thomas & Mack. Them having the cannon and a championship is the darkest timeline.

I will always love UNLV and be a fan of UNLV athletics. Hopefully a new athletic director can begin fixing Kunzer-Murphy’s many missteps made during her helm. Hopefully Menzies proves me wrong and makes UNLV into a contender this year and going forward. I didn’t get into football, but hopefully Tony Sanchez can finally break through with a bowl next year along with winning back the cannon.

But that’s a lot of hope for a year that wasn’t very hopeful.

Posted in Sports | Leave a comment

First season of fantasy football

I participated in my first ever fantasy football league this year. Overall, I was surprised at how much I enjoyed it. I finished 4th out of 12 players, which is the highest a first-time player has finished in the decade or so history of the league. Unfortunately, it’s just out of the money. But I can’t wait play again this season. I’m even debating whether to start a league at work. Try my hand at being a commissioner.

Posted in Sports | Leave a comment

TIL for February 26, 2016

Enable WordPress maintenance mode

Create a “.maintenance” file and include the following:

<?php $upgrading = 1455233470; ?>

Place the file in the root of a WordPress installation.

The number is a UNIX timestamp. If the timestamp is less than 10 minutes ago, the “maintenance mode” screen will be displayed. After 10 minutes, WordPress bypasses maintenance mode and loads the site as normal.

Maintenance mode will also be bypassed if the file exists but is empty.

Posted in Technology