Saturday, November 3, 2012

Programmer

Got this from 9gag :-)

How to install SHC on your Linux system

SHC stands for Generic shell script compiler. Created by Francisco Javier Rosales GarcĂ­a, shc creates a stripped binary executable version of the script specified with -f on the command line. The binary version will get a .x extension appended and will usually be a bit larger in size than the original ascii code. Generated C source code is saved in a file with the extension .x.c .

In a simple word, SHC compile your Bash script into binary so no one can see your code. 

And here's step by step how to install SHC (I use Ubuntu 12.04 LTS) :

1. Download the latest version of SHC at here 

2. Put the package at your home (~) directory

3. Extract the tarball :

adee@thinkpad:~$ tar -xzvf shc-3.8.9.tgz 
shc-3.8.9/CHANGES
shc-3.8.9/Copying
shc-3.8.9/match
shc-3.8.9/pru.sh
shc-3.8.9/shc-3.8.9.c
shc-3.8.9/shc.1
shc-3.8.9/shc.README
shc-3.8.9/shc.html
shc-3.8.9/test.bash
shc-3.8.9/test.csh
shc-3.8.9/test.ksh
shc-3.8.9/makefile


4. Step inside into the shc folder and do the 'make' command :

adee@thinkpad:~$ cd shc-3.8.9/
adee@thinkpad:~/shc-3.8.9$ make
make: *** No rule to make target `shc.c', needed by `shc'.  Stop.


5. As you see above, there's an error about missing file named 'shc.c' Actually the 'shc.c' is already there, we just have to rename  / duplicate it into the right name :

adee@thinkpad:~/shc-3.8.9$ cp shc-3.8.9.c shc.c
adee@thinkpad:~/shc-3.8.9$ make
cc -Wall  shc.c -o shc
*** �Do you want to probe shc with a test script?
*** Please try... make test


6. Ok, then we shall continue to 'make install' command (need sudo):

adee@thinkpad:~/shc-3.8.9$ sudo make install
*** Installing shc and shc.1 on /usr/local
*** �Do you want to continue? y
install -c -s shc /usr/local/bin/
install -c -m 644 shc.1 /usr/local/man/man1/
install: target `/usr/local/man/man1/' is not a directory: No such file or directory
make: *** [install] Error 


7. Something sucks occurs again. It's looks like there's no such directory named '/usr/local/man/man1/'. So what should we do? Simple, just create that folder and repeat again the make install command. It should works now!

adee@thinkpad:~/shc-3.8.9$ sudo mkdir /usr/local/man/man1
adee@thinkpad:~/shc-3.8.9$ sudo make install
*** Installing shc and shc.1 on /usr/local
*** �Do you want to continue? y
install -c -s shc /usr/local/bin/
install -c -m 644 shc.1 /usr/local/man/man1/


8. Next, we have to move the shc binary file into /bin and give it the excecutable bit :

adee@thinkpad:~/shc-3.8.9$ sudo cp shc /bin/shc
adee@thinkpad:~/shc-3.8.9$ sudo chmod +x /bin/shc


9. OK Done! SHC is installed into your system. To test it, try type 'shc' at the terminal, and it should looks like this :

adee@thinkpad:~/shc-3.8.9$ shc 
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script


OK on the next few days, i will write an article about the usage of SHC. So stay tuned :-)

How to shows subtitle (*.srt) in Windows 7 - Windows Media Player 12

By default, Windows 7 Windows Media Player 12 (WMP12) does not support *. SRT files for movie ssubtitles. To shows subtitle on WMP12, we can use Local Subtitles for WMP plug-in from codepack.co. This Plug-In will allow you to play movies with subtitles in Windows 7 Media Player 12

And here's the steps :
  • Prepare your video files
  • Download subtitle (*. SRT) in accordance with the title of the movies and languages you want. (Subscene is a recommended site for subtitle's searching).
  • Rename the SRT file name with the same name of your movie file (excluding the extension). 
For example:
- myvideodvdrip.mp4
- myvideodvdrip.srt
 

    • The movie will be played. Make sure the subtitle is loaded by right clicking on the movie screen > Lyrics, captions and subtitles> On, if available
    • Done. Your WMP12 will shows the subtile below the the screen.


    Have a try ! :-)