Skip to content

Instantly share code, notes, and snippets.

@brunoliveira8
brunoliveira8 / app.py
Created June 22, 2020 11:00
Event Sourcing Concepts
import json
class EventStore:
base_location = 'events'
storage_format = 'jsonl'
@classmethod
def _get_event_storage_path(cls, key):
class Command:
pass
class CommandHandler:
pass
class Action(ABC):
def __init__(self)
@brunoliveira8
brunoliveira8 / default.conf
Last active January 10, 2018 13:45
Running Angular app and backend in the same server
server {
listen 80;
charset utf-8;
client_max_body_size 100m;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
def __str__(self):
return '%s %s' % (self.first_name, self.last_name
@brunoliveira8
brunoliveira8 / docker-compose.yml
Created September 13, 2017 21:29
Docker Compose example of nginx as reverse proxy.
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
@brunoliveira8
brunoliveira8 / Anaconda.sublime-settings - User
Last active March 25, 2017 15:22
Gist com snippets de código para configuração do ST3.
{
/*
If 'outline' (default), anaconda will outline error lines.
If 'fill', anaconda will fill the lines.
If 'solid_underline', anaconda will draw a solid underline below regions.
If 'stippled_underline', anaconda will draw a stippled underline below regions.
If 'squiggly_underline', anaconda will draw a squiggly underline below regions.
If 'none', anaconda will not draw anything on error lines.
*/
"anaconda_linter_mark_style": "none",
from django.db import models
from django.contrib.auth.models import User
from registration.signals import user_registered
# Create your models here.
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
anything = models.CharField(max_length=2, default='A')
def __unicode__(self):
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 17:00:09 2015
@author: bruno
"""
"""
Bar chart demo with pairs of bars grouped for easy comparison.
"""
@brunoliveira8
brunoliveira8 / internetOfThings.py
Created August 30, 2015 19:14
Aciona um dispositivo serial através de uma página web.
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 28 19:41:13 2014
@author: Bruno
"""
from flask import Flask
import serial
app = Flask(__name__)
@brunoliveira8
brunoliveira8 / aula1.py
Created August 14, 2015 21:38
Introdução à Sinais com SciPy
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 14:55:33 2015
@author: bruno
"""
import numpy as np
from pylab import *