Category Archives: unix-linux

Proxy Firefox through a SSH tunnel

Have you ever wanted to visit sites during the day from a location that denied access to those sites? What you need is the ability to create a secure and encrypted ssh connection to tunnel your browser traffic through. If you have access to a remote machine by way of ssh, you can set up Firefox to visit these sites.

The following method is only tested on Windows XP, with cygwin installed.

LOCAL_PORT: localhost port for ssh tunnel
SERVER_NAME: remote machine

  1. set up firefox proxy
    • preferences –> advanced –> network –> settings
    • choose SOCKS v5
    • manual proxy configurations: SOCKS
      • Host:
      • No Proxy for: localhost,
      • leave the rest of entries BLANK
  2. set up firefox DNS
    • open “about:config” page in Firefox
    • search “network.proxy.socks_remote_dns”, set the value to “true”
  3. establish ssh tunnel

ssh -C2qTnN -D LOCAL_PORT username@SERVER_NAME read more

dpkg: error processing tex-common

Got the problem while installing latex-cjk-chinese

fmtutil-sys failed. Output has been stored in
Please include this file if you report a bug.

dpkg: error processing tex-common (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

After checking the file fmtutil.t6EnBlWW, I find the problem is

! I can’t find file `loadhyph-zh-latn.tex’. This is due to the inconsistence between texlive 2011 and tex2012. In tex2012, the file is renamed to `loadhyph-zh-latn-pinyin.tex’. Therefore, the solution is

  • go to /etc/texmf/hyphen.d
  • change loadhyph-zh-latn.tex to loadhyph-zh-latn-pinyin.tex
  • reinstall tex-common
  • read more

    How to fix Gedit LaTex Plugin error while saving BibTex

    Gedit (3.4.1) gives the error below while saving a BibTex file (Ubuntu 12.04). The saving works fine, apart from the error popping up.

      Traceback (most recent call last):
      File "/usr/lib/gedit/plugins/latex/", line 116, in decorated_function
      return function(*args, **kw)
      File "/usr/lib/gedit/plugins/latex/bibtex/", line 141, in __parse
      File "/usr/lib/gedit/plugins/latex/", line 493, in remove_markers
      type_record = self._marker_types[marker_type]
      KeyError: 'bibtex-error'

    How to fix it?

    How to set terminal title dynamically to the current working directory?

    It is sometimes helpful to set a terminal window title from a script, so that you can put a couple of reminders of how to do things there. The Xfce4-terminal preference tells me it can be done by setting the “Dynamically-set title” position, but never says how to dynamically put text in the title bar.

    Using Zsh

    As I’m gradually switching to Zsh, this short post explains how to dynamically set pwd, or current working directory, to xfce terminal in Zsh. Actually, it only contains two steps:

    1. open ~/.zshrc
    2. add the following code
    case $TERM in
        precmd () {print -Pn "\e]0;%~\a"}

    Let me explain this piece of monstrosity a little bit.

    Undefined reference to Sqrt — A quick note to compile SVM-multiclass

    When I compiled SVM-multiclass using make, I got an error msg saying “undefined reference to sqrt“. I check the makefile and found that -lm is included in the gcc flags.

    The trick here is to put the library AFTER the module you are compiling. The problem is a reference thing. The linker resolves references in order, so when the library is BEFORE the module being compiled, the linker gets confused and does not think that any of the functions in the library are needed. By putting the library AFTER the module, the references to the library in the module are resolved by the linker. read more

    How To Run Android 4.0 In Virtualbox (Linux)

    Sometimes I need to test my app or try some new apps on main Android devices available on the market. Of course I don’t want to install them on my working cellphone. Under such circumstances, I prefer installing a virtual machine on my PC and testing whatever on it. Here in this post, I provide a way to run Android in Virtualbox.

    How to convert video using MEncoder

    MEncoder is a free command line video decoding, encoding, and filtering tool. As a by-product of MPlayer, it can convert all formats that Mplayer can understand.

    install mencoder

    sudo apt-get install mencode

    avi → mp4

    mencoder 1.avi -o 1.mp4 -oac copy -ovc lavc -lavcopts vcodec=mpeg1video -of mpeg

  • o: output file name.
  • oac: audio codecs for encoding. copy does not reencode but just copy compressed frames.
  • ovc: video codecs for encoding. lavc means using one of libavcodec’s video codecs.
  • lavcopts: libavcodec’s video codecs. Here we choose MPEG-1 video.
  • of: output container formats. mpeg means MPEG-1 and MPEG-2 PS.
  • read more