Which files has a *nix process opened?
To list all files that are opened by a *nix process with a given pid, say 42, use the lsof command: (sudo) lsof -p 42 Of course, a process may have many files open. To list only files that have…
To list all files that are opened by a *nix process with a given pid, say 42, use the lsof command: (sudo) lsof -p 42 Of course, a process may have many files open. To list only files that have…
While a sha-256 hash may seem unbreakable, for many input strings it takes seconds to crack. If you don’t believe me, try the following or simply read this webpage: $ python >>> import hashlib >>> print hashlib.sha256(‘megabrain’).hexdigest() f53c51616f4c7943a4117afa1d0ba193f9af901c6ce175a2207a594e71c98ef5 Go to…
Docker allows you to develop, ship and run any application, anywhere. The metaphor is that of the standard shipping container that fits on any ship, can be handled by any crane, and loaded onto any train or truck. In a…
Vagrant is cool: Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team. Furthermore: Vagrant…
Start PHP webserver (in current directory): php -S localhost:8080 # starts http server on port 8080 Start PHP prompt (with illustrating example):
PhantomJS is a headless browsers that you can use, e.g. to test web UIs and to screen capture webpages. I will focus on the last use case. Since PhantomJS knows how to execute Javascript, it can create a screen shot…
Want to count unique elements in a stream without blowing up memory? In more specific words, do you want to use a HyperLogLog counter in Spark? Until today, I’d never heard the word “monoid” before. However, Twitter Algebird is a…
Installing Postgres+PostGIS has never been easier on Mac. In fact, it is now an app! You download the app-file from postgresapp.com, place it in your Applications folder, and you’re done. Really. If you think that was over too fast If…
The command wget is useful, but unfortunately doesn’t come preinstalled with Mac. Yeah, you can install it of course, but if you’re doing it from source, the process has a few steps to satisfy all the dependencies; start by configure…
In bash, you simply prefix a command with one or more XXX=”YYY” pairs, e.g. $ A=”B” X=”Y” python print_env.py … A=B X=Y The code for print_env.py: import os for ev in os.environ: print “{0}={1}”.format(ev, os.environ[ev])