This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import gi | |
import cairo | |
import datetime | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import Gtk, Gdk, GLib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import gi | |
import cairo | |
import datetime | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import Gtk, Gdk, GLib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
# CRUD in dict table (create, read, update, delete, save, load) | |
# table => {<id_1>: {<field_1>: <value_1>, <field_2>: <value_2>, ...}, ...} | |
# fields => {<field_1>: <type_1>, <field_2>: <type_2>, ...} | |
# field name `id´ is reserved | |
def crud_create(table, fields, register=None, | |
fields_error="Not all fields in register."): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GTK_VER = '2.0' | |
USE_STOCK = False | |
# Descomente abaixo para PyGtk 2.0 com Python 2.x e comente o PyGObject | |
# Aqui usa-se PyGtk e troca-se de "gtk" para "Gtk" "compatibilizando" o código | |
# import pygtk | |
# pygtk.require(GTK_VER) | |
# import gtk as Gtk | |
# print(Gtk.ver) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import socket | |
socket.setdefaulttimeout(.1) # Espera 100 milissegundos pela resposta | |
TRUE = 1 # pode-se retornar True ou 0 (sucesso) se preferir | |
FALSE = 0 # pode-se retornar False ou 1 (sem sucesso) se preferir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Criar a jaula | |
mkdir stretch | |
debootstrap stretch stretch # se tiver apt-cache ou mirror coloque aqui | |
# Preparar para montar as partições do sistema dentro da jaula | |
mount | | |
sed 's/\(.*\) on \(.*\) type \(.*\) .*/mkdir -p \2; mount -t \3 \1 \2/' | | |
grep -v /dev/sd >> stretch/root/.bashrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import time | |
try: | |
import gi | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import Gtk | |
except Exception: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
def disputa_round_robin(nomes, fixar_primeiro=True, sentido_horario=True, | |
com_volta=False, debug=False): | |
n = len(nomes) | |
if n % 2 == 1: | |
n += 1 | |
nomes['~'] = 'Ninguém' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import math | |
import random | |
import locale | |
# Locale para utilizar agrupamento e ponto decimal da localização configurada | |
locale.setlocale(locale.LC_ALL, '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Para substituir caracteres com acentos e outros por equivalente ascii | |
from unicodedata import normalize | |
# Caracteres para ocultar em ASCII (minúsculos) e o caracter oculto | |
OCULTAR = 'aeiou' | |
C = '*' |
NewerOlder