Petegraham - tech.petegraham.co.uk - Optimus Pete

Latest News:

PHP: Save image from url 17 Jul 2010 | 04:30 am

file_put_contents($file_location, file_get_contents($image_url)); Now go get stealing images!

PHP: Get tmp directory 17 Jul 2010 | 04:28 am

sys_get_temp_dir() Didn’t know about this function before today.

OS X: Terminal launch finder for current directory 17 Jul 2010 | 04:25 am

open “`pwd`” PG TIP: I like to add this to my .bash_profile as an alias so I can just type finder to launch it: alias finder=’open “`pwd`”‘

wget page source and all related assets 13 Jul 2010 | 04:27 am

wget -p -k http://site-you-want-content-from.com/dir/page_name.html You can get an OS X installation of wget here http://www.statusq.org/archives/2005/02/22/610/

mysql: dump database without locking tables 12 Jul 2010 | 09:22 pm

mysqldump -uUSER -pPASSWORD DB_NAME –lock-tables=false > dump.sql

Linux: find all files in folder with extension 10 Jul 2010 | 03:54 am

ls -R | grep gif$ The above command will list of the gif files you have in your folder (it will look recussively in subfolders). If you wanted to see the paths as well you could use the find command:...

Rsync: copy files but not .svn directories 10 Jul 2010 | 03:40 am

rsync -n –exclude .svn -av /PATH/TO/SOURCE/DIR/* /PATH/TO/DEST/DIR/ rsync –exclude .svn -av /PATH/TO/SOURCE/DIR/* /PATH/TO/DEST/DIR/ The first command will similulate the copy (useful to test). The ...

svn: delete unversioned files 10 Jul 2010 | 03:38 am

Thanks to Guy Rutenberg for this, your definitely in my list of top 5 guys.

svn: add all unversioned files 10 Jul 2010 | 03:29 am

svn add * –-force svn commit -m “”

svn: remove all .svn folders 10 Jul 2010 | 03:27 am

find . -name .svn -print0 | xargs -0 rm -rf This will remove all .svn folders and their contents even in subdirectories. Note if you don’t want the .svn folders it’s better to do an svn export instea...

Recently parsed news:

Recent searches: