Skip to content

Instantly share code, notes, and snippets.

View fchevitarese's full-sized avatar

Frederico Rodrigues Chevitarese fchevitarese

  • Vila Velha
  • 15:00 (UTC -03:00)
View GitHub Profile
import pandas as pd
df2 = pd.DataFrame(
{u"Paises":
[u"Áustria", u"Bélgica", "Dinamarca", "Finlandia", u"França", "Alemanha", u"Grécia", "Irlanda", u"Itália", "Holanda", "Portugal", "Espanha", u"Suécia"],
u"Carvão": [3.6, 3.2, 3.6, 3.2, 3.2, 3.2, 3.5, 3.2, 3.6, 3.2, 3.6, 3.6, 3.2],
"CCGas": [3.4, 2.8, 2.9, 2.6, 3.2, 3.5, 3.5, 3.2, 3.4, 2.6, 3.4, 3.5, 3.3],
"Bioenergia": [3.6, 3.7, 3.9, 3.9, 4.0, 4.3, 4.0, 4.5, 4.0, 4.0, 4.3, 4.3, 3.4]})
df2 = df2.set_index(['Paises'])
@fchevitarese
fchevitarese / reporter.py
Created November 5, 2015 16:35
media.py
# coding=utf-8
import numpy
from dry.helpers import humanize_time
from user.models import User
from form.models import Form
from ..models import Harvest
@fchevitarese
fchevitarese / untitled
Created November 4, 2015 21:24
restrict.py
mydict = {}
mydict[59] = 150
for restrict in Restrict.objects.filter(question_parent=form.id):
new_restrict = Restrict()
new_restrict.question = mydict[restrict.id]
new_restrict.....
new_restrict.save()
@fchevitarese
fchevitarese / untitled
Created November 4, 2015 13:42
classe.py
from xml.etree import ElementTree as ET
import requests
import json
import xmltodict
class buscaCliente(object):
def __init__(self, serv_id, codigo, descricao):
self.serv_id=serv_id
@fchevitarese
fchevitarese / untitled
Created October 29, 2015 18:40
permissions.cnf
drwxr-xr-x 8 prod prod 4096 Oct 29 16:19 ./
drwxr-xr-x 8 prod prod 4096 Oct 28 18:11 ../
drwxr-xr-x 2 prod prod 4096 Oct 28 18:10 branches/
-rw-r--r-- 1 prod prod 306 Oct 28 18:11 config
-rw-r--r-- 1 prod prod 73 Oct 28 18:10 description
-rw-r--r-- 1 root root 112 Oct 29 13:03 FETCH_HEAD
-rw-r--r-- 1 prod prod 28 Oct 28 18:11 HEAD
drwxr-xr-x 2 prod prod 4096 Oct 28 18:10 hooks/
-rw-r--r-- 1 root root 357088 Oct 29 15:59 index
drwxr-xr-x 2 prod prod 4096 Oct 28 18:10 info/
@fchevitarese
fchevitarese / untitled
Created October 27, 2015 12:37
tryboleto.py
for i in range(0, len(listaDadosCaixa), 2):
try:
boleto.drawBoletoCarneDuplo(
listaDadosCaixa[i],
listaDadosCaixa[i + 1]
)
boleto.nextPage()
except IndexError:
boleto.drawBoletoCarneDuplo(
listaDadosCaixa[i]
for i in range(0, len(listaDadosCaixa), 2):
try:
boleto.drawBoletoCarneDuplo(
listaDadosCaixa[i],
listaDadosCaixa[i + 1]
)
boleto.nextPage()
except IndexError:
boleto.drawBoletoCarneDuplo(
listaDadosCaixa[i]
@fchevitarese
fchevitarese / untitled
Created October 19, 2015 17:13
teste.js
if (retornar == 2) {
if ((now.format("YYYY-MM-DD") == r_agendado.format("YYYY-MM-DD"))) {
console.log('1')
console.log(now.format("YYYY-MM-DD"), r_agendado.format("YYYY-MM-DD"))
retornar = r_agendado.format("DD/MM hh:mm")
editar = "<div class='btn-group'><buttonvalue="+pk+" id='bnt_editar_chamado"+pk+"' type='button' class='btn btn-info'><i class='fa fa-stack-exchange'></i></button></div>"
}
@fchevitarese
fchevitarese / gunicorn-fred
Created October 15, 2015 16:35
gunicorn-fred
#!/bin/bash
cd /home/fred/projetos/python/datagoal-2.0.0/datagoal/
NEW_RELIC_CONFIG_FILE=newrelic.ini /home/fred/.virtualenvs/datagoal/bin/newrelic-admin run-program /home/fred/.virtualenvs/datagoal/bin/gunicorn -c /home/fred/projetos/python/datagoal-2.0.0/deploy/gunicorn-fred.conf.py datagoal.wsgi:application
@fchevitarese
fchevitarese / ipclean.py
Created October 14, 2015 13:01
ipclean.py
import itertools
import re
iplist = []
with open('level3.db.new') as myfile:
for line in myfile.readlines():
if line.startswith('member'):
iplist.append(re.findall(r'[0-9]+(?:\.[0-9]+){3}(?:\/[0-9]+)', line))