terça-feira, 29 de setembro de 2015

wget

wget -r -np -l 2 -A zip

livros

http://www.ufo.com.br/loja/livraria/ver/contatos-extraterrestres-na-amazonia

http://www.ufo.com.br/loja/biblioteca/ver/varginha-toda-a-verdade-revelada

Pavilhão 18?

sexta-feira, 18 de setembro de 2015

crontab - script python

Exemplo para rodar a cada 10 minutos

0,10,20,30,40,50 * * * * /usr/bin/python script.py

ou

*/10 * * * * /usr/bin/python script.py

* = em
*/10 = em 10 em 10 minutos

Se fizer um script com interface gráfica é necessário adicionar env DISPLAY=:0.0
E no shell executar xhost +
# rodar a cada minuto
*/1 * * * * env DISPLAY=:0.0/usr/bin/python script.py

Rodar de hora em hora, entre 7 da manha e 11 da noite

0 7-23/1 * * * /endereco/comando
ou
0 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * /endereco/comando



Python - Exemplos do comando Split e Join

Fonte: http://www.webmasterwords.com/python-split-and-join-examples

sentence = "the cat sat on the mat"
print sentence.split()
['the', 'cat', 'sat', 'on', 'the', 'mat']
Split words separated by a single character:
sentence = "the,cat,sat,on,the,mat"
print sentence.split(',')
['the', 'cat', 'sat', 'on', 'the', 'mat']
Split words separated by a string:
sentence = "theSPACEcatSPACEsatSPACEonSPACEtheSPACEmat"
print sentence.split('SPACE')
['the', 'cat', 'sat', 'on', 'the', 'mat']
Split only the first two words in a comma separated string
sentence = "the,cat,sat,on,the,mat"
print sentence.split(',',2)
['the', 'cat', 'sat,on,the,mat']
Python Join
Join uses a sligthly difference implmentation to what you might be used to. The character that joins the elements is the one upon which the function is called
Joining an array with spaces
' '.join(['the', 'cat', 'sat', 'on', 'the', 'mat'])
'the cat sat on the mat'
Joining an array with commas
','.join(['the', 'cat', 'sat', 'on', 'the', 'mat'])
'the,cat,sat,on,the,mat'

sexta-feira, 11 de setembro de 2015

Coursera SimpleGui

Usar o simplegui para fazer os exercícios propostos no curso de python da Coursera.

Baixar o pacote simpleguitk de: https://pypi.python.org/pypi/SimpleGUITk
descompactar a pasta simpleguitk para a pasta onde você tem os scripts das aulas do coursera.
e importar no arquivo .py da seguinte forma:

import simpleguitk as simplegui 

Atenção que a pasta simpleguitk está dentro de pasta SimpleGUITK-1.1.3.tar.gz, e dentro dela existem 3 pastas, uma delas é a simpleguitk.

Agora é possível usar o mesmo código escrito no codeskulptor.

quinta-feira, 10 de setembro de 2015

montar automaticamente o zenfone 5 no debian

Montar automaticamente o asus zenfone 5 no debian testing

root:~$ lsusb
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 0b05:5480 ASUSTek Computer, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 192f:0416 Avago Technologies, Pte. ADNS-5700 Optical Mouse Controller (3-button)
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

temos ali na quinta linha: ID 0b05:5480 ASUSTek Computer, Inc. 
0b05 eh o vendor id
5480 eh o product id

instalar apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9

colocar no /etc/fuse.conf --> user_allow_other

tem que adicionar rule 51 tmb

nano /etc/udev/rules.d/51-android.rules a linha abaixo:

ATTR{idVendor}=="0b05", ATTR{idProduct}=="5480", MODE=”0666"


# sudo service udev restart
# sudo reboot


terça-feira, 1 de setembro de 2015

Para deixar mais mais claro, vamos a um exemplo prático. A taxa SELIC está em 8% ao ano. Supondo que ela não mude nos próximos 12 meses, se você comprasse a LFT 070317 com taxa de -0,05%, sua rentabilidade bruta nos próximos 12 meses seria 7,95%.
Apesar do resultado coincidir, não se trata de uma subtração (8,00% – 0,05% = 7,95%). O modo correto de calcular seria esse:

(1 + Taxa Bruta) = (1 + SELIC) * (1 + TaxaCompra) = (1 + 0,08) * (1 – 0,0005) = 1,08 * 0,9995
(1 + Taxa Bruta) = 1,07946
Então: Taxa Bruta = 0,07946 ou 7,946% (aproximadamente 7,95%).

Ufa!

http://queroficarrico.com/blog/2013/06/06/lft-taxa-negativa/