Skip to content

Instantly share code, notes, and snippets.

@tilacog
tilacog / terminator-config
Last active September 7, 2015 16:49
save this file to ~/.config/terminator/config
[global_config]
title_hide_sizetext = True
title_transmit_bg_color = "#3686d9"
tab_position = bottom
[keybindings]
[profiles]
[[default]]
scrollbar_position = hidden
palette = "#2d2d2d:#f2777a:#99cc99:#ffcc66:#6699cc:#cc99cc:#66cccc:#d3d0c8:#747369:#f2777a:#99cc99:#ffcc66:#6699cc:#cc99cc:#66cccc:#f2f0ec"
background_image = None
@tilacog
tilacog / Lambda PS1
Last active September 7, 2015 16:50
\[\033[38;5;10m\]\u@\h:\[(B\]\[\033[38;5;6m\]\w\[(B\]\[\033[38;5;15m\]\n\[\]\[(B\]\[\033[38;5;190m\]λ\[(B\]\[(B\]\[\033[38;5;15m\] \[(B\]

General TTD Advice

  • If you can't test the code efficiently, refactor the code.
  • Don't hardcode URLs in views, templates and tests. (Use revert instead?)
  • Use named views and reverse URL resolution, instead.
  • Never refactor against failing UNIT tests.
  • Don't forget the REFACTOR on 'Red, Green, Refactor'.
  • Tests makes possible using the application state as a save-points for refactors. Once you get to them again, you'll know your refactoring is done.
  • Every single FT doesn't need to test every single part of your application, but use caution when de-duplicating your FTs. (FTs exist to catch unpredictable interactions between different parts of your application, after all)
  • Use loggers named after the module you're in. Follow the logging.getLogger(__filename__) pattern to get a logger that's unique to your module, but that inherits from a top-level configuration you control.
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
syntax on
set t_Co=256
colorscheme badwolf
map <F7> :tabp<CR>

Formações societárias

  • MEI

    • Não precisa de contador [source][1]
    • até 60k / ano
    • $49 / mês ($44 INSS + $5 ISS)
    • [Cartilha com Cuidados do MEI][6]
  • Microempresa (ME)

  • <= R$ 360 K / ano

@tilacog
tilacog / get_fields.py
Last active July 25, 2016 14:57
Parse DCTF CHM files
import re
import sys
import yaml
from bs4 import BeautifulSoup
field_types = {
'Branco(s)': None,
'Zero(s)': None,
'R$': 'decimal',
import rows
from collections import Counter
base_svg = '/path/to/drawing.svg'
base_name = 'Fulano de Tal e Coisa'
participants_table = rows.import_from_csv('/path/to/pyse-participantes.csv')
with open(base_svg) as f:
svg = f.read()
@tilacog
tilacog / relate_database_objects.py
Created November 28, 2016 10:24
Creates a digraph showing relations between views and functions in a PostgreSQL database.
import psycopg2
from itertools import chain, permutations
from graphviz import Digraph
DB_SETTINGS = dict(
host='localhost',
database='database_name',
user='user',
password='*****',
import zipfile
from io import BytesIO
def zipwalk(current_file, curr_path=''):
"""Recursively walks into a zipped file tree while yielding non-zipped
files content.
"""
data = BytesIO(current_file.read())
#!/usr/bin/env python
import json
import sys
def pprint_specfile(path, filters):
record_fmt = '{r[name]}: {r[label]}'
field_fmt = ' {f[order]}-{f[name]}'