Download large file in chunks with Python using urllib2 to a temporary directory

4/12/2011

No Comments

List directories by date using PHP

1/12/2011

I struggled for an elegant way to list directories and files by date with PHP.  Here is the fruit of much Google-Fu.  This will list directories and files from newest to oldest.

1 Comment

Install Python Imaging Library (PIL) on OS X 10.6 (Snow Leopard)

9/04/2011

I look a bit painful to do this at first, but here is a very simple solution.

  1. Install brew
  2. run ‘brew instal PIL’
  3. Brew install PIL at /usr/local/Cellar/pil/1.1.7/lib/python2.6/site-packages
  4. Symlink the PIL site-packages to your Python site-packages in /Library/Python/2.6/site-packages

    ln -s /usr/local/Cellar/pil/1.1.7/lib/python2.6/site-packages/PIL /Library/Python/2.6/site-packages/PIL

3 Comments

Install node.js and npm from source on OS X

14/01/2011

You will need git, and all the xcode goodies. This is the easiest way to copy and paste your way to a working node.js and npm setup with OS X 10.6. Live on the bleeding edge!

No Comments

Create a thumbnail or resize an image with Imagemagick in PHP

28/11/2010

This is the most elegant way I could find to create an thumbnail for an image I want to resize with PHP and Imagemagick. The function will return a filename.

To install imagemagick using Ubuntu, just run

sudo aptitude install php5-imagick

No Comments

Serve .json as content type application/json with Apache on Ubuntu

16/11/2010

If you are using Ubuntu 10.04 or Debian and you serve .json files through Apache, you might want to serve the files with the correct content type. I am doing this primarily because I want to use the Firefox extension JSONView

The Apache module mod_mine will help to do this easily. However, with Ubuntu you need to edit the file /etc/mime.types and add the line

application/json json

Then restart Apache

sudo /etc/init.d/apache2 restart

2 Comments

How to set a default font (AKA guifont) in your .gvimrc

16/11/2010

From : How to set default macvim or gvim font size

A tip on editing your .gvimrc options file, for gvim or macvim… if you want to set a guifont, but the name contains spaces, you’ll need to escape the spaces to get the font to work.

For example, normally (at least on macvim), if you wanted to use, say, Monaco size 12 as a GUI font, you would add a line to your gvimrc saying

set guifont=Monaco:h12

(Naturally, you could also :set this from within vim.)

If you wanted to use Bitstream Vera Sans Mono instead, you would escape the spaces with a backslash, thusly:

set guifont=Bitstream\ Vera\ Sans\ Mono:h12

1 Comment

The Singularity Summit 2010

15/08/2010

—not ready for others to read, but making public anyway —

A collection of the faithful gathered in one large room. Among the believers were those seeking healing. They did not reach out the touch the robe of Kurtzweil, not only because he only appeared over the net, but they instead sought the empowerment provided by the most far out boundaries of what is know.

The good news is that frontiers are being forged, primarily the brain sciences. The search for AI seemed to have morphed into a quest to reverse engineer the brain. To learn from Biology. However, the quest seeks to enhance what biology has to offer.

No advances in AI, or even close to it seem to have been presented. Only a uniformed concession that the old way of thinking as is a dead end.

No Comments

massif-visualizer Ubuntu Install Notes

29/07/2010

Here are the partial instructions for Ubuntu 10.04 with branch 8f84a30 from July 29, 2010

Get the depends:
#sudo aptitude install kdelibs
#sudo aptitude install cmake
#sudo aptitude install kdelibs4-dev
#sudo aptitude install kdebase
#sudo apt-get install libphonon-dev build-essential
#sudo aptitude install kde-devel

get kgraphviewer:

#sudo aptitude install graphviz-dev graphviz
#sudo aptitude install kdepimlibs5-dev
#sudo aptitude install boost-build libboost-all-dev

#mkdir kgraphviewer
#cd kgraphviewer/

#svn co svn://websvn.kde.org:443/home/kde/trunk/extragear/graphics/kgraphviewer/ .

Then follow their README and install

Then Get git:
#sudo aptitude install git-core

get the Massif-Visualizer from http://gitorious.org/massif-visualizer:

#git clone git://gitorious.org/massif-visualizer/massif-visualizer.git

Then you can follow the massif-visualizer readme

See images at : http://www.flickr.com/photos/gourneau/sets/72157625248823281/with/5169269487/

3 Comments

Simple Graphical Python Profiling with RunSnakeRun

26/07/2010

sudo aptitude install python-wxtools

sudo easy_install runsnakerun

sudo aptitude install python-profiler

(If you are using Debian check this out : http://www.cherrypy.org/wiki/ProfilingOnDebian
)

run with:

python -m cProfile -o barbazzr.profile barbazzr.py

Check out the output with:
runsnake name.profilepython -m cProfile -o barbazzr.profile barbazzr.py

No Comments