Pedro Assunção

Archive for September, 2011

Export Mysql result as CSV

Don’t ask me how the sed magic works, but it does. Taken from here. Running this: mysql -u<USER> -p<PASSWORD> <DATABASE> -B -e “select * from videos_video;” | sed ‘s/\t/”,”/g;s/^/”/;s/$/”/;s/\n//g’ will produce something like this: “id”,”title”,”url” “1″,”video 1″,”http://youtube(…)” “2″,”video 2″,”http://youtube(…)” “3″,”video 3″,”http://youtube(…)” Just pipe it to a .csv file and you’re done

Nice tweaks for OSX

I think most of them work on both Snow Leopard and Lion. Not sure about previous versions. Just type the ones you want to activate/deactivate on the command line and have fun. # Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs) defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # Enable the [...]

Browser and visitor statistics

Was just now looking at google analytics for my blog and got some surprises, especially when it comes to the browser people use to access it. Seems that Chrome is leading and Internet Explorer is dead. Long live Internet Explorer Also, very interesting is the fact that i’m Portuguese and Portugal is not on the [...]

Enable/disable spotlight in OSX

This is just a self reminder on how to disable and enable spotlight in Snow Leopard and Lion. Open a terminal and type: To enable: sudo mdutil -a -i on To disable: sudo mdutil -a -i off In system preferences you can control which drives and/or folders are not to be indexed.