I hereby claim:
- I am gleicon on github.
- I am gleicon (https://keybase.io/gleicon) on keybase.
- I have a public key whose fingerprint is C6CC 3FB6 16AE 0EFA 74E1 D749 E45A 2482 12B7 5B5B
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Helper class for statistics | |
# see: http://www.johndcook.com/blog/standard_deviation/ | |
class Stats: | |
""" Uses Welford's method to calculate stats. | |
Assumes positive values. | |
It's not thread safe | |
stats = Stats("ConnectionTimeStats") | |
stats.add(0.223) | |
stats.add(1.343) |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"strings" | |
"github.com/dgryski/go-simstore/simhash" | |
) |
O objetivo aqui é pegar uma entrada composta por um csv com: produto, sessão. E considerando que a ação X foi aplicada a ele criar um cara que pega as relações por sessão.
Exemplo de entrada:
1231312124,cb808cb9-3bfd-4c0c-ad20-2e181b9b3a93
1231212124,cb808cb9-3bfd-4c0c-ad20-2e181b9b3a93
1231112124,cb808cb9-3bfd-4c0c-ad20-2e181b9b3a93
1231762124,cb808cb9-3bfd-4c0c-ad20-2e181b9b3a93
# This routine needs the color_histogram method | |
# from either ImageMagick 6.0.0 or GraphicsMagick 1.1 | |
# Specify an image filename as an argument. | |
require 'RMagick' | |
class PixelColumn < Array | |
def initialize(size) | |
super | |
fill {Magick::Pixel.new} |
# Protection from SYN flood attack. | |
net.ipv4.tcp_syncookies = 1 | |
# Martians? Don't care. | |
net.ipv4.conf.all.log_martians = 0 | |
# Discourage Linux from swapping idle server processes to disk (default = 60) | |
vm.swappiness = 10 | |
vm.dirty_ratio = 60 | |
vm.dirty_background_ratio = 2 |
import sys | |
import time | |
def tail(tfile): | |
with open(tfile, 'r') as fp: | |
while True: | |
ll = fp.readline() | |
if ll: | |
print ll | |
else: |
package main | |
import "fmt" | |
// this is the intro to tutorial challenges from hackerrang in Go. | |
func findArrElement(arr []uint64, arrLen, value int) int { | |
for i:=0; i < arrLen; i++ { | |
if arr[i] == uint64(value) { | |
return i | |
} | |
} |
from tornado import auth, httpclient, httputil, escape | |
import urllib | |
import functools | |
class LinkedInMixin(auth.OAuth2Mixin): | |
""" | |
LinkedIn authentication using OAuth2. | |
Example usage:: | |
import requests | |
import smtplib | |
user = "yourusername" | |
password = "yourpass" | |
fromaddr = "user@gmail.com" | |
toaddr = "sysadmin@gmail.com" | |
smtpserver = "smtp.server" | |
port = 587 |