Hans Van Slooten

Sports, Technology, and Analytics. Not necessarily in that order.

Tips for Effectively Setting up GNU Screen

leave a comment

I use GNU Screen on a daily basis. When you are are working on remote server (which I do for much of my development), it is a necessity for easily switching between multiple applications and will save you from losing your work when you get randomly disconnected from the server due to a network outage.

That said, GNU Screen out of the box needs a few tweaks to be really effective.

The Status Bar

By default, GNU Screen doesn’t turn on the status bar. This is the most useful feature that you can enable in Screen. So, open up your .screenrc file and add following lines:

# Voodoo
hardstatus alwayslastline "%{b WK}%H %{r}%1` %{K}| %{G}%C %A %{K}| %{B}%m/%d/%Y %{K}| %{G}%l %{K}| %{-b WK}%u %-w%{= rW}%50> %n %t %{-}%+w%<"

# Enable bold colors
attrcolor b ".I"

This is what your status will look like now (with a few windows open):

GNU Screen Status Bar

Since I use a white background on my terminals, you may need to change the codes for some of the colors. For details on how to do that, see the manual.

Escape Command Key

The Escape Command Key is the way that you execute commands in GNU Screen. For instance, if you would like to create a new window, by default you would press [CTRL]+[A] [C]. The only problem with this is that [CTRL]+[A] is commonly used in applications to return to the beginning of the current line (e.g. Emacs, MySQL console, Bash, etc.). Because of this issue, I like to reassign it to a less used key, like [J]. To do this, simply add the following line to your .screenrc:

# Remap command key to Ctrl+J
escape ^Jj

Visual Bell

By default, GNU Screen will blink the screen when an application would normally beep. This is incredibly annoying and can be disabled with the following line in your .screenrc:

# Disable annoying visual bell
vbell off

Application Titles

The final bit I like to have is my application names in the status bar. By default, GNU Screen will usually just show “BASH”. To fix this first, add the following line to your .screenrc:

# Some voodoo to get the window titles to be the running app
shelltitle "$ |bash"

Next, if you are using Bash, you need to add a little voodoo to your prompt. Open your .bashrc (or possibly .profile or .bash_profile) and edit your prompt line. For instance if you have prompt like:

export PS1='\u@\h:\w\$ '

Edit it to look like this:

export PS1='\[\033k\033\\\]\u@\h:\w\$ '

Those escape codes will tell screen to update the title with command you are running. So now your status bar will look like this when you run applications:


Now you should have a much more usable GNU Screen setup.

Written by hvs

November 3rd, 2014 at 4:12 pm

Posted in Hacks

MN Wild Zone Entries/Exits for October 9th, 2014

leave a comment

Over the course of the 2014-15 season I plan on tracking the zone entries and exits for the Minnesota Wild and see if there is any useful/interesting information there. I will also be making this data available to the general public for use.

One interesting thing about the first game versus the Avalanche is that the Wild had 58 carry-ins to 37 dump-ins while the Avs had 28 carry-ins to 41 dump-ins. Since carrying the puck in has been found to be more effective, it’s good to see the Wild’s Carry-in Zone Entry % of 62% versus the Avs’ 41%. That’s in all situations and only one game, so it’s too small of a sample to draw any larger conclusions, but if this is sign that the Wild have adjusted to a more… statistically sensible style of play, it could bode well for the Wild.

The first of these data sets are now available:


Previous games and other files will be available on the MN Wild Stats Project page of this site.


Written by hvs

October 17th, 2014 at 3:11 am

Posted in Analytics,Hockey

Dominant Twins Batters from 1961-Present

leave a comment

I wrote a brief post examining the dominant Minnesota Twins hitters from 1961 to today over at Twins Daily.

UPDATE: Twins Daily was recently updated to a new CMS which seems to have lost the actual image for the article. I’m reproducing the original article here.

With the All-Star Game just around the corner, it’s a perfect time to look at some of the best batters throughout Twins history and see how their paths crossed over time. While having a great collection of hitters is one part of a playoff caliber team, the following chart shows that it is a necessary, but not sufficient criteria.

Looking at WAR over time (in this case, from Baseball-Reference.com) is a good way to get a general sense of the quality of batters over time as it is adjusted for era and playing environment.

(Click here to see the chart much bigger.)

A few interesting things jump out from looking at this chart:

  • The “lean years” of Twins wins (mid-70s to mid-80s, mid-90s to early-00s) were also lean years for impact bats. But also notable is that some of the best years for Twins individual batters (Carew and Knoblauch, specifically) came during those “lean years”.
  • Harmon Killebrew’s career stands out for both its longevity and consistency. Every Twin fan knows that “Killer” was a great player, but placed against the other great hitters of Twins history, it becomes even more obvious.
  • The late-70s to early-80s were not quite the wasteland for Twins that the chart shows. While the only “dominant” player (picked by an arbitrary cut-off) was Roy Smalley, there were actually a number of other great years in there by Tom Brunansky (1982 being a standout for him at 5.6 WAR, but 1983 and 1984 were also good years with WAR of ~3 each), Hrbek (from 1982 forward), Butch Wynegar (’76, ’77, ’79), and even Rob Wilfong (3.1 WAR in 1979).
  • Rod Carew was really good.

Charts like this are fun because they are really just invitations to do deeper research and look below the surface metrics. Besides the obvious things (e.g. the dominant players of the 60s and the World Series years of the 80s and 90s), there are also the blank spots that beg to be filled in (e.g. what was going on in the late 70s?).

For the next installment of this series, I plan to take a look at the dominant Twins pitchers since the franchise was moved to Minnesota.


  • The idea for this post came from a recent XKCD comic title “Dominant Players over Time“.
  • Data is from Baseball-Reference.com, both the Play Index and individual player pages for WAR.
  • Players were selected for having approximately 20 WAR over their career with the Twins. Ultimately, the value went down to about 17.2 to include Mack, Gagne, Battey, and Span.

Written by hvs

July 12th, 2014 at 5:07 am

The Sportive Podcast – Episode 55: I Don’t Broke My Arm

leave a comment


I was on the Sportive podcast again, this time discussing the Wild/Avalanche series in the first round of the playoffs. It also ventured into discussions of the Frozen Four, the Twins, and the Dutch. Lots of fun:


Written by hvs

April 17th, 2014 at 1:13 pm

Normalizing PITCHf/x Release Point Data

leave a comment

PITCHf/x release points are generally recorded at 50 feet. I say generally, because in the early years (2007-2009) they varied from 40-55 feet while they were trying to determine the best location. In late 2010, Mike Fast published an article arguing that 55 feet is more representative of true pitcher release points (every pitcher is a bit different in reality). Since then, it has become standard practice to renormalize all pitches to 55 feet to make analysis more consistent. The procedure to do this, while alluded to by Alan Nathan, is never really spelled out explicitly. That is what I aim to do here.

The procedure is fairly straightforward (and hence probably why it isn’t normally shown). The equations for the position of the ball at time t are (remember high school physics?):

x(t) = x_0 + v_{x0} t + \frac{1}{2}a_x t^2 \\
y(t) = y_0 + v_{y0} t + \frac{1}{2}a_y t^2 \\
z(t) = z_0 + v_{z0} t + \frac{1}{2}a_z t^2 \\

The equations for the velocity of the ball at time t are the first derivative of the position, so:

\frac{dx}{dt} = v_x(t) = v_{x0} + a_x t \\
\frac{dy}{dt} = v_y(t) = v_{y0} + a_y t \\
\frac{dz}{dt} = v_z(t) = v_{z0} + a_z t \\

Where \((x_0, y_0, z_0)\) is the release point as reported by PITCHf/x, \((v_{x0}, v_{y0}, v_{z0})\) is the initial velocity at that release point, and \((a_x, a_y, a_z)\) is the acceleration.

First, you need to calculate time t for when the ball was at 55 feet. Using the quadratic equation, you can derive t:

a = \frac{1}{2}a_y \\
b = v_{y0} \\
c = y_0 – 55.0 \\
t = \frac{-b – \sqrt{b^2 – 4ac}}{2a} \\

Now, using the equations above, you can calculate position and velocity at y = 55 feet.

Finally, to recalculate start_speed:

|v| = \sqrt{v_{x0}^2 + v_{y0}^2 + v_{z0}^2} \\

Written by hvs

March 10th, 2014 at 12:37 am

PITCHf/x Processing Scripts

leave a comment

I’ve uploaded some (very) rough perl scripts for processing PITCHf/x data to Bitbucket. These can retrieve the data, create the database, and store the data to the database (I know, surprising). They’re not configurable, yet (you have to modify the code to determine what to download). Anyway, I hope to clean up the code in the near future, barring other projects.


Written by hvs

February 24th, 2014 at 2:44 pm

The Sportive Podcast – Episode 45: Geek School with Hans Van Slooten

leave a comment


I was recently asked by the guys over at the Sportive podcast to be on an episode to discuss modern hockey analytics and how they apply to the Minnesota Wild. It was a great time:


Written by hvs

January 28th, 2014 at 7:49 pm

Taking Position at Sports Reference

leave a comment


I’m happy to announce that effective December 1st, 2013, that I will be a contributing member of the Sports Reference development team. I will primarily be responsible for the Hockey-Reference.com website, as well as additional projects across the entire family of SR websites.


Written by hvs

November 8th, 2013 at 7:17 pm

Posted in Announcements,Sports

Remapping Caps Lock to Control in Windows

leave a comment

Years ago — before the creation of Sublime Text — I regularly used Emacs for editing (yes, even on Windows. For anyone who has any familiarity with Emacs, they know that you use the Control key like breathing air. Unfortunately, most keyboards were designed like the Control key was meant for the occasional tap, not continuous usage.


Because of this, I learned that you could remap the Caps Lock key to Left Control to make it more readily available to my RSI plagued hands. Invariably, though, I would have to search the web for the correct registry incantation to invoke this change. Tiring of this, I’ve decided to simply host the solution on this blog. What follows is the necessary changes, as well as an brief explanation of how this works.

Read the rest of this entry »

Written by hvs

July 28th, 2013 at 1:47 pm

Posted in Hacks

SABR Convention 2012

leave a comment

I got a brief mention in Aaron Gleeman’s recap of the 2012 SABR Convention in Minneapolis.


Written by hvs

July 3rd, 2012 at 9:06 pm

Posted in Baseball,Sports