Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

ludo http://asiatica.org/~ludo/

« Newer Snippets
Older Snippets »
4 total  XML / RSS feed 

Daily rotated backups to Strongspace

#!/bin/bash

# backup folder
HOME=/users/home/myid
DEST=$HOME/backups
MYSQL_DATABASES="db1 db2 dbn"
DIRS="dir1 dir2 dirn"
[email protected]

BACKUP_ALT=$(python -c "import time, sys; sys.stdout.write(str(int(time.strftime('%d')) % 2))")

for d in MYSQL_DATABASES; do
mysqldump --quick --opt --skip-add-locks $d |gzip - >${DEST}/${d}.sql.gz
done

for d in DIRS; do
tar zcvf ${HOME}${DEST}/${d}.tar.gz ${HOME}/${d} >/dev/null
done

scp -r ${DEST}/* ${STRONGSPACE_USER}:backup/$BACKUP_ALT/

rm -rf $DEST/*

Real user directories for virtual hosts

The default TXD Apache setup gives you user directory URLs like

http://domain/~user-domain/


If you need real user directories, set the 'User WWW Directory' of your virtual host in Webmin to something like

/home/mylogin/domains/mydomain/homes/*/web/public


to get URLs like

http://domain/~user/

Apply the 'anchor patch' to Trac

The 'anchor patch' adds support for a couple of very useful Trac macros:

* TocMacro http://trac-hacks.swapoff.org/wiki/TocMacro
* RefMacro http://trac-hacks.swapoff.org/wiki/RefMacro

To apply the patch without bothering the overworked TXD admnins, you can set up your own local copy of the Trac python package.

Assuming you have copied anchor.diff from

http://trac-hacks.swapoff.org/wiki/AnchorPatch

to your home directory, and that you are using bash and have a valid .bash_profile in your home (.profile will do too):

mkdir -p ~/lib/python2.4/site-packages
cp -R /usr/local/lib/python2.4/site-packages/trac ~/lib/python2.4/site-packages/
cd ~/lib/python2.4/site-packages
patch -p1 <~/anchor.diff
echo 'PYTHONPATH=$HOME/lib/python2.4/site-packages:$PYTHONPATH; export PYTHONPATH' >> ~/.bash_profile
python /usr/local/lib/python2.4/compileall.py ~/lib/python2.4/site-packages/trac


Now kill and restart tracd, and it should pick up the trac module in your home instead of the default.

Italian peasant's salad

From Enrica http://asiatica.org/~enrica/

Ingredients

* boiled patatoes (cold)
* olives (black or green)
* ripe tomatoes
* finely chopped onions
* salt
* oregano or 3-5 basil leaves
  (not washed just cleaned)
* freshly battered extra-vergin olive oil and vinegar
  (please please do not use the so called "Italian dressing", which is fake)


Optional Ingredients

cubes of pecorino (sheep) cheese or mozzarella


Directions

Add tomatoes at the end, use cold potatoes, and do not put too much of anything: too much is not better, is just too much; anyway, this is not a minimalist salad either, so do not be stingy either: in medio stat virtus!
« Newer Snippets
Older Snippets »
4 total  XML / RSS feed