This file contains 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 python3 | |
""" | |
Autor: cifali@kinghost.com.br | |
Modulo builtin disponivel no core | |
https://docs.python.org/3/library/collections.html?highlight=counter#collections.Counter | |
""" | |
from collections import Counter |
This file contains 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
from sys import argv | |
''' | |
considerando os argumentos enviados | |
quantidade de morango = argumento 1 | |
quantidade de maca = argumento 2 | |
total = soma de maca + morango | |
''' | |
morango = float(argv[1]) | |
maca = float(argv[2]) |
This file contains 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
import argparse | |
from tcolors import bcolors | |
# Using http://www.dnspython.org/ because awesome and using BSD-style license for distribution! | |
from dns.resolver import Resolver, NoNameservers, NoAnswer, NXDOMAIN | |
parser = argparse.ArgumentParser(description='Process nameserver entries') | |
parser.add_argument('-H', '-host', '--hostname', help='domain to query, format <hostname>') | |
parser.add_argument('-ns1', '--nameserver1', nargs='*', help='first nameserver group address or IP, format: ' | |
'<nameserver1> <nameserve2>') | |
parser.add_argument('-ns2', '--nameserver2', nargs='*', help='second nameserver group address or IP, format: ' |
This file contains 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
from tcolors import bcolors | |
from dns.resolver import Resolver | |
sys_r = Resolver() | |
dns1 = ['a.sec.dns.br', 'b.sec.dns.br'] | |
dns2 = ['dns1.stabletransit.com', 'dns2.stabletransit.com'] | |
domain = 'python.org.br' | |
queries = { | |
# '':'a', | |
# '':'mx', | |
# '':'txt', |
This file contains 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
[10:00:17 root@ohhh redis-3.0.2]# make | |
cd src && make all | |
make[1]: Entering directory `/usr/local/install/System-packages/redis-3.0.2/src' | |
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html | |
(cd ../deps && make distclean) | |
make[2]: Entering directory `/usr/local/install/System-packages/redis-3.0.2/deps' | |
(cd hiredis && make clean) > /dev/null || true | |
(cd linenoise && make clean) > /dev/null || true | |
(cd lua && make clean) > /dev/null || true | |
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true |
This file contains 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
set comments= | |
set noai | |
set nu | |
set tabstop=4 | |
shiftwidth=4 | |
expandtab | |
syntax on |
This file contains 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
root@wiki:/home/pythonbrasil2015# apt-get install ruby | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
The following extra packages will be installed: | |
libffi5 libruby1.9.1 ruby1.9.1 | |
Suggested packages: | |
ri ruby-dev ruby1.9.1-examples ri1.9.1 graphviz ruby1.9.1-dev ruby-switch | |
The following NEW packages will be installed: | |
libffi5 libruby1.9.1 ruby ruby1.9.1 |
This file contains 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
class Hotel(object): | |
def __init__(self, name, ranking, price): | |
self.name = name | |
self.ranking = ranking | |
self.price = price | |
def show_price(self, date): | |
if date is Saturday or date is Sunday: | |
self.price = self.price * 0.2 | |
This file contains 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
base_url = 'http://gendou.com/' | |
username = '********' # derp dy | |
password = '********' # herp | |
def login(): | |
cj = cookielib.CookieJar() | |
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) | |
urllib2.install_opener(opener) | |
login_data = urllib.urlencode({'name':username, 'pass':password}) | |
request = urllib2.Request(base_url+'/forum/login.php', login_data) |
This file contains 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
$ cat teste.py | |
#!/usr/bin/env python | |
import sys | |
for a in sys.argv: | |
print a |