Quick Hacks

These are hacks for which I'm too lazy to write long form prose.


wget me get me

Download an entire web directory recursively

$ wget -r -np -k -p "http://some.url.com/the/directory/you/want"

If downloading a PDF in the browser seems to take so long

$ wget --no-cache "http://url.com/path/to/document.pdf"

Convert line breaks from Unix to DOS and vice versa

DOS/Unix to Unix

:update
:e ++ff=dos
:setlocal ff=unix
:w

DOS/Unix to DOS

:update
:e ++ff=dos
:w

From Vim Wikia


Make MathJax load from local test server

<!-- templates/base.html -->
<script src="/static/mathjax-2.1/MathJax.js" type="text/javascript"></script>
<script src="/static/mathjax-2.1/config/TeX-AMS-MML_HTMLorMML.js" type="text/javascript"></script>
<script type="text/javascript">MathJax.Hub.Configured()</script>

In static/mathjax-2.1/MathJax.js, search for delayStartupUntil and make sure its value is set to

/* static/mathjax-2.1/MathJax.js */
delayStartupUntil="configured"

How to package your Python code

This tutorial aims to put forth an opinionated and specific pattern to make trouble-free packages for community use. It doesn't describe the only way of doing things, merely one specific approach that works well.

How to package your Python code


LaTeX working platform

The -shell-escape option is unsafe for general purposes, but this is needed to run convert when using the standalone package.

#~/.latexmkrc
$pdflatex = 'pdflatex -shell-escape -synctex=1 -interaction=nonstopmode'
remove_input_ext( 'png' )

This will monitor main.tex for changes and recompiles if necessary.

$ latexmk -pvc -pdf -recorder- main.tex

The -recorder- option prevents png files from being regarded as source files, which will cause endless looping of latexmk.


Compile Vim with +clientserver

$ ./configure --enable-rubyinterp --enable-pythoninterp --with-features=huge --enable-gui=gtk2

From Stack Overflow.


Vim command-t problems

If you get an error saying something about not being able to load the C extension

$ cd ~/.vim/ruby/command-t
$ ruby extconf.rb
$ make

From Stack Overflow.


Enable SyncTeX in Skim

Bring up the Preferences pane in Skim. Open the Sync tab. Under PDF-TeX Sync support, choose a Custom preset.

Command:

/full/path/to/vim

Arguments:

--servername VIM --remote-silent +":%line;foldo!" "%file"