02 setembro, 2011

Buscando cotação de Dólar e Euro no Google Docs

Na planilha do google docs, use a função:

Euro/Real
=GoogleFinance("CURRENCY:EURBRL" ; "average")

Dolar/Real
=GoogleFinance("CURRENCY:USDBRL" ; "average")  

Converter arquivo do Nero (.ngr) para ISO (.iso) usando Linux

Em uma sessão de terminal (shell), execute:
dd bs=1k if=imagem.nrg of=imagem.iso skip=300

Criar arquivo .ico (ícone windows) usando LINUX/GIMP

1. Abrir a imagem no GIMP
2. Se a imagem não for um quadrado, ajustar o tamanho do canvas
3. Diminua a imagem para 16x16
4. Salve como um arquivo pnm (Ex: favicon.pnm)
5. Feche o GIMP
6. Converta o arquivo pnm usando a ferramente ppmtowinicon em shell
ppmtowinicon -output favicon.ico favicon.pnm

Script para facilitar o acesso ao RedBoot de alguns roteadores

# set the IP address and the port for the loader.
set target "192.168.0.1"
set port 9000
# 1. Start ping and wait for a response.
# 2. When RedBoot is alive, start the telnet session.
# 3. Allow .5 seconds after the connect for telnet
# to get his act in order.
# 4. Send the ^C and wait for the RedBoot prompt.
# 5. Get the version information.
# 6. Return control to the user.
spawn ping $target
set timeout -1
expect {
-re "time=.*$" close
}
spawn telnet $target $port
expect -re "Escape character is.*$" {
sleep .5
send \003
expect "RedBoot>" {
send "version\r"
}
}
interact


*Precisa ter o pacote "expect" instalado. No debian faça: apt-get install expect

Mplayer com controle via arquivo FIFO

Criar arquivo FIFO:
mkfifo /tmp/test.fifo
Iniciar o mplayer em segundo plano, mostrando a imagem em framebuffer (sem precisar do X11 instalado ou em execucao). Pode trocar a opcao "-vo" caso queira a saida do vídeo em outro dispositivo:
mplayer -slave -quiet -fs -zoom -vo fbdev -input file=/tmp/test.fifo -vf screenshot -tv noaudio:driver=v4l2:device=/dev/video0:hue=0:brightness=5:contrast=5 tv:// >/tmp/mplayer.log 2>/tmp/mplayer.err &
Exemplo de comando para controle:
echo "screenshot 0" > /tmp/test.fifo
Exemplo de como tirar um snapshot em intervalos regulares:
while true; do echo "screenshot 0" >/tmp/test.fifo identify shot*.png >/dev/null 2>&1; while [ $? -ne 0 ]; do identify shot*.png >/dev/null 2>&1; done name=`ls -tr shot*.png | tail -n1` mv $name /run/shm/live.png sleep 1 done