Skip to content

Instantly share code, notes, and snippets.

View decko's full-sized avatar

André "decko" de Brito decko

View GitHub Profile
@decko
decko / backupxfs.py
Created December 11, 2020 00:23
My oldest python script...
#! /usr/bin/python
# -*- coding: utf-8 -*-
##############################################################
# Programa para Backup de Partições XFS.
# André Filipe de Assuncao e Brito (decko@noisemakers.org)
# Fabricio Coutinho Medeiros (fabriciocoutinho@terra.com.br)
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
---
- hosts: localhost
vars:
apps:
- chromium
- gnome-tweaks
- firefox
- neovim
@decko
decko / gist:22e46d6ff4d54e8e26aa
Last active February 26, 2016 19:04
ubuntu Trusty basic sources.list
#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty main restricted universe multiverse
###### Ubuntu Update Repos
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-security main restricted universe multiverse
146 "Helping Python Indentation
147 au BufNewFile,BufRead *.py
148 \ set tabstop=4
149 \ set softtabstop=4
150 \ set shiftwidth=4
151 \ set textwidth=79
@decko
decko / gist:7d1410775be8a8f96ef4
Created October 21, 2015 14:12
guild build error
[12:10:53] Using gulpfile ~/Copy/dev/meta-id-client/gulpfile.js
[12:10:53] Starting 'clean'...
[12:10:53] Finished 'clean' after 1.74 ms
[12:10:53] Starting 'less'...
[12:10:53] Starting 'uglify:layout'...
[12:10:53] Starting 'usemin:fonts'...
[12:10:53] Starting 'imagemin'...
[12:10:53] Starting 'html'...
[12:10:53] Starting 'html:pages'...
[12:10:53] Finished 'uglify:layout' after 365 ms
@decko
decko / models.py
Created September 29, 2015 21:56
Models
class Ente(models.Model):
id_pub = models.UUIDField(default=uuid.uuid4, editable=False)
nome = models.CharField(_('Nome'), max_length=100, blank=False)
endereco = models.TextField(_('Endereço'), blank=True)
bairro = models.TextField(_('Bairro'), blank=True)
uf = models.TextField(_('UF'), blank=True)
cep = models.TextField(_('CEP'), blank=True)
class Meta:
verbose_name = "ente"
@decko
decko / serializers.py
Last active September 30, 2015 02:30
Nested Serializers
from rest_framework import serializers
from .models import Ente
class EnderecoSerializer(serializers.Serializer):
id = serializers.IntegerField()
endereco = serializers.CharField()
bairro = serializers.CharField()
Verifying I am +decko on my passcard. https://onename.com/decko
"""
Tasks for managing a test server
"""
import os
from fabric.api import cd, env, prefix, run, sudo, task
from fabric.contrib.files import exists, sed
from fabric.context_managers import hide
from fabric.colors import green, red
def conselhos(self):
if self.titular.all():
return "Titular no %s" % (", titular no ".join([str(mandato.conselho) for mandato in self.titular.all()]))
elif self.suplente.all():
return "Suplente no %s" % (", suplente no ".join([str(mandato.conselho) for mandato in self.suplente.all()]))
else:
return "Sem mandato"