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 / keybase.md
Created February 4, 2019 11:39
keybase.md

Keybase proof

I hereby claim:

  • I am joaodubas on github.
  • I am joaodubas (https://keybase.io/joaodubas) on keybase.
  • I have a public key ASDXDCqifB2ytkEIMwuRrZcsPBs4Wavd80BSiaWw0s1W0wo

To claim this, I am signing this object:

@joaodubas
joaodubas / readme.md
Last active August 29, 2015 14:13
remove docker unused volumes

docker volume cleanup

docker eats up disk space. to aid in this run the script with super user access:

sudo python remove.py

and it will remove all unused volumes directories under /var/lib/docker

@joaodubas
joaodubas / Dockerfile
Created July 25, 2014 19:32
docker image to install nsinit
# nsinit installer
#
# VERSION: see `TAG`
FROM ubuntu:14.04
MAINTAINER Joao Paulo Dubas "joao.dubas@gmail.com"
# install deps
RUN apt-get -y -qq --force-yes update \
&& apt-get -y -qq --force-yes install build-essential wget git
@joaodubas
joaodubas / install.sh
Created May 21, 2014 11:43
Install libxml2-python on ubuntu 14.04 by building libxml2 and libxslt1.1
#!/usr/bin/env python
# update system
apt-get -y -qq --force-yes update
# install needed system deps
apt-get -y -qq --force-yes install \
python-setuptools \
build-essential \
wget \
@joaodubas
joaodubas / install.sh
Created May 21, 2014 11:41
Install libxml2-python on ubuntu 14.04 by pinning libxml2/libxslt1.1 to precise
#!/usr/bin/env bash
# enable precise source
echo "deb http://archive.ubuntu.com/ubuntu precise main universe" \
>> /etc/apt/sources.list
# update system
apt-get -y -qq --force-yes update \
# install needed deps
@joaodubas
joaodubas / gist:9200860
Created February 25, 2014 01:33
docker example
$ # no host
$ docker run -i -t stackbrew/ubuntu:quantal bash
# # no container
# touch test_file.txt
# exit
$ # no host
$ docker ps -a # vamos pegar o id do container (ex: 0bf41761ce3b)
$ docker start -i 0bf41761ce3b
# # no container
# echo "ola mundo" > test_file.txt
@joaodubas
joaodubas / gist:8159276
Created December 28, 2013 13:02
Power shell loop to enable port forward between host and guest
for ($i = 8000; $i -lt 10000; $i++) { VBoxManage modifyvm "container" --natpf1 "tcp-port-$i,tcp,,$i,,$i" }
@joaodubas
joaodubas / multipleforms.py
Created November 13, 2013 17:50
Django view to handle multiple forms. Basically it re-implements the form views structure to enable handling multiple forms.
# encoding: utf-8
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.text import force_text
from django.views.generic import View
from django.views.generic.base import ContextMixin, TemplateResponseMixin
class MultipleFormMixin(ContextMixin):
"""MultipleFormMixin -- Mixin that provides methods to show and handle
@joaodubas
joaodubas / forms.py
Last active December 28, 2015 03:29
Dynamic Django Form
# encoding: utf-8
from django import forms
from collections import OrderedDict
def form_factory_for_fields(name, fieldnames, fields=None):
"""form_factory_for_fields -- Create dynamically a form class containing a
list of set fields.
name -- name for the Form class
@joaodubas
joaodubas / arangodb
Created October 25, 2013 20:00
docker sample
# arangodb
#
# VERSION: 0.0.1
FROM joaodubas/common
MAINTAINER Joao Paulo Dubas "joao.dubas@gmail.com"
# 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