Misc howto use
From CourvilleWiki
Misc howto use notes for describing commands that I use often
Download photos from my canon powershot S50
For that purpose I use gphoto2. The Canon S50 talks PTP in a generic fashion but is now natively supported by gphoto2. In order to retreive all the files I use the following command:
gphoto2 --camera "Canon PowerShot S50 (normal mode)" --get-all-files
For using the default PTP mode you can try instead:
gphoto2 --camera "USB PTP Class Camera"
In order to retreive a special range of photos:
- identify the internal numbers associated with the desired photos through
gphoto2 --camera "Canon PowerShot S50 (normal mode)" -L
- pick the ones (e.g. 47 to 52)
gphoto2 --camera "Canon PowerShot S50 (normal mode)" -p 47-52
Immunity to spams: spamassassin
- create .procmailrc file with the following lines
PATH=/usr/local/bin:/bin:/usr/bin SHELL=/bin/sh LOGFILE=/dev/null SPAMDIR=$HOME/mail/spam # perform before all the filtering for mailing lists here # only process if message under 250*1024 bytes :0fw * < 256000 | spamassassin # reroute tagged as spam emails to your spam mbox # if score is higher than 15 it is almost sure that it is a spam :0: * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* $SPAMDIR/spamassassin-sure # others are probable spams :0: * ^X-Spam-Flag: (Yes|YES) $SPAMDIR/spamassassin-pehaps
- in your .muttrc in order to tag messages as spam use the following macro:
# mark as spam and delete macro index S "|sa-learn --spam --no-rebuild --single\n; <delete-message>\n\n" macro index S "|sa-learn --spam --no-rebuild --single\n; <delete-message>\n\n" # mark as ham and save to some folder macro pager H "|sa-learn --ham --no-rebuild --single\n; <save-message>\n" macro pager H "|sa-learn --ham --no-rebuild --single\n; <save-message>\n" # rebuild the spamassassin bayes filter db macro index R "!/usr/bin/sa-learn --rebuild"
- to learn from a mailbox use:
sa-learn --mbox --spam $SPAMBOX sa-learn --mbox --ham $HAMBOX
- use the following user prefs for spamassassin in .spamassassin/user_prefs
required_hits 3.0 rewrite_subject 0 whitelist_from "*.courville.org", "*.crm.mot.com", "*.motorola.com", "*.enst.fr" # Bloody spammers faking my whitelist!! blacklist_fromno from@email.mot.com *@motgate*.mot.com *@ftpbox.mot.com skip_rbl_checks 1 check_mx_attempts 0 ok_languages fr en use_bayes 1 auto_learn 1 # If Bayesian filter says its spam, I trust it. Up the scores. score BAYES_60 0 0 2.000 2.100 score BAYES_70 0 0 4.000 4.100 score BAYES_80 0 0 5.300 5.400 score BAYES_90 0 0 7.000 7.100 score BAYES_99 0 0 10.200 10.300 # HABEAS warrants are now useless as spammers are forging them score HABEAS_SWE 0
- save your unfiltered spams into a specific folder e.g.: mail/spam and make spamassassin learn about it through a sa-learn --spam --mbox $HOME/mail/lspam then erase the mailbox.
install full directory content on your palm
- I use either jpilot (gui) or directly pilot-link commands:
pilot-xfer -p /dev/usb/tts/1 -i *.prc *.pdb
rebuild index for damaged avi file
- for single play (no fix): mplayer -idx myvideo.avi
- fix it: mencoder -oac copy -ovc copy infile.avi -o outfile.avi
- in case of serious damage use ffmpeg which is more fault tolerant: ffmpeg -i infile.avi -acodec copy -vcodec copy -o outfile.avi
- save index: mplayer -idx myvideo.avi -saveidx myvideo.idx
- use saved index: mplayer myvideo.avi -loadidx myvideo.idx
convert your vhs family tapes into divx movies
- perform acquisition with your happauge PVR250 in mpeg format using 720x576 resolution through a cat /dev/video3 > myvideo.avi. What I did is to use both peritel outputs of my VCR one linked to the PVR250 the other one linked to a standard video card in another PC for monitoring and launching remotely the acquisition. This way you avoid the inavoidable delay introduced by the MPEG coding of the PVR250.
- get rid of the temp file
rm frameno.avi
- perform 1st path audio only avi creation
mencoder input.mpg -ovc frameno -oac mp3lame -lameopts vbr=3 -o frameno.avi
- run 2nd path: actually 1st video path, use as bitrate the mencoder recommendation values for 650/700/800Mb files after previous pass
mencoder input.mpg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=$bitrate -o output.avi
- finish by the 3rd path: actually 2nd video path, optionnaly replace as bitrate the mencoder recommendation values for 650/700/800Mb files after previous pass
mencoder input.mpg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=$bitrate -o output.avi
- for an enhanced quality I use the following script:
#!/bin/sh filein=$1 fileout=$2 sizex=$3 sizey=$4 bitrate=$5 rm -f frameno.avi mencoder $filein -ovc frameno -oac mp3lame -lameopts vbr=3 -o frameno.avi echo potentially refine bitrate variable based on above inputs mencoder $filein -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=$bitrate:vqscale=3:vhq:v4mv:trell -o $fileout -vf scale=$sizex:$sizey -sws 2 echo potentially refine bitrate variable based on above inputs mencoder $filein -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=$bitrate:vqscale=3:vhq:v4mv:trell -o $fileout -vf scale=$sizex:$sizey -sws 2
- acquisition of dv with sony dvcam, by default do autosplit and include date time in filename
dvgrab --format dv2 --autosplit --timestamp aviout-
Printing with gimp/cups/turboprint
- configure printer as Postscript level 2
- select proper media size
- remove the -oraw option only should remain lp -s -dplume if plume is your target printer
smbclient and french charset
What I use for displaying correctly the filenames (avoiding the alternate command) when using a smbclient:
smbclient //windaube/docs -t iso8859-15
completion under zsh doesn't work after update
If you get after an update:
ls ^I _normal:23: command not found: _set_command _normal:25: command not found: _dispatch
then something changed in the completion function and all you need is to erase the temporary completion file
rm ~/.zcompdump; exec zsh
CVS update command
alias cup='cvs -qz3 up -PAd'
burn iso of your favorite distro
cdrecord -v -dao -eject dev=0,0,0 speed=52 driveropts=burnfree fs=4049k timeout=20 -overburn -isosize sarge-i386-netinst.iso
Euro symbol with latex
apt-get install tetex-eurosym
\usepackage{eurosym}
\euro{10.00}
Create your xface
- get the appropriate software
apt-get install xfaces compface
- generate a square image with gimp out of your photographic picture
echo -n "X-Face:" > my_image.face convert -despeckle -geometry 48x48 my_image.jpg xbm:- | compface >> my_image.face
- in order to include the resulting line in your .muttrc use quote-x-face to quote some forbidden characters
./quote-x-face my_image.face > muttrc.face
cat quote-x-face
#!/usr/bin/perl -w
# perl script to quote my_hdr commands for Mutt.
# mainly useful for X-Face. headers.
# (c) 2004 Christoph Berg, GNU GPL.
# 2004-06-13 cb: initial version
@f = <>;
foreach (@f) {
chomp;
s/(\\;'"`\$#)/\\$1/g;
}
print "my_hdr ";
print join '\n', @f;
print "\n";
List open ports
echo "Open Ports:"; netstat -anp | grep LISTEN | grep tcp | awk '{print $4, "\t", $7}' | less

