UN*X Note

just some geek's notes. Placed here in case, I forgot or someone else didn't know...

The Poor Man's Cloud

Imagine, you have a working directory under "/home/you/img/new" on your local computer. That's where you keep images and where you put new ones after you have finished them. Every day or every few hours you upload your finished work to /var/www/img/my_images on your web server. You also want to have the rest of the /var/www/img directory, where other users upload their images mirrored locally so you need to update your $HOME/img dir too. You want to keep file permissions as they are and only send or recieve those files that have actually changed:

sync directory "/var/www/img/new" on remote server with local directory ./img/new :

rsync -vza img/new/ user@example.com:/var/www/img/new

sync ./img on your local machine with /var/www/img/cal on the server:

rsync -vza user@example.com:/var/www/img/ img

you might want to run this manually, or let a cron job do it:

crontab -e 5 30 * * * rsync -vza /home/you/img/new/ \ user@example.com:/var/www/img/new > /dev/null \ && rsync -vza user@example.com:/var/www/img/ /home/you/img > /dev/null

Polipo Loglevels

(just in case you ever happen not to have 'logging.h' from polipos sources at hand ;))

0x1 :
ERROR
0x2 :
WARN
0x4 :
INFO
0x8 :
FORBIDDEN
0x10 :
UNCACHEABLE
0x20 :
SUPERSEDED
0x40 :
VARY
0x80 :
TUNNEL

MAX=0xFF, add levels to log more things:
logLevel = 0x12
will log all warnings + access to forbidden URLs. 0x8 seems not to work standalone. Might be a bug.

Flac2MP3

(incl. spaces in file names and tags)

Tagging:

Read FLAC data and export to text:

#!/bin/bash for A in $(seq 1 3) do metaflac --export-tags-to=$A.txt 0$A*.flac done

Read tags from text file and write them to MP3 files:

 #!/bin/bash

#better use something more reliable than this simple
#case where titles have to be named "01-_ARTIST-_SONG.mp3"

for A in $(seq 1 3) 

# the rest should work for everybody
do 
id3v2 -a "$(grep ^ARTIST= $A.txt|cut -d = -f 2)" -t $A 0$A*.mp3
id3v2 -A "$( grep ^ALBUM= $A.txt|cut -d = -f 2)" 0$A.mp3
id3v2 -y $(grep ^DATE= $A.txt|cut -d = -f 2) 0$A*.mp3
id3v2 -t "$(grep ^TITLE= $A.txt|cut -d = -f 2)" 0$A*.mp3
done