nix, shell, perl, php, mysql and mac os x tips and tricks

Friday, August 29, 2008

New way to get all This American Life episodes

Do this in the directory you want to download them into. Adjust numbers.
counter=318;  while [  $counter -lt 366 ]; do echo "$counter.mp3" | xargs wget; let counter=counter+1; done;

Thursday, August 28, 2008

MySQL Select the maximum row in each group

SELECT AS id, f.client AS client, f.customer_id AS customer_id, f.bill_email AS bill_email
   SELECT client, max(id) AS top_id
   FROM activity GROUP BY client
) AS x INNER JOIN activity AS f ON f.client = x.client and = x.top_id;

Saturday, August 2, 2008

Another way to find installed perl modules

find `perl -e 'print "@INC"'` -name '*.pm' -print