Skip to content

Instantly share code, notes, and snippets.

View ricleal's full-sized avatar
☢️
Coding the World a Better Place

Ricardo Ferraz Leal ricleal

☢️
Coding the World a Better Place
View GitHub Profile
@ricleal
ricleal / test_proxy.py
Last active July 1, 2018 20:12
UGLY HTTP connection with Auto Proxy & proxy.pac detection on Linux, OSx or Windows
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
from pprint import pprint
import sys
import re
@ricleal
ricleal / vietnam_prob.py
Last active September 12, 2015 15:38
vietnam_prob
import numpy as np
res = 66
def eq(x):
return x[0] + 13 * x[1] / x[2] + x[3] + 12 * x[4] - x[5] - 11 + x[6] * x[7] / x[8] - 10
# Brute force!
it = 0
while True:
@ricleal
ricleal / rvo.cpp
Created December 3, 2013 16:15
RVO: Return value optimization and NRVO: Named return value optimization
/**
* RVO: Return value optimization and NRVO: Named return value optimization
*
* Trying to get the last line of this to work...
*
* Still creates a new object when I assign m14 = fChangeClassRetRef(m14); :(
*
* I guess this is a problem with the compiler itself.
*
*/
@ricleal
ricleal / database.py
Created October 31, 2013 10:44
Generic mongodb class written in pymongo. It depends from a log and a configparser. Those dependencies are simple to delete.
from pymongo import MongoClient
import logging
logger = logging.getLogger(__name__)
from config.config import configParser
class Database(object):
'''
Generic class to access MongoDB.