I was interested in performing system calls from Swift, and I found a resource that I had to modify somewhat. I imagine that the language has changed since that post was written. At any rate, here is the working code,
Monthly Archives: April 2015
Two Quick Nim Scripts
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.
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 .
python setup.py install --record files.txt cat files.txt | xargs rm -rf
I’m not sure what this is, but I had this amazing dish in one of the most depressing shopping malls on planet Earth, near Cupertino, CA, and then again at a great pho place in Mountain View. (Correction: it’s called bun, and I’m ignorant.) The basic idea is lettuce, mint, rice noodles, and something savory, like a chopped egg roll, shaved pork, or chicken or something.
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.
Book Mode in Vim
Sometimes you have a lot of code, and your screen isn’t tall enough. I found this blog post that shows you how to set up Vim in a sort of “book-mode” where you have two or more panes that scroll synchronously so that you can see two or more pages of code at once.
Poisson Disk Sampling
I’ve borrowed (stolen) code from this iPython Notebook hosted on GitHub from the PyData NYC 2014 conference. I didn’t like the
local call in the original code, so I made it object oriented. (Full disclosure: I’d never seen the
local keyword before, so I stuck with the devil I knew.) I also wanted syntax reminiscent of
scipy.stats, so I added a
.rvs() method from extracting a sample from the Poisson disk object.
Generating Sub-random Numbers
Sub-random numbers sort of look random, but they aren’t and they usually provide better coverage over an interval which is sometimes more important than having truly random data. For example, you wouldn’t use sub-random numbers for encryption, but they’d be great for performing Monte Carlo calculations. You can read more about them on the Wikipedia page for low discrepancy sequences.