Skip to content

Instantly share code, notes, and snippets.

View gtsalles's full-sized avatar

Gustavo Carvalho gtsalles

View GitHub Profile
import random
notas = ['C', 'D', 'E', 'F', 'G', 'A', 'B']
while True:
nota = random.randint(0, len(notas) - 1)
if nota == (len(notas) - 1):
nota = 0
@dimiro1
dimiro1 / dosblocker.py
Last active January 1, 2016 10:48
Este script ajuda a proteger seus servidores de ataques DOS. Uso netstat para descobrir a quantidade de conexões que determinado IP tem aberto, e uso o iptables como firewall. O script deve rodar como ROOT, já que precisa adicionar regras no firewall. USO: Rode o script com o supervisor, upstart ou systemd, ele tem várias opções de configuração …
#!/usr/bin/env python
# Copyright (C) 2013 by Claudemiro Alves Feitosa Neto
# <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@marcelcaraciolo
marcelcaraciolo / excel_read.py
Created January 31, 2014 01:00
Read excel file and return all the rows as dict fields. ;)
import xlrd
def getDataFromFile(fileName):
with xlrd.open_workbook(fileName) as wb:
# we are using the first sheet here
worksheet = wb.sheet_by_index(0)
# getting number or rows and setting current row as 0 -e.g first
num_rows, curr_row = worksheet.nrows - 1, 0
# retrieving keys values(first row values)