Saturday, September 5, 2015

SED Kufu

This saved me from a boring task.  Here I tried to rename a bunch of files by removing some standard text and including leading zero to single digit file titles.

ls -ltrh | grep -o Java.* | sed -e 's/.*/mv_&" "&"/g' -e 's/ "Java Programming Tutorial/ "/g' -e 's/" - /\n"Java/g' | sed -E '/(mv_Java)/!s/ //g' | paste -d" " - - | sed 's/mv_/mv "/g'
sed -E "Would skip lines with mv_Java"
This would help add leading zero to single digits.
ls -ltrh | grep -o -P Java[0-9]{1}-.* | sed 's/.*/mv_&\n&/g' | sed -E '/mv_/!s/Java/Java0/g' | paste -d" " - - | sed 's/mv_/mv /g'

Sunday, August 2, 2015

Treesheets cheatsheet

Treesheet cheatsheet :-)



To install treesheets from Git Respository follow these steps below.

We need GTK > 1.2 to get wxwidgets installed.  wxWidgets is needed for treesheets.
apt-get install libgtk-3-dev

Now let us get the MD5SUM (b8833e54675154f3098e9e0f114d3082) from the link

Now unzip that zip file and go inside and configure it with the following options and then do make as normal user.

$ ./configure --enable-unicode --enable-optimize=-O2 --disable-shared
$ make

Now let us get the treesheets zip file from git (6ede9f8db292d22c91c0a411a9d56d01).

Now unzip that as before and go into the src directory.  Now we need to move the wxWidgets-master folder into the treesheets/src/wx directory.  Then run make.  We should see the treesheets executable in the TS directory.

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/std/Downloads/ts/src/wx
echo $PATH

There is one mystery which I have not been able to solve is why is treesheet listening on port 4242, when we invoke it.

Saturday, July 4, 2015

RaspberryPI xbmc-send - Playing Youtube videos from laptop

If we are watching some youtube videos on our laptop or desktop and want to push that video to RaspberryPI we can follow the following steps.

1. Install xbmc-send software on our system where we are watching youtube.
2. Next copy paste the code from [1] and replace RaspberryPI_ip with your RaspberryPI IP address.
3. Next make the script executable with "chmod +x" Then call it with youtube url as parameter for it.


Raspberry PI JASON

Wow now we can use Jason to control RaspberryPI :-)

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"This is the title of the message","message":"This is the body of the message"},"id":1}' http://username:password@RasbperryPi_IPaddress/jsonrpc

The list of all method we can using under jason is given under [1].  [2] showed how to explore the methods in a more structured way.



Sunday, June 28, 2015

Compressing Large video files

My phone records video in HD nothing new here.  However the file size of each and every video is enormous.  So like any other person I started googling to see how I can compress the video files.  I came up with this following bash script [1].  This script will basically list all MP4 files in our directory.  Then use VLC command line parameters to compress the file. Oh and one more thing it can also rotate the video automatically to Landscape mode if it was taken in Portrait mode.


I was able to get pretty good compression.  My file size which was 24.7 MB got compressed to ~8 MB.