Il blog di Gas

Solo un altro sito WordPress

Move files with zenity progress bar

with one comment

I’m playing with a script that moves files between two directories and does that by piping two tar commands, so called Fast Copy.

You need zenity to see the progress bar, it is a work in progress as there are some bugs, eg when you click “cancel” the two tar child processes are not killed for some reason, I couldn’t get the correct exit code that probably gets lost somewhere.

Probably in the future I’ll write a better notification.Suggestions and modifications are wellcome.

 

 

 

Written by gas

luglio 22nd, 2011 at 4:52 pm

Posted in English,Linux

Tagged with , , ,

Working pidgin facebook chat for linux 64 bit

without comments

Already compiled, just grabbed from svn, put this file in /usr/lib64/purple-2/ and rename it to libfacebook.so

Written by gas

maggio 12th, 2011 at 3:42 pm

Posted in English,Linux

Tofu ripieno di carne

without comments

Mettere nell’acqua 20 minuti i funghi ( tipo insalata, sottili, venduti secchi)
tagliarli più piccoli e togliere le parti dure
sciacquarli un paio di volte

Mettere il macinato in una terrina con pepe, fecola, soia e olio di sesamo, stavola sale perchè li mettiamo nel tofu e non possiamo metterlo alla fine

carne a conciare
lasciar li a conciare per 20 min

aprire il tofu e metterci la carne

preparazione tofu

padella a fuoco alto con strato di olio

mettere su il tofu dalla parte della carne e poi girare

cottura

togliere quando pronto e tenere l’olio in padella

nella padella con l’olio rimasto mettere garlic, ginger, chili e poi i funghi

cottura funghi e spezie

dopo un po a rosolare mettere il tofu ripieno

cottura finale tofu

aggiungere un centimetro scarso di acqua fredda e cuocere finchè  si asciuga

piatto finito

Written by gas

marzo 2nd, 2011 at 1:05 pm

Posted in Ricette

Tagged with

Zuppa con germogli di funghi

without comments

Mettere in una pentola olio, garlic, ginger e rosolare
aggiungere un po di carne macinata conciata come al solito

poi aggiungere i funghi in scatola (germogli di funghi) e rosolare

aggiungere acqua abbondante e consumare a fuoco lento

zuppa con germogli di funghi

Written by gas

marzo 2nd, 2011 at 12:10 pm

Posted in Ricette

Tagged with

Gnome places double entries

without comments

As a gentoo user I’ve been stuck with gnome 2.26 for ages and when I emerged gnome 2.28 I found out that two out of three nfs shares had double entries in the gnome places menu. It seems that there is some sort of problem with gvfs, some users have reported double entries in gnome places for local mounts and for remote shares.
I could solve the problem (now, end life of gnome 2.30) by mounting my shares with “defaults” as an option. These things make me wonder why I like computers.

Written by gas

settembre 13th, 2010 at 8:42 pm

Posted in English,Linux

Tagged with ,

Move files in bash with tar and progress bar

with 4 comments

Example
gas@caldaia ~ $ my_move source_dir/ dest_dir/
43.5GB at 61.0MB/s eta: 59s 91% [=========== ]

You need to install “command line progress bar”, in gentoo it can be installed with emerge bar in ubuntu the deb can be grabbed here and installed with gdebi.

my_move:
#! /bin/sh
SOURCE="$1"
DEST="$2"
SIZE=$(du -sb "$SOURCE"|awk '{print $1}')
(cd "$SOURCE" && tar -cf - *)|bar -s $SIZE| (cd "$DEST" && tar -xBpf -)

Written by gas

settembre 11th, 2010 at 3:14 pm

Posted in English,Linux

Tagged with , ,

PixieLive

without comments

A friend of mine, Christian, has released PixieLive, a slax based live linux distro build with gentoo.
It’s one of the few live distributions that support Intel GMA500, popular on netbooks like some Asus EEEPC.

PixieLive

Written by gas

agosto 26th, 2010 at 7:04 pm

Posted in English,Linux

Tagged with , , ,

Audio transcoding in bash

without comments

A proper transcode must have a lossless audio format as a source, a good one is flac ,stands for Free Lossless Audio Codec, because it does the job well and has a good licence ( BSD and GPL ).

If you have some flacs and want them in mp3 format (you need lame and flac) you can use this one liner:
for FILE in *.flac; do flac -cd "${FILE}" | lame - "${FILE/.flac/.mp3}"; done

the above line decodes every file that ends in .flac to the standard output (screen) and pipes it to lame that will encode it. “${FILE/.flac/.mp3}” will be the output file, in bash that means: take the variables “$FILE” (that is the original filename), remove “.flac” and substitute “.mp3″.

Nowadays I transcode quite often to 320 kbit/s constant bit rate (CBR)

  • achieving the best quality for an mp3 and still being highly portable, some players don’t like variable bitrate of high quality ( like the V0 preset)
  • doing something unefficient since mp3 is not a good codec for that quality but if your stereo reads just mp3 you don’t have any choices

I simply need to use lame with the proper switches , the above one liner becomes:
for FILE in *.flac; do flac -cd "${FILE}" | lame --cbr --preset insane - "${FILE/.flac/.mp3}"; done

To rip my compact discs and encode my music in flac I use a program for windows called Exact Audio Copy (EAC), my Wine build doesn’t like it for some reasons and Virtualbox has historical problems in handling cdroms correctly, the solution was VMWare. The native solution is RubyRipper

Written by gas

agosto 26th, 2010 at 6:50 pm

Posted in English,Linux

Tagged with ,

Fail2ban and postfix sasl

with 2 comments

Today I found the usual chinese trying to get in my smtp to send his spam to the world and I realized that fail2ban wasn’t working because the regexp used to match the offender is wrong.

This is the log entry (/var/log/mail)
Aug 21 22:45:30 myserver postfix/smtpd[12071]: warning: unknown[xxx.xxx.xxx.xxx]: SASL LOGIN authentication failed: authentication failure

and this is the regex that work , just remove the part after “authentication failed” (/etc/fail2ban/filter.d/sasl.conf)

failregex = (?i): warning: [-._\w]+\[\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed

Test it:
fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/sasl.conf

if you are on a slow server or on a big mail server use /var/log/mail.err instead

Written by gas

agosto 21st, 2010 at 11:18 pm

Posted in English,Linux

Tagged with ,

Unmerge Kde in gentoo

without comments

Update

emerge --ask -C `eix -C kde-base --only-names --installed`

nano /etc/make.conf

and delete kde from the USE flags, remove qt3support and qt4 also if you don’t need them anymore

emerge -uavtqND world"

Now you should have just a few kde packages in the list you got as an output of that command, it’s your choice to leave them or unmerge them manually, with unmerge -pv –depclean you can see what packages pulls in your atom.

Written by gas

luglio 24th, 2010 at 11:48 am

Posted in English,Linux

Tagged with , ,