Skip to content

Instantly share code, notes, and snippets.

View joaodubas's full-sized avatar
🤓
always learning

Joao P Dubas joaodubas

🤓
always learning
View GitHub Profile
@joaodubas
joaodubas / arangodb
Created October 25, 2013 20:00
docker sample
# arangodb
#
# VERSION: 0.0.1
FROM joaodubas/common
MAINTAINER Joao Paulo Dubas "[email protected]"
# Get needed packages
ADD http://www.arangodb.org/repositories/stable/xUbuntu_12.10/Release.key /Release.key
RUN echo "deb http://www.arangodb.org/repositories/stable/xUbuntu_12.10/ /" >> /etc/apt/sources.list.d/arangodb.list
RUN apt-key add - < /Release.key
@joaodubas
joaodubas / install.sh
Last active December 20, 2015 23:48
install postgres from source in #!
# assumindo que o usuario ja tem o codigo fonte do postgres
export SRCDIR=$HOME/local/src
# estes cabecalhos estao definidos por conta do configure
apt-get install libreadline-dev
apt-get install libxml2-dev
apt-get install libxslt1-dev
apt-get install libperl-dev
# configure make
@joaodubas
joaodubas / diagnose.css
Last active December 19, 2015 15:48
Take the idea from http://diagnosticss.github.io/ and add a warning message when hovering the element, so it became easier to understand what is the error.
/* inline styles */
[style] {
outline: 5px solid red;
}
[style]:hover::after {
content: "Inline style";
}
/* links */
a:not([href]), a[href=""] {
@joaodubas
joaodubas / index.js
Last active December 19, 2015 11:59
Querying an array property in a collection with tingodb.
var fs = require('fs');
var path = require('path');
var engine = require('tingodb')({});
var dbPath = path.join(__dirname, 'db');
if (!fs.existsSync(dbPath)) {
fs.mkdirSync(dbPath);
}
tbl = {
{
name='Very severely underweight',
upper=15
},
{
name='Severely underweight',
lower=15,
upper=16
},
@joaodubas
joaodubas / .local_profile.sh
Last active December 12, 2015 10:19
Add node_modules to PATH environment variable.
# environment variables
bindir=$HOME/local/bin
if [[ ":$PATH:" != *":$bindir:"* ]]; then
PATH=$bindir:$PATH
export PATH
fi
# local development
export PROJECTS=$HOME/public
@joaodubas
joaodubas / .local_profile.sh
Created February 11, 2013 23:29
Extension to `.bash_rc`
# environment variables
bindir=$HOME/local/bin
if [[ ":$PATH:" != *":$bindir:"* ]]; then
PATH=$bindir:$PATH
export PATH
fi
# local development
export PROJECTS=$HOME/public
@joaodubas
joaodubas / LICENSE.txt
Last active December 10, 2015 23:08
# Desafio Se você pensar em um papel como um plano e uma letra como uma marcação neste plano, então estas letras dividem o plano em regiões. Por exemplo, as letras A, D e O dividem o plano em 2 pois possuem um espaço confinado em seu desenho, ou um “buraco”. Outras letras como B possuem 2 buracos e letras como C e E não possuem buracos. Portanto…
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 João Paulo Dubas <[email protected]>
@joaodubas
joaodubas / tmux.md
Created October 19, 2012 10:40 — forked from avelino/tmux.md
tmux cheat sheet

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)

@joaodubas
joaodubas / datamigration.py
Created March 30, 2012 21:57
Example of data migration for add/remove multi-table inheritance
class Migration(DataMigration):
def forwards(self, orm):
"""Based on solution:
http://stackoverflow.com/questions/4064808/django-model-inheritance-create-sub-instance-of-existing-instance-downcast
"""
parent_articles = orm['app.Parent'].objects.all()
for article in parent_articles:
children_article = orm['app.Children(parent_ptr=article)
children_article.__dict__.update(article.__dict__)
children_article.save()