Skip to content

Instantly share code, notes, and snippets.

View fforbeck's full-sized avatar

Felipe Forbeck fforbeck

View GitHub Profile
def conv(x):
i = ord(x)
if i < 121:
return chr(i + 2)
elif i == 121:
return chr(ord('a'))
elif i == 122:
return chr(ord('b'))
alfabeto = list(x for x in 'abcdefghijklmnopqrstuvwxyz')
file_characters = open("pc_02.txt", "rt")
characters = file_characters.read()
file_characters.close()
occurrences = {}
for l in characters:
occurrences[l] = str.count(characters, l)
for k, v in occurrences.items():
if v == 1:
import re
import itertools
especial_letters = set()
in_file = open('pc_03.txt', "rt")
while True:
line = in_file.readline()
if not line:
break
import urllib2, re, sys
uri = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='
nothing = '12345'
def get_next(nothing):
request = request = urllib2.Request(uri + nothing)
result = str(urllib2.urlopen(request).read())
if 'html' in result:
print("secret word :D -----> " + result)
@fforbeck
fforbeck / gist:2949393
Created June 18, 2012 16:56
config para subir o chrome com selenium
public WebDriver chrome() {
try {
//MAC - Deve instalar o servidor web driver antes http://code.google.com/p/chromedriver/downloads/list
//System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
//LINUX - Deve instalar o servidor web driver antes http://code.google.com/p/chromedriver/downloads/list
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
final DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
@fforbeck
fforbeck / pair with screen
Created June 21, 2012 19:54
how to - pair programming with shared screen
João -
1) ssh para maquina aonde ocorrerá o pareamento
$ ssh user@<ip>
2) nome para a sessão:
$ screen -S <nome_da_sessao>
3) ativar multiuser:
$ Ctrl-a :multiuser on
function criarCampoEvaluated() {
var cursor = db.website_performance.find({evaluated: {$exists: false}});
while (cursor.hasNext()) {
var doc = cursor.next();
if (doc) {
db.website_performance.update(doc, {$set: {evaluated: false}});
printjson( doc );
}
}
}
public static void main(String[] args) {
try {
CsvReader products = new CsvReader("products.csv");
products.readHeaders();
while (products.readRecord())
{
String productID = products.get("ProductID");
function resumeDomainsFromCampaign(campaign) {
var cursorAds = db.rtb_bid_reference.find({campaign_id: campaign}, {id: 1});
var rtbBidRefDomainColl = db.rtb_bid_reference_domain;
while (cursorAds.hasNext()) {
var adId = cursorAds.next();
if (adId != null) {
FI ∑gen= P * Q
Se FP <= CM
FP = ((CM – FP) + 1)
Senão
FP = (FP – CM)
FP =( (FP * ( 1.5 + ( FP * 0.05) ) ) +1)