sexta-feira, 27 de março de 2015

Verificar se uma pagina sofreu atualização

http://www.mostlymaths.net/2010/01/cron-diff-wget-watch-changes-in-webpage.html

Then I realised I could write a script to do it, using diff and wget. You can get it below. You have to edit it to add the pages you want to follow, then run it with the "write" option to download the first version, then edit yourcrontab file (crontab -e) to run it every day at a specified time with the "diff" option. For example:
00 13 1,7,14,21,28 * * /home/user/PageDiff.sh diff
will run it every 1st, 7th, 14th, 21st and 28th of the month, at 13:00. Be sure to first run it as write.

#!/bin/sh # Copyright 2009 Ruben Berenguel # ruben /at/ maia /dot/ ub /dot/ es # PageDiffs: Fill in an array of webpages, with the option "write" # will download them, with the "diff" option will re-download them and # check the new against the old for differences. With the "diff mail" # option, will send an email to $MAILRECIPIENT, assuming mail works. # You can find the most up to date version of this file (and the GPL) # http://rberenguel.googlecode.com/svn/trunk/Bash/PageDiffs.sh # 20091226@00:24 MAILRECIPIENT="mail@mail.com" j=0 Pages[j++]="http://www.maia.ub.es/~ruben/" Pages[j++]="http://www.google.es" #Add more pages as above if [ "$1" = "write" ]; then echo Generate files count=0 for i in "${Pages[@]}" do echo Getting "$i" into File$count wget "$i" -v -O "File$count" let count=$count+1 done fi if [ "$1" = "diff" ]; then count=0 for i in "${Pages[@]}" do # echo Getting "$i" into Test$count wget "$i" -q -O "Test$count" Output=$(diff -q "Test$count" "File$count" | grep differ) Result=$? if [ "$Result" = "0" ]; then if [ "$2" = "mail" ]; then echo Page at "$i" has changed since last check! >> MailCont mail=1 fi echo Page at "$i" has changed since last check! else echo Page at "$i" has not changed since last check! fi #rm Test$count let count=$count+1 done if [ "$mail" = "1" ]; then mail -s "Page changed alert!" $MAILRECIPIENT

quarta-feira, 25 de março de 2015

bash

procura por asd no testehead.txt e exibe apenas a linha que o contém.
grep "asd" testehead.txt | head -n 1

\> --> significa que é para entender como caractere e não comando. Para isso usa-se a barra invertida.

tr -d \<   --> apaga o caractere <




sexta-feira, 20 de março de 2015

Graus sexagesimal para grau decimal - Excel Calc LibreOffice Open Office

Tendo um número no campo C5 com valor de 356.1224, sendo 356 graus 12 minutos e 24 segundos. Para passar para o decimal no OpenOffice:

=INT(C5) + (INT(((C5-INT(C5))*100)) /60) + (( ( ((((C5-INT(C5))*100))) -  (INT(((C5-INT(C5))*100)))) * 100)/3600)

quarta-feira, 11 de março de 2015

Sincronizar Google Driver no Linux Mint

sudo add-apt-repository ppa:thefanclub/grive-tools && sudo apt-get update && sudo apt-get install grive-tools


sexta-feira, 6 de março de 2015

Asus Zenfone 5

Fazer o hard reset, padrão de fábrica, não remove as atualizações do sistema. Logo, se quiser voltar a atualização do firmware para antes da atualização que impede a escrita para o sdcard, tem que baixar direto do site da asus, pois voltando para o padrão de fábrica só altera os aplicativos instalados.

O lollipop passará a ter acesso ao sdcard sem bloqueio, pelo menos é o que dizem. Será lançado para o zenfone 5 em abril de 2015.