You might need to install a fair bit of stuff,
sudo apt-get install unixodbc unixodbc-dev tdsodbc freetds-dev freetds-bin -y
There’s a neat trick you can do to automatically configure FreeTDS on you Ubuntu machine (discussion here: https://gist.github.com/rduplain/1293636)
sudo dpkg-reconfigure tdsodbc
This will write data to
/etc/odbcinst.ini for you. This file configures which drivers FreeTDS will use. You could write this by hand, but this operation reduces the risk for error.
I was trying to access a remote server using
pyodbc and I was providing a connection string like,
conn = pyodbc.connection('DSN=<dsn>;UID=john.doe;PWD=<password>')
For some reason, I wasn’t able to connect at all. It turns out that I needed to put a space after
UID… it’s weird, but it worked. Maybe this is because there was a dot in my UID? I’m not sure. You can also set the UID and PWD in
/etc/obcd.ini, but that’s probably not ideal.
If you’re stuck, you can list the connections on a given host with this,
tsql -H <host> -L
You’ll probably need to install tsql, which I think is located in the
freetds-bin package listed above.
I keep forgetting how to do this:
brew install imagemagick
convert out/*.png out.pdf
Vagrant is a tool that you can use to set up, configure, and access a VM through the command line. This is a life changer. I love it. In this post I’ll walk through setting up an OEL6 virtual machine, installing a non-ancient version of Python, and configuring the port forwarding so that you can use it for backend web development. (The port forwarding is not obvious on RHEL/OEL.)
Continue reading Use Vagrant to Manage an OEL6 Virtual Machine →
I use cURL quite a bit when debugging APIs and I found this neat trick for pretty-printing JSON output. Add the following line to your
alias json="python -m json.tool"
Then you can pipe your cURL output through your new
json tool and print everything nicely,
curl -g http://some.domain/api/call | json
When a node application crashes unexpectedly, you might get a
EADDRINUSE, Address already in use error when you try to restart it. This means that the port you’re using is already being used by the crashed application. What you need to do is fun the PID of that process, and then kill it. There’s more than one way to skin that cat, but I like to use
netstat. N.B. You’ll need to run this as
sudo for it to work.
Continue reading Handle EADDRINUSE Error in Node →
I found this great tutorial on
tmux by Daniel Miessler that was designed to take you from “wtf tmux” to “omg tmux” with extreme haste. I’m reproducing parts of that blog post here because I find myself googling it at least three times a day. (Because it’s that useful.) Briefly,
tmux is a utility that allows you to connect to a remote server, start a job, and then log off without quitting your job. When you log back in from another location, you can access that job again through
screen utility also does this, but not as well. For instance, if you have a really long username, then you might not be able to start screen, because edge cases.
Continue reading Using tmux →
For whatever reason, you might find yourself in an environment that has Python 2.6, but pip for Python 2.4 or 2.7. Where do you find pip for Python 2.6? Well, that’s not to hard. Go to https://bootstrap.pypa.io/get-pip.py and run the following:
sudo python2.6 get-pip.py
Then you can install Python 2.6 modules with pip by saying,
sudo pip2.6 install awesome-sauce
This post is sort of an amalgamation of solutions I’ve found on several blogs, tutorials, and SO posts I’ve used regarding SSH keys. I cover key generation and authentication, removing passwords from keys, and identifying the key finger print.
Continue reading Operations on SSH Keys →
Today I Googled something like “julia lang compiled” for the umpteenth time in several months, and then I remembered that Nimrod existed, except it’s Nim these days, and it might make it to version 1.0 any week now. I decided to look around a bit, and I discovered that the documentation seems to have improved, and the language has gotten more fleshed out. I decided to try two small things I’ve been doing a lot of lately, SSH-ing and HTTP-getting and posting, and see what they look like in Nim.
Continue reading Two Quick Nim Scripts →
Sometimes you download something and install it from source, and then you realize you need to uninstall it for whatever reason. First you need
cd into the installation directroy, re-install with the
--record option, and then use
xargs to remove everything .
python setup.py install --record files.txt
cat files.txt | xargs rm -rf