Get Directory of Bash Script Being Executed

I needed a quick way to get the directory of the current bash script being executed and a little googling led me to this elegant little bit: # Absolute path to this script. /home/user/bin/foo.sh SCRIPT=$(readlink -f $0) # Absolute path this script is in. /home/user/bin SCRIPTPATH=`dirname $SCRIPT` via fritzthomas

Posted at 1pm on 6/16/10 | View Comments | Filed Under: Uncategorized | read on

Intersect Two Lists in Python

Very often I find myself combining lists, removing duplicates, or looking for differences or intersects of sets. I have no idea how I have never discovered how useful the set type in python is. Here is a really simple way to find the intersect of two lists/sets: >>> b1 = [1,2,3,4,5,9,11,15] >>> b2 = [4,5,6,7,8] [...]

Posted at 11am on 6/3/10 | View Comments | Filed Under: code, python | read on

About

I write software to make the internet better.  I live in and love NYC.

kortina-and-chewie


Write software? Venmo is hiring engineers who want to change the world Like this? Subscribe via Email, RSS, or get the good stuff on letter.ly/kortina