Category: Command line Fu

  • How many requests per second can I get out of Redis?

    Warning: This is not a very interesting post. I’m toying around with the Redis benchmarking tool. What would be significantly more interesting would be to toy around with the Lua API in Redis, which I’ll do in a subsequent post. In this post, I’ll try to squeeze as many get/set requests out of Redis as […]

  • Hello GNU profiling

    The profiling tool in GNU is called gprof. Here is a short, boring example of how to use it. 1) Write hello world in C (hello.c) #include int foo() { int b = 54324; int j; for (j=0; j < 1000000; j++) { b = b^j; } return b; } int main() { int a […]

  • Taking hadoop for a spin

    Simple. This works.

  • Summary of memcached commands as used through telnet

    The two main things to do with a memcached cluster is getting a key and setting a key to a value. Below are examples of this, with parameters explained (something most examples miss for some reason?). Examples Connect to memcached: telnet [hostname] [port] telnet localhost 11211 Getting a key: get [key] get foo # get […]

  • Deploying a Tornado project in production using Github and WebFaction.

    In the following I’m using a server from Webfaction, and my Tornado source code is hosted on Github. Some things are specific to those providers, but should be very easy to adapt. The following is organized into two sections.

  • Installing nginx on Mac with pcre library

    To build nginx on Mac OS X Snow Leopard, I use the following options to configure ./configure –with-ld-opt=”-L/usr/local/lib” –with-cc-opt=”-I/usr/local/include” If the ld and cc options are not given, it results in an error reported in a ticket on the nginx trac. Notice that the is no space between -L and /usr/local/lib and likewise for -I […]

  • Testing performance of HTTP server with Apache Bench

    To benchmark a HTTP server, you can use the command-line utility Apache Bench (command ab). If you have Python installed, you can start a HTTP server, e.g. running on port 10000, in any directory of your system. It will serve the files in that directory and sub-directories. Start it like this: $ python -m SimpleHTTPServer […]

  • How to manage PATH in Mac OS X

    I use two ways to manage paths in Mac OS X: ~/.profile /etc/paths.d I use the first option when trying things out, and the second for managing the path more permanently. Example And example of the using /etc/paths.d to include the git executable in PATH: edit /etc/paths.d/git Add line: /usr/local/git/bin When you start a new […]

  • How to copy a file to “clip board” memory

    You have a file sitting on your disc. You want to put a copy of the contents in your OS “clip board” so that you can paste it somewhere, e.g. on a website, without having to open the file in a text editor, selecting everything and hitting the COPY key combination, say Command-C on a […]

  • Import OSM data into PostGIS using Osmosis

    This blog post is made as a “note-to-self” so that I can remember the procedure. You are of course welcome to read along. It’s does nothing fancy, simply imports the planet.osm file into PostGIS using Osmosis with the Snapshot Schema. Step by step Assuming Osmosis is installed (if not download osmosis), and a planet.osm file […]