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.
Tag Archives: OS X
Uninstalling a Python Module from Source
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 [1].
python setup.py install --record files.txt cat files.txt | xargs rm -rf
Introduction to Graph Tool
I started reading about network statistics this morning and I wanted to experiment with the available Python tools. It looks like the state of the art is graph-tool. I had a little trouble installing the software on my Mac, but there is an evolving guide to this process here.
Making and Changing into a Directory
This function, added to your shell profile, will allow you to create directories and cd into them in one fell swoop, without you having to type mkdir
, and then cd
ALL DAY. After looking around online, I like the name mkcd
for this utility, because md
makes me think of markdown.
For some reason, I couldn’t get this to work as a one-liner in my .zshrc
file, but the listing below worked fine.
function mkcd () { mkdir -p $1 cd $1 }
Note that the -p
flag allows you to create a directory several directories deep at one go, without having to descend into them one at a time.
Visualizing Networks with Graphviz
In this post I’ll look at building graphs in Python using the graphviz
module. This assumes that you’ve installed graphviz itself, which is easy enough on a Mac using homebrew. (Simply run: brew install graphviz
.) I had two requirements for my graphs: I needed them to be directed, and I wanted to use the edge thickness to illustrate the strength of a connection. The first part was dead simple, but the second part required a little hunting.
Measuring the Terminal
I found this site with a lot of neat terminal tricks, like making text bold, changing colors, and adding a progress bar. I use the recipe for measuring the width of the terminal a good bit, so I’ll reproduce that here.
Using Optional Values in Swift
Optional Values
Swift has a nil
keyword that is sort of like the None
keyword in Python; however, regular variables and constants cannot be nil
. In order for a variable to be nil
, it must be initialized as an optional. (Constants cannot be nil
or optional.) An optional is decalred by appending a question mark the variable type. For example, the two statements below are equivalent.
Installing Canvas for Node on OSX
I’d like to work with Processing.js, but I had trouble installing the canvas
dependency. This should be as easy as,
$ npm install canvas
But there’s a thingy that doesn’t work in Homebrew. I found the answer in this thread on their GitHub. On OSX you have to call this command before you can install canvas
:
$ export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
Then we can install canvas
and processing
using npm
like we’d expect.
Creating a Flowchart with TikZ and LaTeX
In this post I’ll discuss how to make simple flowcharts in LaTeX using TikZ. Probably the best collection of TikZ examples can be found at TeXample.net, but there are other helpful examples like these two PDFs, here and here. In case you’re wondering, TikZ is a recursive acronym “TikZ ist kein Zeichenprogramm,” a reminder (in German) that it is not an interactive drawing program.
Getting LaTeX working on a Mac
In this post I’ll describe how to get LaTeX up and running on a Mac. First of all, it’s not as easy as just going, brew install latex
, and then saying, pdflatex kapow.tex
, but it’s not as hard as doing literally anything on Windows either.