dimanche 27 janvier 2013

Rotation de vidéos


RAAHHH, ces vidéos mal tournées, ça fait flipper ! ;)
Et hop un petit script pour roter ;) automatiquement et encoder ces sa***** de .MOV de nos IPhone ch**** !



#!/bin/bash 
OIFS="$IFS"
IFS=$'\n' 
FAILED="";

for FILE in `find ./ -iname \*.MOV` ;
do
DATE=`stat -c %y $FILE |cut -c1-17|sed 's/[- :]//g'`
DATE="$DATE.00"
echo "Traitement de $FILE ($DATE)"
ROTATION=`mediainfo  --Inform="Video;%Rotation%" $FILE`
case "$ROTATION" in
"0.000")
mencoder -really-quiet -oac mp3lame -lameopts abr:br=56 -ovc x264 -x264encopts subq=5:partitions=all:8x8dct:frameref=2:bframes=3:b_pyramid=normal:weight_b $FILE -o $FILE.avi
RES=$?
;;
"90.000")
echo "=> Rotation 90° !"
mencoder -really-quiet -oac mp3lame -lameopts abr:br=56 -ovc x264 -x264encopts subq=5:partitions=all:8x8dct:frameref=2:bframes=3:b_pyramid=normal:weight_b -vf rotate=0 $FILE -o $FILE.avi
RES=$?
;;

"180.000")
echo "=> Retournement !"
mencoder -really-quiet -oac mp3lame -lameopts abr:br=56 -ovc x264 -x264encopts subq=5:partitions=all:8x8dct:frameref=2:bframes=3:b_pyramid=normal:weight_b -vf flip,mirror $FILE -o $FILE.avi
RES=$?
;;

*)
echo "=> Rotation $ROTATION non gérée !"
RES=1;
;;
esac
echo "Résultat : $RES";
touch -t $DATE $FILE.avi
if [ $RES == 0 ]; then
vlc $FILE.avi
echo "OK ? (O/n)"
read rep
REP=`echo $rep| tr -s a-z A-Z`
if [ $rep == "N" ]; then
FAILED="$FAILED \n $FILE";
rm $FILE.avi
else
rm $FILE
fi
fi
done
echo -e "Fichiers en échec : \n $FAILED"
rename 's/MOV\.avi/avi/' *.MOV.avi
IFS=$OIFS

mercredi 16 janvier 2013

Checking pfSense with SNMP


Checking pfSense with SNMP

Command examples for monitoring a pfSense router using SNMP.
snmpwalk -v 1 -c public
Interface list
snmpwalk -v 1 -c public | grep ifDescr
Interface status
snmpwalk -v 1 -c public | grep ifOperStatus
Source : Production Monkeys  

AMHA, ça sert à rien sans un bon Zabbix...

jeudi 22 novembre 2012

Départ en vacances : réencondage MKV en AVI

Hey, le MKV DTS multi tracks ça roxx !

Sauf que, en prévision de vacances pluvieuses, si vous souhaitez emporter vos films sur support amovible (et garder au chaud vos originaux biens chèrement acquis), benh vous risquez vous retrouver le bec dans l'eau : pas mal de TV "standard", si elles ont bien un port USB (quand ce n'est pas un port d'administrations), n'aiment pas encore tout à fait bien ce format...

Alors le script ci-dessous est votre ami !

jeudi 1 novembre 2012

screen Quick Reference


Source: APeriodic.net

screen Quick Reference

Getting in

start a newscreen session with session namescreen -S 
list running sessions/screensscreen -ls
attach to a running sessionscreen -r
… to session with namescreen -r 
the “ultimate attach”screen -dRR (Attaches to a screen session. If the session is attached elsewhere, detaches that other display. If no session exists, creates one. If multiple sessions exist, uses the first one.)

Escape key

All screen commands are prefixed by an escape key, by default C-a (that's Control-a, sometimes written ^a). To send a literal C-a to the programs in screen, use C-a a.

Getting out

detachC-a d
detach and logout (quick exit)C-a D D
exit screen“C-a : quit” or exit all of the programs in screen.
force-exit screenC-a C-\ (not recommended)

Help

See helpC-a ? (lists keybindings)
The man page is the complete reference, but it's very long.

Window Management

create new windowC-a c
change to last-visited active windowC-a C-a (commonly used to flip-flop between two windows)
change to window by numberC-a  (only for windows 0 to 9)
change to window by number or nameC-a '
change to next window in listC-a n or C-a
change to previous window in listC-a p or C-a
see window listC-a " (allows you to select a window to change to)
show window barC-a w (if you don't have window bar)
close current windowClose all applications in the current window (including shell)
kill current windowC-a k (not recommended)
kill all windowsC-a \ (not recommended)
rename current windowC-a A

Split screen

split display horizontallyC-a S
split display verticallyC-a | or C-a V (for the vanilla vertical screen patch)
jump to next display regionC-a tab
remove current regionC-a X
remove all regions but the current oneC-a Q

Scripting

send a command to a named sessionscreen -S  -X 
create a new window and run ping example.comscreen -S  -X screen ping example.com
stuff characters into the input buffer
using bash to expand a newline character
(from here)
screen -S <name> [-p <page>] -X stuff $'quit\r'
a full example
# run bash within screen
screen -AmdS bash_shell bash
# run top within that bash session
screen -S bash_shell -p 0 -X stuff $'top\r'
 
# ... some time later
 
# stuff 'q' to tell top to quit
screen -S bash_shell -X stuff 'q'
# stuff 'exit\n' to exit bash session
screen -S bash_shell -X stuff $'exit\r'

Misc

redraw windowC-a C-l
enter copy modeC-a [ or C-a  (also used for viewing scrollback buffer)
pasteC-a ]
monitor window for activityC-a M
monitor window for silenceC-a _
enter digraph (for producing non-ASCII characters)C-a C-v
lock (password protect) displayC-a x
enter screen commandC-a :