Category Archives: tips

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: 127.0.0.1:LOCAL_PORT
      • No Proxy for: localhost, 127.0.0.1
      • 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
/tmp/fmtutil.t6EnBlWW
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:
 tex-common
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

    Install brat on Apache2

    Install brat

    download, unzip and run ./install.

    Change the webapp location in Apache2

    1. in etc/apache2/sites-avialble, in default add Alias /brat "/home/brat"
    2. restart apache2:
    sudo service apache2 reload
    

    MathJax with blogger.com

    MathJax in blogger.com is useful when I need to input equation in my blog. This is a instruction and test of using MathJax in blogger.com.

    1. set blogger.com template to “Simple”. “Dynamic Views” seems not working.
    2. edit HTML by adding the following code between <head> and </head>: <script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' type='text/javascript'/>
    3. type math equation in the blog.

    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
      xterm*)
        precmd () {print -Pn "\e]0;%~\a"}
        ;;
    esac
    

    Let me explain this piece of monstrosity a little bit.

    Recommend: Wall Street Bosses Are Calling This ‘The Best Cover Letter Ever’ – But Not Everyone Agrees

    The following letter is reposted from Wall Street Bosses Are Calling This ‘The Best Cover Letter Ever’ – But Not Everyone Agrees

    From: BLOCKED
    Sent: Monday, January 14, 2013 1:14PM
    To: BLOCKED
    Subject: Summer Internship

    Dear BLOCKED

    My name is (BLOCKED) and I am an undergraduate finance student at (BLOCKED). I met you the summer before last at Smith & Wollensky’s in New York when I was touring the east coast with my uncle, (BLOCKED). I just wanted to thank you for taking the time to talk with me that night. read more

    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