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 / 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 = []
@fjorgemota
fjorgemota / removedor-acentos.cpp
Created November 27, 2014 02:41
Removedor simples de acento em C
#include <stdio.h>
#include <stdlib.h>
char* removeAcento(char *string){
int i=0;
int resultado = 0;
while(string[i] != '\0'){
if(!((string[i] < 97 || string[i] > 122) && (string[i] < 65 || string[i] > 90))) {
resultado++;
}
@fjorgemota
fjorgemota / hello.cpp
Last active August 29, 2015 14:05
Mini-Servidor em C++
#include <cstdlib>
#include <iostream>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
using namespace std;
int main(int argc, char **argv) {