Skip to content

Instantly share code, notes, and snippets.

View fjorgemota's full-sized avatar
🎯
Focusing

Fernando Jorge Mota fjorgemota

🎯
Focusing
View GitHub Profile
@fjorgemota
fjorgemota / patinhos.py
Created March 2, 2012 02:28
Patinhos em Python (código completamente inútil, mas ok)
# -*- coding: cp1252 -*-
import time
ns = range(1,6)
ns.reverse()
for n in ns:
print "%d patinho%s foram passear"%(n,["","s"][n!=1])
print "além das montanhas para brincar"
print "a mamãe gritou"
for x in range(1,5):
print "quá!"
@fjorgemota
fjorgemota / gist:1609192
Created January 13, 2012 22:48
Benchmarking of my WebServer with the HTTP/1.1 specifications and timeout running in Ubuntu with Python 2.7 and epoll
fernando@ubuntu:/etc$ ab -n 10000 -c 25 http://127.0.0.1/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@fjorgemota
fjorgemota / gist:1519616
Created December 25, 2011 19:02
Benchmarking of my WebServer - Updated with the HTTP/1.1 Specifications
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
@fjorgemota
fjorgemota / gist:1469666
Created December 12, 2011 23:35
Apaga todos os arquivos com "conflicted" no nome. Que o Dropbox costuma gerar quando há dois usuários editando o mesmo arquivo
import os, os.path
def ren(path):
files = os.listdir(path)
for f in files:
if f in (".",".."):
continue
f = os.path.join(path,f)
if os.path.isdir(f):
ren(f)
else:
@fjorgemota
fjorgemota / gist:1358191
Created November 11, 2011 15:00
Apache Bench 2M requests (Benchmarking of my server)
My Server:
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
@fjorgemota
fjorgemota / SplitIterator.py
Created October 1, 2011 17:57
Iterator Python que permite dar split em uma String progressivamente conforme o decorrer de um Loop
def SplitIterator(s,separator):
s = list(s)
c = 0
l = len(separator)
separator = list(separator)
last_token = []
while s[c:]:
if s[c:c+l] == separator:
a = "".join(last_token)
last_token = []