Notes category

Turning The Page on 2014

Zooming way out, 2014 was a good year. Despite the increasingly sensational and manytimes troubling headlines in mainstream media, things are getting better all around us. We’re living 75+ years on average now and the world’s becoming a safer place. I hope we reach a time when we can collectively graduate from needing traditional war and country borders as a tool for power. Something tells me that technological progress and the pace thereof is going to have an important role to play in this graduation.

|| ————— | ————— slate: number of armed conflicts | slate: prevalence of mass killings slate: democracy and autocracy | slate: victimization of children slate: homicide rates | slate: violence against female partners

And from Bill Gates’ 2014 review (, there’s a number of general health improvements we’re seeing as well including falling child mortality rates and curing or at least strongly countering terrible diseases like HIV, Ebola, and Polio. These continued improvements contribute to our longer livespans and more abundant lives.

|| ————— | ————— gates: 5yo mortality rate | gates: tipping point hiv gates: fewer pills | gates: polo cases drop

2014 was a banner year for scientific progress ( And the lines between science & discovery and the humanitarian areas continues to blurr.

We managed to land a probe (Philae) on a moving comet so we could get a better sense of what’s inside and the role comets play within our universal ecosystem.

|| ————— | ————— philae2014:landing 1 | philae2014: landing 2

We’ve got a gen1 planetary robot (Curiosity) helping us explore Mars from afar. To boot, Curiosity’s just confirmed organic materials, interesting environment interactions, evidence of historic water, and more.

|| ————— | ————— curiosity2014: martian landscape | curiosity2014: BOM curiosity2014: hydro topographic | curiosity2014: martian hillside

We like what we’ve seen enough to set a new BHAG for NASA: double down on discovery and bring humans to Mars to continue in person. nasa: go to mars

Looking forward to 2015, here’s to making it our best yet!

An afternoon setting up Postgres (9.2) on OS X (10.7, perhaps & higher)

Some notes I jotted down after spinning up Postgres this afternoon. Nothing fancy about the setup here, should be just about enough to get you up and running with the basics.

Installation (ala Homebrew)
$ brew install postgresql
To do anything with it, you actually need to create a ‘database system’ with:
$ initdb /usr/local/var/postgres -E utf8
this directory is basically where the database system lives and is generally used by all control commands (as seen below)

Enable access via /usr/local/var/postgres/pg_hba.conf and incoming connections on tcp via (database system path above)/postgres.conf. These files are heavily commented and worth browsing thru to see how. Ultimately I didn’t need to edit pg_hba.conf at all, but did uncomment the localhost & port variables from postgres.conf to accept incoming tcp connections.

Control & Start-up
start single threaded:
$ postgres -D /usr/local/var/postgres
pg_ctl is a handy controller for postgres
start in the background:
$ pg_ctl -D /usr/local/var/postgres -l postgres_server.log start
check the status:
$ pg_ctl -D /usr/local/var/postgres status
stop the (presumably background) job:
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast
Interact and create Database(s) and User(s)
Postgres’s CLI for interaction is psql. It should already be on your path. Connect psql to the running instance (make sure the Postgres db server is running using the status command above)
$ psql -h -p 5432
(b/c in this setup case, we’re using tcp to connect i.e., in configs steps) and might as well add port param to be doubly sure this all works before wiring into a project). At psql’s prompt…
  • \du   lists users and roles
  • \l    shows all databases
  • \?    shows more psql commands
Create a database and user, and give the user perms on the db
CREATE DATABASE [database] ENCODING 'UTF8' OWNER [username];

Wire into a project, django today so in, remember to set host to “” and might as well set port to “5432” for good measure (assuming that’s the right one from the postgres configs.

Update: great list of “PostgreSQL Basics by Example” on github from darthdeus to help from here!

NTS: handy python 1 liner to see where site packages are

python -c “from distutils.sysconfig import get_python_lib; print get_python_lib()”

git immersion (

Great site for using the venerable Git for distributed version control and better understanding how to interact with, still the best place to collaborate on building great software.

NTS: how to put pyobjc on OSX 10.6+

Firstly I had to sudo easy_install pyobjc

$ sudo easy_install pyobjc==2.2

Then for some reason realized that the thing works online in python26-apple, so

$ sudo python_select python26-apple

Then you can run the instructions here and not run into most of the errors in the comments.


NTS: interesting (really simple jquery & django file upload)

Setting up OpenCV 2.1 on Ubuntu 10.10 for python (2.6)

Originally I just tried the apt-get route, using this updated source (starting from the top of this doc). It didn’t work out so well - 404 errors missing maverick sources. Caveating by saying I didn’t need source, just the basics to get me up and running.

After looking at the opencv installation wiki, it looks like just two commands took care of it for me. I still get a wierd libc error when importing opencv but it doesn’t seem to affect basic samples.

  • Update: Found this article to help re-install FFMPEG from source on Ubuntu, this to help with the “wierd libc errors”

In short, first install the ffmpeg dependencies

$ sudo apt-get install libavformat-dev libswscale-dev

then finish by installing opencv’s python libraries

$ sudo apt-get install python-opencv

NTS: ffmpeg to encode & save a mjpeg stream

<url/> = fully qualified url to a mjpeg file starting with http and ending with .mjpg (or .mjpeg). <numseconds/> = total number of seconds to record for tmp.mpg = the filename, replace as needed.

$ ffmpeg -f mjpeg -i <url/> -t <numseconds> tmp.mpg

If you want to get your output into BGR24 for processing w/out HW acceleration (thanks to jpsxdec):

$ ffmpeg -i inYCbCr.avi -vcodec rawvideo -pix_fmt bgr24 outRgb.avi

sudo port install git-core

If your macports install of git-core is failing with a cryptic checksum error, try this out: Worked wonders for me.

NTS: A good laptop running Windows 7+?

It’s ridiculous that there aren’t any on the market. The coolest Win 7 laptops are made by the big OEMs and they all pale next to an Apple equivalent. Why.. WHY! Microsoft Windows 7 is fantastic and lots of people use it. There is a great opportunity to launch a beautifully designed laptop on the mid-high end.. really thin, minimalist on the extra ports, brushed aluminum and great bundled services.