Monday, March 10, 2014

Extract subtitles from mkv movies

$ sudo pacman -S mkvtoolnix-cli

$ mkvmerge -i 5426d90fb609da53e52fdc31ce1180efb6e29430
File '5426d90fb609da53e52fdc31ce1180efb6e29430': container: Matroska
Track ID 0: audio (PCM)
Track ID 1: video (MPEG-4p10/AVC/h.264)
Track ID 2: subtitles (SubRip/SRT)
Global tags: 1 entries

$ mkvextract tracks 5426d90fb609da53e52fdc31ce1180efb6e29430 2:sub.srt
Extracting track 2 with the CodecID 'S_TEXT/UTF8' to the file 'sub.srt'. Container format: SRT text subtitles
Progress: 100%


Reference: http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html

Friday, March 7, 2014

Setup a remote ipyhton notebook

# setup a password for the notebook
$ ipython
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:747ba2295030:7bbe79e452b9bb3cae6e66ed738563e18a15462c'


# self-signed cert
$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert

# edit the profile for notebook
$ mkdir ~/.config/ipython/profile_serv/
$ vim ~/.config/ipython/profile_serv/ipython_notebook_config.py

c = get_config()
c.NotebookApp.password = u'sha1:747ba2295030:7bbe79e452b9bb3cae6e66ed738563e18a15462c'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 10001
c.NotebookApp.certfile = u'/home/xatier/note/mycert.pem'

# run it!
$ ipython notebook --profile=serv



Reference:

http://ipython.org/ipython-doc/stable/interactive/public_server.html
http://nbviewer.ipython.org/github/Unidata/tds-python-workshop/blob/master/ipython-notebook-server.ipynb