Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tupy's full-sized avatar

Osvaldo Matos-Junior tupy

View GitHub Profile
@tupy
tupy / baba.py
Last active April 10, 2017 22:18
# -*- coding: utf-8 -*-
import random
TEAMS = 3
PLAYERS_BY_TEAM = 6
groups = {
'star': ['Bako', 'JP', 'Vitot', 'Bruno'],
'ataque': ['Genê', 'André', 'Lucas Carvalho', 'Ladeia'],
'zaga': ['Rabello', 'Tupy', 'Marcinho', 'Pezão', 'Gustavo'],
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@tupy
tupy / base.html
Last active August 29, 2015 13:59
Minicurso Python na Copa - Python Day Feira de Santana
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{url_for('static', filename='css/bolao.css')}}" rel="stylesheet" />
{% block css %}{% endblock %}
{% block js %}{% endblock %}
</head>
# Description:
# Executes a taskDeploy command for spinning up task instances
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_DEPLOY_SCRIPT_LOCATION
# HUBOT_DEPLOY_USER
# HUBOT_DEPLOY_KEY
@tupy
tupy / chef.coffee
Created December 12, 2013 19:25
HuBot Chef script
# Allows hubot to run commands using chef.
#
# list nodes - Lists all nodes on Opscode
# uptime <server> - Prints uptime
# configure <server> - Runs chef client on node
module.exports = (robot) ->
robot.respond /list nodes$/i, (msg) ->
spawn = require('child_process').spawn
global
log 127.0.0.1 local0 notice
maxconn 50000
daemon
stats socket /tmp/proxystats level admin
defaults
log global
mode http
option httplog
option dontlognull
# imgs don't need to be gzipped
s3cmd put -c config/.s3cfg-prod-static --acl-public --guess-mime-type --add-header "Cache-Control:public, max-age=31536000" -r static/img s3://my-bucket-name/
# js/css does need gzipping
rm -rf static/built-gz;
cp -a static/built/ static/built-gz/;
find static/built-gz -type f | while read -r x; do gzip -9 -c "$x" > "$x.gz"; mv "$x.gz" "$x"; done;
s3cmd put -c config/.s3cfg-prod-static --acl-public --guess-mime-type --add-header "Cache-Control:public, max-age=31536000" --add-header "Content-Encoding: gzip" -r static/built-gz/ s3://my-bucket-name/built/
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@tupy
tupy / testing.py
Last active December 15, 2015 10:39
import flask
app = flask.Flask(__name__)
app.config['SERVER_NAME'] = 'localhost'
@app.route('/')
def index(): return "Index!"
if __name__ == '__main__':
app.run()