Posts Tagged tips
Nuovo codice per invitare tutti gli amici di facebook
Pubblicato da Alessandro Lorenzi in Appunti Vari il marzo 27, 2011
javascript:var elms=document.getElementsByName("checkableitems[]");for(var count=0;count<elms.length;count++){var t = setTimeout("elms["+count+"].click()",100)}
Scaricare tutte le foto di flickr
Pubblicato da Alessandro Lorenzi in Linux, Software il marzo 26, 2011
#!/bin/bash
url= $1
wget "${url}" -O - -o /dev/null | while read line
do
url=`echo $line | grep media:content | grep -E "http://.*.jpg" -o `
if [[ ${#url} -gt 0 ]]
then
title=''
while [[ ${#title} -eq 0 ]]
do
read line
title=`echo $line | grep media:title | grep -o ">.*<" | sed "s/>//" | sed "s/<//"`
done
echo "--------------------------------------"
echo "TITLE: $title"
echo "URL: $url"
wget "${url}" -O "${title}.jpg" -o /dev/null
fi
done
Installare Wavelet Denoise su fedora
Pubblicato da Alessandro Lorenzi in Appunti Vari il marzo 21, 2011
I passi per installare Wavelet Denoise su Fedora 14
# wget http://registry.gimp.org/files/wavelet-denoise-0.3.1.tar.gz # tar xf wavelet-denoise-0.3.1.tar.gz # cd wavelet-denoise-0.3.1 # yum install -y gettext gcc gimp-devel # make # make userintall
Inserire FTP in uno script ksh
Pubblicato da Alessandro Lorenzi in Appunti Vari, programmazione il febbraio 15, 2011
#! /usr/bin/ksh HOST=remote.host.name USER=whoever PASSWD=whatever exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd directory print -p binary print -p put tar.gz print -p bye wait exit 0
That is the file descriptor manipulation. Recall that fd 0 is standard-in, fd 1 is standard-out, and fd 2 is standard-error. The line “exec 4&>1″ opens fd 4 and assigns it to whatever fd 1 was assigned to. As you will see, I am sorta “saving a copy of fd 1 in fd 4″. The line “ftp -nv >&4 2>&1 |&” is a little harder. The “|&” turns the process into a co-process that allows subsequent “print -p” statements to send lines to the co-process’ standard-in and “read -p” to read from its standard-out. So ksh forks a copy of itself and fiddles with the fd’s 0 and 1 until this it set-up. But it leaves the rest of the fd’s alone. Then it encounters “>&4″ which causes it to set the ftp process’ standard out to whatever 4 is. Well since 4 is a copy of 1 before the co-process, we are back to writing to the original shell’s standard out. Lastly, the 2>&4 does the same thing for standard error. I could’ve used “2>&1″ at this point for the same effect. This is hard to explain, but I hope this helps.
Skype plugin per pidgin
Pubblicato da Alessandro Lorenzi in Linux, Uncategorized il gennaio 6, 2011
Oggi ho installato il plugin per utilizzare skype su pidgin.
Installarlo é molto semplice:
Prima di tutto dobbiamo accertarci di avere installato skype e pidgin:
$ pidgin -v Pidgin 2.7.7-1.fc14 (libpurple 2.7.7) $ skype -v Skype 2.1.0.81 Copyright (c) 2004-2009, Skype Limited
Poi copiare il plugin nella directory corretta :
$ mkdir ~/.purple/plugins $ cd ~/.purple/plugins $ wget http://eion.robbmob.com/libskype.so
Ora basta riavviare pidgin tenendo skype chiuso e creare il nuovo utente skype. Al primo avvio skype chiederá se pidgin é autorizzato ad utilizzare le api. Diciamo gli di ricordare la nostra risposta che, ovviamente é si.
Array in ksh
Pubblicato da Alessandro Lorenzi in Uncategorized il novembre 2, 2010
Gli array in ksh si gestiscono cosí:
# set -A MyArray campo1 campo2 campo3
# echo ${MyArray[0]}
campo1
# for i in ${MyArray[@]}
> do
> echo $i
> done
campo1
campo2
campo3
Nohup – Staccarsi da terminale
Pubblicato da Alessandro Lorenzi in Linux, programmazione il ottobre 27, 2010
Quando lanciamo un comando la shell genera un processo figlio. Molti di voi sanno che basta aggiungere il carattere & dopo il comando + argomenti per riavere la shell.
E’ anche vero che pero’ quando il terminale viene chiuso il processo si interrompe. Questo accade perche’ riceve un segnale hup.
Per ovviare a questo problema lanciamo la riga con nohop iniziale
nohup [command] &
Inoltre ci troveremo l’output del comando nel file nohup.out
Ecco un esempio di utilizzo:
nohup find . -name "*something*" -type f > altrofile.out

Commenti recenti