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 …
Tips
Connecting to PostgreSQL in Python with PyOdbc in Mac OS X Yosemite
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
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
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
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()
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
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
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 …