Random notes & other stuff…
…about Linux, electronics, digital photography, whatever…-
File copy snippets
Posté le 27th septembre 2008 Pas de commentairesUseful file copy snippets collection for systems administration. scp is not here : syntax is trivial, and scp is really slow. The snippets below are supposed to be much faster, especially when dealing with many small files.
netcat style
- On sender :
cd to the top dir to be copied recursively, and :
tar cv . | nc -vq 10 -l -p 1234- On receiver :
cd to the dir where the content has to be copied, and :
nc -v sender 1234 | tar xf -ssh style
- Data is remote, copy to where I am now :
ssh user@source "cd /source/dir; tar cv ." | tar x- Data is in current directory, copy to remote server :
tar cv . | ssh user@destination "cd /dest/dir; tar x"rsync+ssh style
- Data is in current directory, copy to remote server :
rsync -ve ssh -ar . user@destination:/dest/dir/Note : add ‘z’ to tar options if link is slow
-
Calculate internal battery resistance
Posté le 27th septembre 2008 Pas de commentairesBattery internal resistance forms a divider with external load.
So to calculate internal resistance, take those steps :- measure the battery voltage without load (Vnoload)
- measure again with a resistor of RloadΩ attached (the lower ohm value, the better, but watch outfor power ratings !), you have a difference with previous measurement (Vdrop)
The battery internal resistance is then :
Rbattery = Vdrop*Rload/(Vdrop+Vnoload)Real world example on AA :
Vnoload = 1.421vRload = 460ΩVdrop = 0.002vThus :
Rbattery = (0.002 x 460)/(0.002 + 1.421) = 0.65ΩSince my metter has a milliVolts resolution, we just have a range between 0.001 and 0.003 for Vdrop.
So Rbattery can be anything between 0.33Ω and 1Ω.Short-circuit current for this AA battery would be somewhere between 1.421/0.33 = 4.33A and 1.421/1 = 1.42A
Mesasurement made, it is around 4.2A. Watch out for your metter current rating if you do this. Some batteries have a much lower internal resistance. -
Video snippets
Posté le 27th septembre 2008 Pas de commentairesFew usefull video snippets.
Grabbing from DV cam, autosplitting scenes :
dvgrab -- autosplit -timestamp –format=dv2 videoDeinterlacing :
ffmpeg -i in-dv.avi -deinterlace -vcodec huffyuv -pix_fmt yuv422p -target pal-dvd out.aviFlv encoding :
ffmpeg -i input.avi -ar 22050 -ab 64 -aspect 4:3 -b 768k -pass 1 -f flv -s 640x480 -acodec mp3 output.flvthen again with
-pass 2.
Another solution :
mencoder out.avi -o out.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -
Microchip MCP23S08
Posté le 27th septembre 2008 Pas de commentairesThis chip is a 8-bits port expander driven by SPI (or I2C for MCP23008 version).

