Skip to content

Instantly share code, notes, and snippets.

@souzaux
souzaux / Erro-compilando-traccar.log
Created September 20, 2016 17:56
Error - Building traccar 3.7-SNAPSHOT
mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building traccar 3.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ traccar ---
[INFO] Deleting /Users/guilherme/Dropbox/Geodecom/traccar-tbox-drecchia/target
[INFO]
@souzaux
souzaux / client part
Created September 2, 2016 22:05 — forked from 123Daoxyz/client part
udp server based on tornado
#!/usr/bin/env python
# encoding: utf-8
import time
import socket
from tornado.iostream import IOStream
from tornado.ioloop import IOLoop
from tornado import stack_context
import functools
import collections
@souzaux
souzaux / GIF-Screencast-OSX.md
Created August 26, 2016 18:21 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@souzaux
souzaux / webtail.py
Created August 19, 2016 02:33 — forked from maximebf/webtail.py
Web tail / tail -f as a webpage using websocket
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
@souzaux
souzaux / gist:941b568d61fceee1a4f88a37b9760c1e
Created August 19, 2016 02:32 — forked from maximebf/gist:3986583
Add dynamic subdomain support to a Flask app
def add_subdomain_to_global(endpoint, values):
g.subdomain = values.pop('subdomain', None)
def add_subdomain_to_url_params(endpoint, values):
if not 'subdomain' in values:
values['subdomain'] = g.subdomain
def add_subdomain_support(app):
app.url_value_preprocessor(add_subdomain_to_global)
app.url_defaults(add_subdomain_to_url_params)
@souzaux
souzaux / kas.py
Created July 21, 2016 20:07 — forked from widoyo/kas.py
Generating PDF using Flask & ReportLab
from flask import make_response
from reportlab.pdfgen import canvas
# ...
@app.route('/pdf')
def pdf():
import cStringIO
output = cStringIO.StringIO()
@souzaux
souzaux / flask-tenant-subdomain.py
Created July 18, 2016 20:33
Create a Flask application using the app factory pattern.
#app.py
def create_app(settings_override=None):
"""
Create a Flask application using the app factory pattern.
:param settings_override: Override settings
:return: Flask app
"""
app = Flask(__name__, instance_relative_config=True, static_folder=None)
#flask-tenant-schema:
@souzaux
souzaux / exemple_models.py
Last active March 9, 2016 20:52
Um exemplo de models.py com Relationships many to many
### Example: https://gist.github.com/souzaux/c652508e0ae05adaf7cb/edit
from catwatch.blueprints.user.models import User
from catwatch.blueprints.device.models import Device
user_device = db.Table('user_device',
db.Column('user_id', db.Integer, db.ForeignKey('users.user_id')),
db.Column('device_id', db.Integer, db.ForeignKey('devices.device_id'))
)