Posts Tagged tips

Nuovo codice per invitare tutti gli amici di facebook

javascript:var elms=document.getElementsByName("checkableitems[]");for(var count=0;count<elms.length;count++){var t = setTimeout("elms["+count+"].click()",100)}

, , ,

Lascia un commento

Scaricare tutte le foto di flickr

#!/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

, , ,

Lascia un commento

Installare Wavelet Denoise su fedora

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 

, , ,

Lascia un commento

Inserire FTP in uno script ksh

#! /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.

, , ,

3 commenti

Skype plugin per pidgin

Oggi ho installato il plugin per utilizzare skype su pidgin.

Pidgin con il plugin Skype su fedora.

Pidgin con il plugin Skype su fedora.


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

Le due icone convivono pacificamente nel vassoio di sistema.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.

, , , , , , ,

2 commenti

Array in ksh

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

, , ,

Lascia un commento

Nohup – Staccarsi da terminale

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

, ,

Lascia un commento

Iscriviti

Get every new post delivered to your Inbox.