This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| >>>import subprocess | |
| >>>subprocess.check_call(['false']) | |
| #Todos sabemos que não existe um comando false. Logo este comando retornará um erro na tela. Da seguinte forma: | |
| #A saída do da execução desse comando será | |
| Traceback (most recent call last): | |
| File "subprocess_check_call.py", line 11, in <module> | |
| subprocess.check_call(['false']) | |
| File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1: Tenham certeza que tem o ABS instalado em suas máquinas. | |
| pacman -Sy abs --nonconfirm | |
| #2: Depois como sudo rodem o ABS (isso pode demorar um pouco). | |
| abs | |
| #3: Crie um diretório temporário para seu novo pacote nvidia. | |
| mkdir -p /var/abs/local/ | |
| #4: Faça uma cópia do conteúdo do diretório nvidia. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1: Instalar pacotes necessários para a compilação do kernel | |
| #Antes de começar você precisa ter certeza que possui as ferramentas de desenvolvimento para que se possa compilar o kernel. Se nao tiver use o comando abaixo. | |
| aptitude install gcc make | |
| #2: Download do kernel versão 2.6.31 | |
| wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2 | |
| #3: Descompactar o arquivo tar (tar.bz2) | |
| tar -xvvjf -C /usr/src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1: Download do kernel | |
| #Faça o download do site oficial do kernel | |
| wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2 | |
| #2: Instalar pacotes necessários para compilação: | |
| #Se precisar de mais um pacote instale. Mas acredito que sejam apenas esses dai mesmo. | |
| pacman -S gcc make libtools patch | |
| #3: Descompactar o kernel | |
| #A pasta preferencial é a /usr/src mas vc pode descompactar em outra pasta qualquer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1: Identificação do seu pendrive. | |
| #Identifique em que porta seu pendrive foi reconhecido. Como fazer isso? Deve ser alguma coisa /dev/sdx. | |
| apt-get install hwinfo | |
| hwinfo --short --disk | |
| #disk: | |
| #/dev/sdb Kingston DataTraveler 2.0 | |
| #/dev/sda TOSHIBA MK1652GS | |
| #2: Zere o pendrive. | |
| #Para não ter problema vamos formata-lo, ou melhor zerá-lo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| #-*- coding:utf-8 -*- | |
| #Definicion of {"YEAR":} dict | |
| #"Value" of year is another dict | |
| #So we have {"YEAR"":{}} | |
| #another dict have: | |
| #{ | |
| #"Key1":["VALUE1"], | |
| #"Key2":["VALUE2"], | |
| #"Key3": ["VALUE3"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| if (len(sys.argv) >= 2): | |
| fi = open(sys.argv[1], 'r') | |
| for i, n in enumerate(fi.readlines()): | |
| print n.rstrip().lower() | |
| fi.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| def isprime(n): | |
| for x in xrange(2, int(n**0.5)+1): | |
| if n % x == 0: | |
| return False | |
| return True | |
| def palindrome(n): | |
| if str(n) == str(n)[::-1]: | |
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| if (len(sys.argv) >= 2): | |
| fi = open(sys.argv[1], 'r') | |
| for i, n in enumerate(fi.readlines()): | |
| x = n.rstrip() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Saving | |
| NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; | |
| // saving an Object | |
| [prefs setObject:Object forKey:@"keyObject"]; | |
| // saving an NSInteger | |
| [prefs setInteger:42 forKey:@"keyInt"]; | |
| // saving a Double |