I am currently converting all my videos to a fixed format using handbrake. If you have a lot of videos to convert, the UI version of handbrake is not always the best solution. Handbrake offers a CLI, sometimes you it needs to be installed separately.
It has a lot of options ( https://trac.handbrake.fr/wiki/CLIGuide ). So the best is to go with your preferred preset.
I want to encode all video files in a given folder to the preset “universal”.
So i wrote a short bash script, to to the work:
#!/bin/bash
# Folder Setup
OUT_FOLDER=/home/media/out
IN_FOLDER=/home/media/in
DONE_FOLDER=$OUT_FOLDER/videos_done
if [ ! -f $DONE_FOLDER ] ; then mkdir -p $DONE_FOLDER; fi
if [ ! -f $OUT_FOLDER ] ; then mkdir -p $OUT_FOLDER; fi
#All Extensions of the input files
EXTS=( mp4 flv )
#Find Handbrake CLI
HB=`which HandBrakeCLI`
for ext in ${EXTS[@]}; do
echo "for $ext"
for FILENAME in `ls $IN_FOLDER/*.$ext`; do
#echo $FILENAME
$HB -i $FILENAME -o $OUT_FOLDER/`basename "$FILENAME" .$ext`.mp4 --preset="Universal"
mv $FILENAME $DONE_FOLDER/`basename "$FILENAME"`
done
done
Another use-case might the conversion of some videos to flv for a web playback (or the other way round flv->mp4 for playback on iOS Devices)
Normally you would prefer to use your public ssh key for login into a remote linux machine.
I created a script to perform the basic steps for inserting your public key into the hosts authorized_keys files.
The script looks like this:
#!/bin/bash
HOST=$1;
echo ">> setup your ssh keys for $HOST"
echo ""
echo ">> creating ssh keys on $HOST if necessary"
echo "(you need to enter your password)"
echo ""
ssh $HOST 'if [ ! -d ~/.ssh ] ; then ssh-keygen -t rsa; fi'
echo ""
PUBKEY=`cat ~/.ssh/id_dsa.pub`
echo "=========================================================="
echo "your id_dsa.pub:"
echo "$PUBKEY"
echo "=========================================================="
echo ""
echo ">> transfering your public ssh key"
scp ~/.ssh/authorized_keys $HOST:~/.ssh/authorized_keys
ssh $HOST 'chmod 600 ~/.ssh/authorized_keys'
echo ""
echo ">> login with your public key"
echo "(should work without a password)"
ssh $HOST
A typical run might look like this:
imotep:~ philipp$ setupssh philipp@192.168.178.55
>> setup your ssh keys for philipp@192.168.178.55
>> creating ssh keys on philipp@192.168.178.55 if necessary
(you need to enter your password)
The authenticity of host '192.168.178.55 (192.168.178.55)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.178.55' (RSA) to the list of known hosts.
philipp@192.168.178.55's password:
Enter file in which to save the key (/home/philipp/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Generating public/private rsa key pair.
Created directory '/home/philipp/.ssh'.
Your identification has been saved in /home/philipp/.ssh/id_rsa.
Your public key has been saved in /home/philipp/.ssh/id_rsa.pub.
The key fingerprint is:
... philipp@debian
The key's randomart image is:
+--[ RSA 2048]----+
|... |
+-----------------+
==========================================================
your id_dsa.pub:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx......xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
==========================================================
>> transfering your public ssh key
philipp@192.168.178.55's password:
authorized_keys 100% 610 0.6KB/s 00:00
>> login with your public key
(should work without a password)
Linux debian 2.6.26-2-amd64 #1 SMP Thu Nov 25 04:30:55 UTC 2010 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jan 23 17:31:16 2011 from imotep.fritz.box
philipp@debian:~$
So after a long time i plan to give my counter-engine (^^) an update.
The main Problem is, that the counter itself was perfect for ~2000 counts. But now with 5000 count, the presentation of the results is just not readable anymore.
So i plan the following things to do during the next days (i hope i will finish this during tomorrow):
- using a new drawing method: instead of drawing the whole graph, i will draw just time-slices of a particular periode. So e.g. if you want to plot the current graph with this method, it would be necessary to draw 24 slices with a month periode.
- to get read of lots of code within the counter/presentation script, i want to use the build-in date-calculation functions of mysql.
So e.g.
SELECT something FROM `counts` WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;
Should be perfect
.
- To use this functions, i have to use the build-in datetime Datatype. At the moment i am storring all counts with a unix timestamp. To make the move, i have to do three steps:
- creating a new field: ALTER TABLE `counts` ADD `created` DATETIME NOT NULL;
- migrate the old dates: UPDATE `counts` SET created = from_unixtime(unixtime);
- finally i had to change to insert statement within the counter script:
“INSERT INTO `counts` ( … user_string, created) VALUES … ‘”.$user_string.”‘, NOW()) “;
More next time…
root@sunny:/tank/home# apt-get install sun-java6-jre
root@sunny:/tank/home# java -version
dl failure on line 685Error: failed /usr/lib/jvm/java-6-sun-1.6.0.10/jre/lib/i386/client/libjvm.so, because ld.so.1: java: fatal: libCrun.so.1: open failed: No such file or directory
root@sunny:/tank/home# apt-get install sunwlibc
root@sunny:/tank/home# java -version
java version “1.6.0_10″
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode)
root@sunny:/tank/home# apt-get update
Get:1 http://apt.nexenta.org hardy-unstable Release.gpg [185B]
Hit http://apt.nexenta.org hardy-unstable Release
Ign http://apt.nexenta.org hardy-unstable Release
Hit http://apt.nexenta.org hardy-unstable/main Packages
Hit http://apt.nexenta.org hardy-unstable/contrib Packages
Hit http://apt.nexenta.org hardy-unstable/non-free Packages
Hit http://apt.nexenta.org hardy-unstable/main Sources
Hit http://apt.nexenta.org hardy-unstable/contrib Sources
Hit http://apt.nexenta.org hardy-unstable/non-free Sources
Fetched 185B in 1s (151B/s)
Reading package lists… Done
W: GPG error: http://apt.nexenta.org hardy-unstable Release: Internal error: Good signature, but could not determine key fingerprint?!
W: You may want to run apt-get update to correct these problems
root@sunny:/tank/home# apt-get install gnupg add-apt-key
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
gpgv makedev
Suggested packages:
gnupg-doc xloadimage
The following NEW packages will be installed:
gpgv makedev
The following packages will be upgraded:
gnupg add-apt-key
1 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 1957kB of archives.
After this operation, 5050kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
gpgv makedev gnupg
Install these packages without verification [y/N]? y
root@sunny:/tank/home# apt-get update
Hit http://apt.nexenta.org hardy-unstable Release.gpg
Hit http://apt.nexenta.org hardy-unstable Release
Hit http://apt.nexenta.org hardy-unstable/main Packages
Hit http://apt.nexenta.org hardy-unstable/contrib Packages
Hit http://apt.nexenta.org hardy-unstable/non-free Packages
Hit http://apt.nexenta.org hardy-unstable/main Sources
Hit http://apt.nexenta.org hardy-unstable/contrib Sources
Hit http://apt.nexenta.org hardy-unstable/non-free Sources
Reading package lists… Done
Disable new Toolbar Features (e.g. tabs on top)
defaults write com.apple.Safari DebugSafari4IncludeToolbarRedesign -bool NO
Disable iPhone-Style Progress-Bar
defaults write com.apple.Safari DebugSafari4LoadProgressStyle -bool NO
via: fscklog.com
http://mbff.hausswolff.de/TEST_map.php
was man damals alles so gemacht hat
find all .svn folders:
find . -type d -name .svn
./.svn
./sourceA/.svn
./sourceB/.svn
./sourceB/module/.svn
./sourceC/.svn
delete all .svn folders:
rm -rf `find . -type d -name .svn`
via: http://www.anyexample.com/linux_bsd/bash/recursively_delete__svn_directories.xml
Yesterday I found myself in a strange situation:
Every Shell Command I tried to use ended up with a “command not found“. This happened with sudo, nano … you name it.
After a short time, I figured out that the folder /usr/bin (where all these programs are stored) had only executable rights for the owner (so admin:wheel).
As a normal user I was not able to use them.
So how to change this if you cannot sudo ?
As always in MacOS, the best way to fix this, is to boot into Singe User Mode (restart and press the Apple/Command Key + “S”).
After you got into the Terminal view you have to scan the filesystem for errors:
/sbin/fsck -fy
And then remount it as writable:
/sbin/mount -wu /
Now, you can alter the user rights for /usr/bin with:
chmod 755 /usr/bin
After a reboot you are again able to execute the commands.
If you still have problems you should control your PATH-settings.
echo $PATH
It should contain /usr/bin near the beginning.
root@sunny:~# zfs create tank/home
root@sunny:~# zfs create tank/home/philipp
root@sunny:~# zfs create -V 250M tank/home/philipp/TM
root@sunny:~# zfs set shareiscsi=on tank/home/philipp/TM
root@sunny:~# iscsitadm modify target -p 1 tank/home/philipp/TM
root@sunny:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
syspool 689M 16.6G 23K none
syspool/rootfs-nmu-000 688M 16.6G 641M legacy
syspool/rootfs-nmu-000@initial 47.3M - 631M -
tank 250M 1.34T 21K /tank
tank/home 250M 1.34T 27.5K /tank/home
tank/home/philipp 250M 1.34T 27K /tank/home/philipp
tank/home/philipp/TM 250M 1.34T 24K -
tank/media 18K 1.34T 18K /tank/media
root@sunny:~# iscsitadm list target -v
Target: tank/home/philipp/TM
iSCSI Name: iqn.1986-03.com.sun:02:f683c44e-e774-c018-9f6f-89ef914db75b
Alias: tank/home/philipp/TM
Connections: 0
ACL list:
TPGT list:
TPGT: 1
LUN information:
LUN: 0
GUID: 0
VID: SUN
PID: SOLARIS
Type: disk
Size: 250M
Backing store: /dev/zvol/rdsk/tank/home/philipp/TM
Status: online
(via Solaris iSCSI Target with ESX 3.02 Server)