Program Aliases and the Windows Command Line

I was looking for a nice way to alias ’emacs’ at the Windows command line, and learned a new thing about the ‘doskey’ command.

doskey emacs=c:\emacs\bin\runemacs.exe $*

will let you type:

c:>emacs somefile.bat

and pop up an emacs window to edit that file, which is a handy thing if you want to quickly edit a file while you already have a terminal open.

Also described is adding an env.cmd file and changing your cmd-loading shortcut to initialize your terminal with the doskey and other handy things.


Python and the WordPress Jetpack Stats API

I found myself refreshing the WordPress Jetpack stats page a lot, so I wrote a short script to take care of that for me. It refreshes every 10 minutes hour. Don’t forget to add your Jetpack API key. And your own sites.

(assumptions: you have Python installed and have a plain-text editor handy. PyCharm and Emacs are probably overkill for this exercise, but that’s all I’ve got.)

# your API key, maybe hidden in your dashboard somewhere?
api_key = 'your_api_key'
refresh_rate = 3600 # in seconds, so, every hour.

# all of your sites you care about and are allowed to check
sites = [

import urllib2
import time
from datetime import datetime

# make the url that gets the data
def get_api_string(key, blog_uri):
    return '' + key + '&blog_uri=' \
        + blog_uri + '&table=views&days=1&summarize'

# get the views from the url that gets the data
def get_views(key, uri):
    views_url = get_api_string(key, uri)
    response = urllib2.urlopen(views_url)
    result =
    views = result.split("\n")[1]
    return views

# do the things!
while True:
    print str(
    for site in sites:
        print site + ": " + get_views(api_key, site)

Then run it like this in a terminal window:


Then kind of resize the window and put it someplace.

Terminal Image

And you’re all set!