Cheat sheet
Things I have learned the hard way. Or the easy way.
Table of Contents
Masters thesis in org-mode
This little elisp script exports my org file to a latex document. There is also a Makefile which uses emacs and publish to generate pdf or dvi from the org file.
The elisp script defines a uiophd class, and the org file uses that class by doing:
#+LaTeX_CLASS uiophd
It is also possible to do some nice things with bibtex and emacs. This very nice blog has some info on that.
I really recommend using column view and clocking
Backup
For some reason it took me years before setting up a backup system. Strange since it is so easy to do. This is my solution.
for target in /home/backups/targets/*; do
/usr/bin/rdiff-backup --include-globbing-filelist=${target} --exclude '**' jaskorpe@${target##*/}::/ ${target%targets*}${target##*/}/
done
This works by looking in home/backups/targets for files. Each filename is treated as the hostname which should be backed up. Those files should contain the name of each directory you want backed up. Symlinks will not be followed, so use only hardlinks.
Practical example
The file "mindmutation.net" with the content:
/home/mindmutation/** /etc/**
The script would then use ssh to backup everything inside the two directories using ssh to mindmutation.net. Note the important double star at the end.
Security
The nice thing with this method is that you can run the script on a system with only physical login. DO NOT make the files available read/write to others.
Since this script will connect to others using ssh, you need ssh keys without a passphrase. You should really limit what the public key of the backup user is allowed to do.
Add this in front of your public key:
from="192.168.1.10",command="rdiff-backup --server"
The ip address in "from" will limit from where ssh accepts connections using this key. The command in "command" will force ssh to start that command, no matter what (given a reasonable configuration), so no one using that key will be able to start a shell (directly at least)
Git push, when pull is not an option
You are working on two machines. If for some reason you are not able to do a git fetch against one of them you have two options, a central repo or a push into a non working copy branch on the machine you are able to fetch from.
Put this into the apropriate remote section.
push = refs/heads/*:refs/remotes/bare/*
You will now by default push to a branch called "bare" in the remote repo.
On the other machine, do this:
[branch "master"]
remote = .
merge = remotes/bare/master
This will make git pull, merge the "bare" branch into master as default. It is also possible to no use the special . remote and instead do
git merge remotes/bare/master
Web publishing software
To publish this, and other, web sites i use org-mode in emacs. I use this little script to publish it. I have all my org files and static files, like images and tar balls, and i run it from a git hook. This way i can edit the dynamic content in emacs, and use git to manage the content, and still have automatic publishing.
To publish i put this line in post-commit (maybe i should put it in pre-commit?)
emacs -l publish.el --batch --execute='(publish)'
Makefile for latex and bibtex
uiosloforside
uiosloforside is a tex package. I guess only people with UiO-account can find the files (check license to see if you are allowed to copy it.
You need these files:
- type1ec.sty
- type1cm.sty
- uiof-grey.eps
- uiof-grey.mps
- uiologo-45mm.eps
- uiologo-45mm.pdf
- uiosloforside.sty
Put these files somewhere tex will find them. Use "kpsepath tex" to find out exactly where