Skip to content

Instantly share code, notes, and snippets.

View thiago's full-sized avatar

Thiago Rodrigues thiago

View GitHub Profile
@thiago
thiago / drop_all_tables_mysql.sql
Created February 3, 2017 02:02
Drop all tables on mysql
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
@thiago
thiago / README.md
Last active August 29, 2015 14:19 — forked from prologic/docker-compose.yml
A mini Docker based PaaS

Quick Start:

  • Set up a wildcard A record entry in your domain name's zone file.

Usage:

docker run -d -e VIRTUALHOST=myapp.mydomain.com user/myapp
@thiago
thiago / Vagrantfile
Created February 24, 2015 00:45
Vagrant providers from YAML config
VAGRANTFILE_API_VERSION = "2"
CURRENT_DIR = File.dirname(File.expand_path(__FILE__))
CONFIG_FILE = "#{CURRENT_DIR}/config.yml"
CONFIG_FILE_LOCAL = "#{CURRENT_DIR}/config_local.yml"
if File.exist?(CONFIG_FILE)
require 'yaml'
data = YAML.load_file(CONFIG_FILE)
if File.exist?(CONFIG_FILE_LOCAL)
class Hash
@thiago
thiago / Dockerfile
Last active August 29, 2015 14:13
Tsuru platform chronos
FROM ubuntu:14.04
RUN echo "deb http://repos.mesosphere.io/ubuntu/ trusty main" > /etc/apt/sources.list.d/mesosphere.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF && \
apt-get update && \
apt-get install -y maven \
node \
npm \
default-jdk \
mesos \
@thiago
thiago / Dockerfile
Last active August 29, 2015 14:13
A tsuru platform to apache zookeeper
# DOCKER-VERSION 1.0.1
# VERSION 0.5
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y openjdk-7-jre-headless wget
RUN wget -q -O - http://apache.mirrors.pair.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz | tar -xzf - -C /opt \
&& mv /opt/zookeeper-3.4.6 /opt/zookeeper \
&& cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg

Steps to install PIL

$ sudo apt-get install python-imaging
$ sudo apt-get install libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev

$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/

$ pip install PIL

@thiago
thiago / remgit.sh
Created March 28, 2014 03:35 — forked from ckalima/remgit.sh
# remgit.sh
# Creates a remote git repository from the current local directory
# Configuration
# Replace SSH_USERNAME, SSH_HOST, SSH_GIT_PATH with your details
USER=SSH_USERNAME
HOST=SSH_HOST
GIT_PATH=SSH_GIT_PATH
REPO=${PWD##*/}
@thiago
thiago / Vagrantfile
Created March 6, 2014 17:00
Configuração Ubuntu via Vagrant. Python, MySQL, Git, sqlite3, Pip, NodeJS
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.define :djangovm do |django_config|
# Every Vagrant virtual environment requires a box to build off of.
django_config.vm.box = "lucid64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@thiago
thiago / noConflict.js
Last active August 29, 2015 13:56
TRSweb examples
(function () {
var root = this;
// Nome que será declarado no DOM
var appName = 'App';
// Guardar o valor anterior da variável `App`, de modo que ele pode ser
// restaurado mais tarde, se `noConflict` for chamado.
var appPrevious = root[appName];
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS