Skip to content

Instantly share code, notes, and snippets.

data <- read.csv2('d_sabesp.csv', colClasses=c('character', 'character', 'character', rep('numeric', 4)))
data$data = as.Date(strptime(data$data, '%Y-%m-%d'))
plot(data$data, data$media_historica_do_mes)

Keybase proof

I hereby claim:

  • I am jaysonsantos on github.
  • I am jaysonsantos (https://keybase.io/jaysonsantos) on keybase.
  • I have a public key whose fingerprint is CCA0 2976 DD0B DE62 3BDE 1689 32CA A472 083D 88E2

To claim this, I am signing this object:

@jaysonsantos
jaysonsantos / verify.sh
Created March 21, 2015 18:40
List only outdated pip packages that exists in local requirements
#!/bin/bash
pip list -o|while read i; do
pkg_name="$(echo $i | awk '{print $1}')"
grep -rin "$pkg_name" requirements/ &> /dev/null
if [ "$?" -eq "0" ]; then
echo $i
fi
done
@jaysonsantos
jaysonsantos / thread_dumps.py
Last active September 17, 2015 12:38
Mimic java and dump all threads stacktrace when CRTL + \ is pressed
import functools
import signal
import sys
import time
import traceback
import threading
lock = threading.Lock()
@jaysonsantos
jaysonsantos / quiz.py
Created August 10, 2011 14:23
Google developer quiz solver
# Google tricked us a bit, some logic is different, just check it
import sys
WORDS_A = open(sys.argv[1]).read().strip('\n').split(' ')
WORDS_B = open(sys.argv[2]).read().strip('\n').split(' ')
FOO_LETTERS = tuple('csmgj')
BLACKLIST = 'f'
ALPHABET_ORDER = tuple('cfjvqmhldtkrzwnbgxsp')
MAPPED_ORDER = tuple('0123456789abcdefghij')
@jaysonsantos
jaysonsantos / uwsgi.ini
Created October 31, 2011 13:39
uWSGI INI sample
[uwsgi]
touch-reload=/diretorio/projeto/tmp/restart.txt # Usado para que o uWSGI recarrege o seu fonte com um simples touch restart.txt
listen=1024 # Número de itens em fila de espera
disable-logging=true # Deixa de logar requisições, fará log apenas de erros.
socket=/diretorio/que/voce/quiser.sock # Caminho do socket que o uWSGI ouvirá/escreverá.
master=true # Ativa o processo master para controlar os rebeldes.
harakiri=60 # Modo suicida que matará a app após x segundos em execução.
processes=4 # Número de workers.
buffer-size=25000 # Buffer mais alto porque muitas vezes alguns browsers mandam headers gigantes.
daemonize=/diretorio/que/voce/quiser.log # Joga o processo para background e escreve o log no arquivo determinado.
#!/bin/bash
sudo memcached stop
memcached -S -d
memached -s/tmp/memached.sock -d
memached -p5000 -d
nosetests
exit $?
@jaysonsantos
jaysonsantos / mysql-ram.sh
Created July 10, 2012 20:26
MySQL in ram with ubuntu
#!/bin/bash
function quit {
echo "Umounting temp"
cd /
umount /media/tmp
}
trap quit SIGINT
@jaysonsantos
jaysonsantos / analyser.py
Last active October 8, 2015 16:41
Analyses a organization to find all python projects and it's requirements
import asyncio
import base64
import concurrent.futures
from functools import partial
import os
import pip
import re
import requests
@jaysonsantos
jaysonsantos / lazy.sh
Created May 17, 2013 13:25
Create a git flow hotfix with last tag + 1.
alias gh="git fetch; git checkout master; git merge origin/master; git checkout develop; git merge origin/develop; git flow hotfix start \$(git tag|sort -V|grep '^[0-9]'|tail -n 1|awk 'BEGIN { FS = \".\" } ; { print \$1\".\"\$2\".\"\$3+1 }')"