Skip to content

Instantly share code, notes, and snippets.

View TonyDiana's full-sized avatar

Tony Diana TonyDiana

  • Heredia, Costa Rica
View GitHub Profile
@TonyDiana
TonyDiana / form.html
Created December 6, 2022 00:41 — forked from taoy/form.html
Python Bottle + WTforms + Polymer
%rebase layout title='Register New Slack log Box Backup configuration', parent_url=app.get_url('index')
<h2>Create New Slack Box backup</h2>
<script>
function submitForm(){
document.getElementById('authform').submit();
};
</script>
<!-- python block (bottle + wtforms) will not be appear in html-->
@TonyDiana
TonyDiana / uptogit
Created November 28, 2022 18:42 — forked from son-link/uptogit
Script para automatizar la actualización de un repositorio git
#!/bin/bash
# UpToGit 0.1
# Actualiza facilmente tu repositorio Git
# (CC) 2011 Alfonso Saavedra "Son Link"
# http://sonlinkblog.blogspot.com
# Bajo licencia GNU/GPL
# Modo de uso: copia o mueve este script a /usr/bin o /usr/local/bin y desde el directorio donde se encuentre la copia de un repo git, ejecútalo de esta manera:
# uptogit <ficheros>
@TonyDiana
TonyDiana / memocup.py
Last active June 12, 2021 20:06
Medir la memoria consumida por un objeto Python
# -*- coding: utf-8 *-*
"""
:Propósito: Medir la memoria consumida por un objeto Python
:Autor: https://goshippo.com/blog/measure-real-size-any-python-object/
:Versión: Desconocido
:Adaptación: Tony Diana
Se ha mejorado y se añadió medir también los atributos de los objetos
---------------------------------------------------------------------------
@TonyDiana
TonyDiana / clock.py
Created March 2, 2021 17:03 — forked from jampola/clock.py
Simple clock using PyGTK and GObject.timeout_add()
#!/usr/bin/python
from gi.repository import Gtk, GObject
from datetime import datetime
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="app")
self.box = Gtk.Box(spacing=6)
self.add(self.box)
@TonyDiana
TonyDiana / googleMapsAPI.py
Created February 20, 2021 05:09 — forked from inazense/googleMapsAPI.py
Clase para trabajar con la API de Google Maps
# -*- coding: utf-8 -*-
import requests
import re # Usado para eliminar las etiquetas HTML de las response
class googleMapsAPI:
""" Clase para trabajar con la API de Google Maps """
# Propiedades
_clave = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Escribe aquí to clave (puedes generarlas desde https://console.developers.google.com/apis/credentials)
@TonyDiana
TonyDiana / LectorXLSX.py
Created February 20, 2021 05:09 — forked from inazense/LectorXLSX.py
Lector ficheros XLSX con Python3
# -*- coding: utf-8 -*-
from openpyxl import load_workbook # Requiere instalar openpyxl
import os.path
rutaXLSX = "fichero.xlsx"
if os.path.isfile(rutaXLSX):
libro = load_workbook(rutaXLSX) # Abro el excel para extraer los campos
@TonyDiana
TonyDiana / barraProgresoTerminal.py
Created February 20, 2021 05:08 — forked from inazense/barraProgresoTerminal.py
Genera una barra de progreso en la terminal
# -*- coding: utf-8 -*-
from tqdm import tqdm # Requiere instalar la librería -> pip install tqdm
from time import sleep
tareasQueRealizar = 100;
for i in tqdm(range(tareasQueRealizar)):
sleep(0.2)
@TonyDiana
TonyDiana / clonarRepositorio.py
Created February 20, 2021 05:06 — forked from inazense/clonarRepositorio.py
Clona un repositorio GIT en Python usando GitPython
# -*- coding: utf-8 -*-
# Clono un repositorio online a mi disco duro local.
# Genero una carpeta en la que almacenaré, en diferentes subcarpetas, todas las ramas que vaya a necesitar clonar
# Posteriormente comprimo toda la clonación en un archivo .zip con la fecha actual del sistema.
# Si ya existiese dicho archivo lo sobrescribiré.
# Posteriormente borro las carpetas creadas para dejar solo el .zip
import git # Requiere librería GitPython
import time