pátek 21. února 2014

migrace "spisovky" mezi pocitaci

1. dostatecne vybaveny server:  php moduly...
Oficialni pozadavky:


2. kopie adresare na druhy stroj
[root@novy ~]# cd /srv/www/htdocs/
rsync -avP -e ssh stary:/srv/www/htdocs/spisovka33 .
chown -R apache. spisovka33/client spisovka33/log # writable adresare
ln -s spisovka33 spisovka

3a. kopie databaze - komplet
stroj1:
root@stary:/home/user/spisovka> mysqldump -p --all-databases > db_backup.sql

stroj2:
[root@novy ~]# scp -C user@stary:spisovka/db_backup.sql .
[root@novy ~]# mysql <db_backup.sql 
[root@novy ~]# mysql
mysql> use spisovka33 ;
mysql> flush privileges;
mysql> GRANT ALL PRIVILEGES ON spisovka33.* TO 'spisovka'@'localhost' ;
mysql>\q

3b. kopie pouze databaze spisovky
stroj1:
root@stary:/home/user/spisovka> mysqldump -u spisovka -p spisovka33 > db_backup.sql

stroj2:
[root@novy ~]# scp -C user@stary:spisovka/db_backup.sql .
[root@novy ~]# mysql
mysql> create database spisovka33 ;
mysql> use spisovka33 ;
mysql> flush privileges;
mysql> CREATE USER 'spisovka'@'localhost' IDENTIFIED BY 'XXXXXXX';
mysql> GRANT ALL PRIVILEGES ON spisovka33.* TO 'spisovka'@'localhost' ;
mysql>\q
[root@novy ~]# mysql -u spisovka -p spisovka33 <db_backup.sql  

sobota 8. února 2014

ssh tunnel over NAT or firewall (chained ssh)

Your target server is running e.g. vncserver on port 5904. Your gateway has a free port 6111. Your client has a free port 333

client:~> ssh -A -t  user1@gateway -L 3333:localhost:6111 \
ssh -A user2@target -L 6111:localhost:5904


Then:

client:~> vncviewer ::3333

pondělí 3. února 2014

Reset image orientation and other EXIF tricks

Different image viewers/editors use different EXIF tags to set image rotation, so the best way is to avoid use any of them. IMHO physical rotation (preferably lossless) is the best solution. So, how to get rid of any rotation for all x-thousand holiday photos?

I have found two suspicious exif tags: Orientation and Rotation. Wipe them off from my pictures

exiftool  -Orientation=  -Rotation= -overwrite_original_in_place .

(the final dot stands for the current directory)
Or:

for i in *JPG ; do
   exiftool  -Orientation=  -Rotation= -overwrite_original_in_place "$i"
done

---------------
To delete the relatively large preview image (created by the Lumix camera for its own display) try:
exiftool -P -overwrite_original -PreviewImage=  -trailer:all= *jpg

---------------
Copy all tags from other files (original files)

for i in * ; do 
    exiftool -tagsfromfile src/$i -iptc:all -codedcharacterset=utf8 \
             -overwrite_original $i ; 
done