Shared State

Jeff McGee's Blog of Messages Worth Passing

Tips

  • Copying time machine backups to a new disk

    Posted on Sun 12 March 2017 in Tips

    Copying a Time Machine backup from one disk to another is difficult. The official instructions say to copy using Finder. While this may work for a small time machine backup, it does not work well if you have been using time machine for several computers for several years. In particular …

  • Connecting to PostgreSQL in Python with PyOdbc in Mac OS X Yosemite

    Posted on Sat 21 March 2015 in Tips

    I spent an embarassing amount of time on this, so I thought I would document it.

    brew install postgresql unixodbc psqlodbc
    

    Start up postgres:

    postgres -D /usr/local/var/postgres
    

    Check that you can connect to the database:

    psql
    

    Inside postgres, create a user with a password. You probably need …

  • Marking a Vertica Node as Ephemeral

    Posted on Thu 13 November 2014 in Tips

    First you will need to know the name of the node:

    select * from nodes;
    

    Then mark it as ephemeral:

    alter node v_demo_node0001 is ephemeral;
    
  • Using a Vim Clutch

    Posted on Wed 18 December 2013 in Tips

    I've wanted to try a Vim Clutch for a few years now, but once I got it set up, it turned out to be disapointing.

    A Vim Clutch is a foot pedal that toggles between insert mode and normal mode. I set my clutch up a bit differently than the …

  • Problems with prefetch in python requests

    Posted on Thu 11 April 2013 in Tips

    Requests is a great library for making HTTP requests. We're using it quite a bit in Infolab to talk to Twitter. Right before they released version 1.0, Requests made a slight change to its streaming API, so the old code results in this error message:

    Traceback (most recent call …
  • IPython with PyLab Breaks Built-ins like any() and all()

    Posted on Wed 23 January 2013 in Tips

    Ipython's PyLab breaks some uses of any(), all(), and possibly other built-in functions. Here's a normal IPython shell:

    >ipython
    In [1]: all([x for x in [0,1,2]])
    Out[1]: False
    
    In [2]: all(x for x in [0,1,2])
    Out[2]: False
    
    In [3]: all
    Out[3 …
  • Running Screen in a Sudo Session

    Posted on Sat 07 July 2012 in Tips

    If you use sudo su to become a different user, and then try to create a screen session for the new user, it gives this error message:

    Cannot open your terminal '/dev/pts/1' - please check.
    

    The problem is that your original user still owns the pseudo terminal. The best …

  • Create a Python Breakpoint in Vim

    Posted on Thu 18 August 2011 in Tips

    Pdb is Python's built-in debugger. To make it easier to start pdb, I added this line to my .vimrc:

    noremap <D-d> Oimport pdb; pdb.set_trace()<Esc>:w<Return>
    

    When I type Command-d in normal mode, vim will insert the line import pdb; pdb.set_trace() and save the current file …

my photo

Jeff McGee — builder, problem solver, teacher, and general nerd.

Github:
@JeffAMcGee
Twitter:
@JeffAMcGee
Email:
jeffamcgee AT gmail