Hong Xu

Hong's Personal Technology Blog

Back Up (Migrate) Homebrew Packages

| Comments

As one of the most popular package manager on OS X, Homebrew is indeed a very nice tool to manage packages. However, when you want to back up your packages, or migrate the packages onto another machine, Homebrew didn’t invent such a tool. If you are moving to an OS X of the same version, you can simply copy the Homebrew directory (default is /usr/local) to your new machine. Otherwise, we need to find a way to install the exactly same packages on your new machine. In order to accomplish the goal, I wrote a small piece of bash script to generate a restore script to install the packages.

Too Many Escaping Backslashes? Avoid Them!

| Comments

Backslash escaping is common in programming. Sometimes we may let a file go through a few filters or template engines, such as markdown, quik, etc. and things become even worse if we are writing the template files from a string which requires backslash escaping for any literal backslashes appearing in the string. On Windows, things are more horrible than on Unices (You know why, right? Hint: path separator). Then, if you need a “real” backslash in the final output, you may end up with four or eight or sixteen backslashes in the original file. This is horrible. To avoid this situation, I wrote a short preprocessing script in Python to double or quadruple or octuple or zzzuple your backslashes.

Use Both Homebrew and Macports on Your OS X

| Comments

Homebrew and Macports are two excellent package managers on OS X. At most of the time, Homebrew is fair enough: it has a large package collections. But sometimes, there are just some packages not available in Homebrew while they are in Macports. Although having both of them installed is not recommended, I still want to give it a try.

The basic rules here are using Homebrew packages as much as possible. When one package is not available in Homebrew, install it from Macports (you will soon see why). We will wrap the executables installed by Macports with suitable Environmental Variables.

Please note that this post only presents a workaround. It is not garanteed to work, and it is possible that it does not work under some certain circumstances.

Live Preview of LaTeX in Vim

| Comments

Vim, as a highly configurable and customizable editor, already has a powerful Vim-LaTeX plugin. However, I don’t like the lack of live preview feature. For this reason, I developed a plugin called vim-latex-live-preview last year. Although it currently can’t handle complex situations such as multiple tex files, it could basically handle single tex file project well (with or without BibLaTeX, thanks to Asis Hallab).

Note: This plugin currently doesn’t work on Windows.

Manage Multiple SSH Private Keys

| Comments

If you have multiple ssh keys, it is sometimes hard to manage. This was written before, but mostly they are handling using different keys with different host. What if you have two or more GitHub or BitBucket accounts requiring different keys? As a result, I created skm to provide a more general solution. Here I’ll give a brief introduction of how to manage multiple SSH private keys with skm.

Install and Use GNU Command Line Tools on Mac OS X

| Comments

If you are moving onto Mac OS X from Linux, you would probably find out that the command line tools shipped with Mac OS X are not as powerful and easy to use as the tools in Linux. The reason is that Mac OS X uses the BSD version command line tools, which are different from the Linux version, while they are both compliant with POSIX standards. But we can easily install the GNU tools by using Homebrew in Mac OS X and set them as default.

Use Travis CI With Jython

| Comments

This page has been translated into Spanish language by Maria Ramos from Webhostinghub.com.

This post was updated on Feb 11, 2013, since the old way never works now. However, the original post is still available here.

Travis CI is a hosted continuous integration service for the open source community, helping run tests for your GitHub projects for every single push and pull request. However, by the time this post is written, Travis CI has not officially supported Jython, a Python interpreter written in Java. This post will help you setup a Jython testing environment for a Python project on Travis CI.