Skip to content

Instantly share code, notes, and snippets.

View rochacbruno's full-sized avatar
🛠️
Working on Galaxy_ng and Dynaconf

Bruno Cesar Rocha rochacbruno

🛠️
Working on Galaxy_ng and Dynaconf
View GitHub Profile
var alvo = document.getElementById("id_origem"),
data = new Date();
var addTime = function(){
data.setSeconds(data.getSeconds() + 1);
alvo.value = data.getHours() + ":" + data.getMinutes() + ":" + data.getSeconds();
};
setInterval(addTime, 1000);
#!/usr/bin/env python2
# coding: utf-8
import os,socket,threading,time
#import traceback
allow_delete = False
local_ip = socket.gethostbyname(socket.gethostname())
local_port = 8888
currdir=os.path.abspath('.')
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)
@rochacbruno
rochacbruno / tmux.md
Created October 10, 2013 21:04 — forked from avelino/tmux.md

tmux - terminal multiplexer

Managing tmux sessions:

$ tmux      # start tmux server
$ tmux at   # attach running sessions to a terminal
$ tmux ls   # list running tmux sessions

Sharing sessions between terminals:

$ tmux new -s session_name # make new named session

$ tmux at -t session_name # attach to exist session (allowing shared sessions)

# -*- coding: utf-8 -*-
"""
Inspiration taken from Flask-Exceptiopn
:copyright: (c) 2012 by Jonathan Zempel.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
from flask import _request_ctx_stack as stack, redirect
class switch(object):
def __init__(self, expr):
self.expr = expr
self.cases = {}
self._default = None
def __call__(self, expr):
@rochacbruno
rochacbruno / README
Created November 27, 2013 13:32 — forked from mrjoes/README
Requirements: Postgresql, Flask-Admin, Flask-Sqlalchemy
How to run it:
createdb inline_bug
psql inline_bug -af schema.sql
python app.py
Go to /admin and try to edit the servers. One will work, one will not.

Emacs configuration for Python development. Simply drop this file inside your $HOME/.emacs.d directory and enjoy it!

Requirements

Before you start Emacs for the first time, you will want to:

  • Make sure to install the following python libraries
class Bicho():
def __init__(self, nome, som):
self.nome = nome
self.som = som
self.sexo = 'a' if nome[-1] == 'a' else 'o'
pintinho = Bicho('Pintinho', 'Piu')
bichos = [Bicho('Galinha', 'có!'), Bicho('Galo', 'cocó!'),
Bicho('Peru', 'glu glu!'), Bicho('Gato', 'miau!'),
from flask import Blueprint
from urls import url_rules
bp = Blueprint(__name__.split('.')[1], __name__, template_folder='templates')
for url_rule in url_rules:
url_regex, view_func = url_rule
bp.add_url_rule(url_regex, view_func=view_func, methods=['GET', 'POST'])