Skip to content

Instantly share code, notes, and snippets.

View ppsirg's full-sized avatar

pedro rivera ppsirg

View GitHub Profile
@ppsirg
ppsirg / fun.py
Created April 11, 2017 03:46
fun mockup
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class gameMainWindow(Gtk.Window):
"""
create a game Window
"""
#Prueba número 2 de programación en PHYTON
#Factura de venta sencilla con libreria datetime
import datetime #libreria requerida para conocer el calendario y hora
#data
products = (
(
'manzana':500, 'pera': 650, 'mango': 1000, 'papaya':1200,
)
@ppsirg
ppsirg / decoradores.py
Created October 21, 2017 00:58
codigo de clase de decoradores, python popayan
"""
decoradores:
- son funciones que modifican el comportamiento de otras funciones para
adicionarles diferentes tipos de logicas
- se suelen usar para validaciones y manejo de errores
- pueden ser modificadas con parametros
- ayudan a documentar el código, y a reducir su tamaño
"""
@ppsirg
ppsirg / funciones_generadores.py
Created October 21, 2017 01:03
clase funciones y generadores, python popayan
"""
FUNCIONES: CODIGO PARA HACER ALGO
GENERADORES: CREAR ALGO
"""
def generador_pares(valores=None):
"""
genera numeros pares
"""
numero = 0
@ppsirg
ppsirg / python_asyncio.py
Created October 28, 2017 01:01
asyncio ejemplos clase python popayan
import asyncio
from time import sleep
from random import randint
# asincrona
# se ejecuta secuencialmente hasta que encuentre la palabra await
# despues de eso, para su ejecucion hasta que python decida
async def timer(seconds=None):
'mirar tiempo de ejecucion'
@ppsirg
ppsirg / tkinter_demo.py
Last active March 27, 2018 03:46
tkinter demo bugfixing
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 26 21:39:36 2018
@author: ging
"""
from tkinter import *
#==========================================================
#import cx_Oracle
@ppsirg
ppsirg / serpent_smart_contracts.md
Created April 2, 2018 03:48
how to setup serpent smart contracts vm

serpent: start site serpent tutorial

install pyethereum, the one that let us to communicate with blockchain

#create a folder to save all you're going to download
mkdir ethereum
cd ethereum
#make python 2.7 virtualenv
@ppsirg
ppsirg / booked_reservation.py
Last active April 11, 2018 15:56
booking algorithm for reservations
from datetime import datetime
DEBUG = True
def to_datetime(string_date):
return datetime.strptime(string_date,'%d-%m-%Y')
reservations = [
['01-05-2018', '10-05-2018'],
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 25 09:24:05 2018
@author: ging
"""
#!/usr/bin/env python
# https://code.google.com/p/libcrafter/wiki/DNSSpoofing
@ppsirg
ppsirg / my_werid_class.py
Last active May 10, 2018 12:41
weird stuff
class testThis(SessionWizardView):
form_list = [ReservationStepOne, ReservationStepTwo,]
def done(self, form_list, **kwargs):
all_data = {}
first, second = form_list
saved_obj = first.instance
saved_obj.save()
print('#='*90)
print(saved_obj.__dict__)