Skip to content

Instantly share code, notes, and snippets.

View chronossc's full-sized avatar

Felipe Prenholato chronossc

View GitHub Profile
@chronossc
chronossc / filter_and_assign_tag.py
Created August 23, 2011 13:22
A Django Tag that can do filter and exclude from a queryset, assigning to another context variable.
class FilterAndAssignNode(template.Node):
def __init__(self,parser=None,to=None,query=None,filter=None,exclude=None):
self.parser = parser
self.to = to
self.query = query
self.filter = filter or []
self.exclude = exclude or []
@chronossc
chronossc / Readme.md
Last active December 29, 2020 14:20
List with all cities of Brazil

Dado um csv com todos os municipios do Brasil, escolha 25 randomicamente, que não tenham menos de 6 caracteres e mais de 10 caracteres no nome da cidade. Adicione os seguintes municipios aos 25 escolhidos:

  • São Carlos (SP)
  • São Carlos (SC)

Não se deve repetir cidades/estados.

Para cada um dos 27 descubra a latitude e longitude deles. O OpenStreetMaps tem uma api para isso.

Imprima as informações na tela e também salve uma planilha (XLS) com as seguintes colunas: nome do estado, município, latitude, longitude.

@chronossc
chronossc / pre-commit
Created January 6, 2015 12:34
Basic pre-commit hook for avoid commit code with pdb/ipdb
#!/bin/bash
# based on http://www.snip2code.com/Snippet/165926/Check-for-ipdb-breakpoints-git-hook
pdb_check=$(git grep -E -n '[ ;]i?pdb')
if [ ${#pdb_check} -gt 0 ]
then
echo "COMMIT REJECTED: commit contains code with break points. Please remove before commiting."
echo $pdb_check
exit 1
else
@chronossc
chronossc / devpi-server-article.md
Created November 25, 2013 04:00
Article/how to about how install devpy-server (not finished yet)

dev-pi install howto

This guide follow instructions in the devpi quickstart server guide. We will install in own user home using virtualenvs, than, will setup a nginx instance. Server used here is Ubuntu Server 12.04 LTS in one virtualbox instance.

Create devpi user

root ~ # useradd -m -U -s /bin/bash devpi
root ~ # passwd devpi
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class MessageryConfig(AppConfig):
name = 'messagery'
label = 'messagery'
verbose_name = _("Messages and E-mails management")
@chronossc
chronossc / stochastic_and_rsi
Last active August 26, 2018 17:24 — forked from anonymous/stochastic_and_rsi
slightly improved version of indicator with Stochastic RSI and RSI with alerts from autemox for use in trading view.
// ver 1 alerts show significant stoch rsi crossovers as long as they arent in outermost bounds
// ver 2 fixed error with > to >= that caused some alerts to not appear
// ver 3 changed from symbols to columns to make it easier to set up real trading view alerts with it!
// BASED on https://www.tradingview.com/script/aUZVp1GC-Stochastic-RSI-with-Crossover-Alerts/
// Author: autemox
study(title="Stochastic RSI with Crossover Alerts", shorttitle="Stoch RSI with Crossover Alerts")
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
@chronossc
chronossc / gist:1acc5e10455f236484accae40e96471c
Last active February 26, 2018 05:25
Ema Crosses + Bollinger Bands
//@version=3
study(title="EMA Cross + BB", shorttitle=':', overlay=true)
// data = close >= open
// plotchar(data, char='↓', color=lime, text="Buy")
// plotchar(data, char='↑', location=location.belowbar, color=red, text="Sell")
// Bollinger Bands: Madrid : 14/SEP/2014 11:07 : 2.0
// This displays the traditional Bollinger Bands, the difference is
// that the 1st and 2nd StdDev are outlined with two colors and two
from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
# You can swap out the engine for MySQL easily by changing this value
# to ``django.db.backends.mysql`` or to PostgreSQL with
# ``django.db.backends.postgresql_psycopg2``
@chronossc
chronossc / csv_to_xls.py
Created August 31, 2017 18:54
CSV to XLS with Pandas
import unicodecsv
from pandas import DataFrame
def csv_to_xls(fname, delimiter=';'):
with open(fname, 'r') as f:
stream = StringIO(f.read())
reader = unicodecsv.reader(stream, delimiter=delimiter)
df = DataFrame(list(reader))
@chronossc
chronossc / PKGBUILD_FIXED
Created March 26, 2017 18:11
Diff to be applied to hid-apple-patched-git in AUR
# Maintainer: juantascon <juantascon.aur@horlux.org>
# Contributor: Ilya Kuzmin <i.g.kuzmin.spb@gmail.com>
pkgname=( #'hid-apple-patched-git'
'hid-apple-patched-git-dkms')
pkgver=20160803.feb734c
pkgrel=1
_pkgname=hid-apple-patched