Supermind Search Consulting Blog 
Solr - Elasticsearch - Big Data

gnome and gedit shortcut awesomeness

Posted by Kelvin on 28 Feb 2011 | Tagged as: Ubuntu

Anyone on Ubuntu will probably have used gedit at one time or the other. Well, gedit just got cooler. Turns out you can map/remap shortcuts on all gnome-based applications including gedit by changing a simple setting. 1. Hit Alt-F2, enter gconf-editor 2. Go to desktop > gnome > interface 3. check can_change_accels Now in gconf-editor, […]

Download google video and youtube from command-line

Posted by Kelvin on 22 Feb 2011 | Tagged as: Ubuntu

clive is an awesome tool for downloading google video and youtube flash videos from the command-line. sudo apt-get install clive   # download google video in flv clive http://video.google.com/videoplay?docid=-1388254997387483895   # download youtube in mp4 clive –format=mp4 http://www.youtube.com/watch?v=JPyuH4qXLZ0   # download list of URLs in file cat urls.txt | clive

Flatten folder/directory tree

Posted by Kelvin on 16 Jan 2011 | Tagged as: Ubuntu

For example, to move all mp3 files in sub directories into the current dir: find . -name *.mp3 -exec mv {} . \;

Recursively copy only files with certain extension with rsync

Posted by Kelvin on 16 Jan 2011 | Tagged as: Ubuntu

Sometimes you want to get to all MP3 or PDF files which are nested in a deep directory tree. Here's what you do.. rsync -rvtW –delay-updates –modify-window=1 –progress –include='*.pdf' –include='*.xml' –exclude='*.*' source dest

Useful ffmpeg commands

Posted by Kelvin on 06 Dec 2010 | Tagged as: Ubuntu

Shameless ripped from http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs Getting infos from a video file ffmpeg -i video.avi Turn X images to a video sequence ffmpeg -f image2 -i image%d.jpg video.mpg This command will transform all the images from the current directory (named image1.jpg, image2.jpg, etc…) to a video file named video.mpg. Turn a video to X images ffmpeg -i […]

Download youtube videos as mp3

Posted by Kelvin on 04 Dec 2010 | Tagged as: Ubuntu

For Ubuntu.. sudo apt-get install ffmpeg   cd ~/bin wget https://github.com/rg3/youtube-dl/raw/2010.11.19/youtube-dl chmod +x youtube-dl   wget http://www.supermind.org/scripts/youtube2mp3 chmod +x youtube2mp3 The contents of youtube2mp3 is simple: #!/bin/bash #!/bin/bash   x=/tmp/.youtube-dl-$RANDOM-$RANDOM.flv youtube-dl –output=$x –format=18 "$1" ffmpeg -i $x -vn -ar 44100 -ac 2 -ab 256k -f mp3 "$2" Now get the youtube URL you want to […]

Prettyprint xml in PHP

Posted by Kelvin on 04 Dec 2010 | Tagged as: PHP

Ever wanted to format your XML nicely? Use the SimpleDOM class. Usage is like so: include "SimpleDOM.php";   $xml = "<foo><bar>car</bar></foo>"; $dom = simpledom_load_string($xml); $xml = $dom->asPrettyXML(); echo $xml; Produces: &lt;?xml version="1.0"?&gt; &lt;foo&gt; &lt;bar&gt;car&lt;/bar&gt; &lt;/foo&gt;

Move up multiple directories in bash

Posted by Kelvin on 04 Dec 2010 | Tagged as: Ubuntu

Ever thought typing cd.. 5 times was silly? Try this up() function! Add this to .bash_profile or .bashrc up () { if [ -z $1 ]; then cd .. elif [ $1 -gt 0 ]; then let count=0 while [ $count -lt $1 ]; do cd .. let count=count+1 done else echo "Argument must be […]

Recursively delete .svn folders

Posted by Kelvin on 04 Dec 2010 | Tagged as: Ubuntu

#!/bin/bash find ./ -name ".svn" | xargs rm -Rf

Introducing Bash-whacking

Posted by Kelvin on 04 Dec 2010 | Tagged as: Ubuntu

Starting a new blog series on bash scripts you shouldn't live without. Installation for scripts is simple: either add them to /usr/bin or add ~/bin to your bash path and place your scripts there. Don't forget to make the scripts executable! Here's a complete example: Suppose you wanted to create a script called foobar and […]

« Previous PageNext Page »