Skip to content

Instantly share code, notes, and snippets.

View batok's full-sized avatar

Domingo Aguilera batok

  • Consultant
  • Guadalajara, Mexico
  • X @batok
View GitHub Profile
def preview(event):
prt = PrintTable()
regs = []
for anotacion in model.session.query( model.Anotacion ).filter( model.Anotacion.relacion == self.data).order_by( model.Anotacion.fecha_elaboracion.desc()):
regs.append([ anotacion.fecha_local, unicode( anotacion.anotacion )])
prt.data = regs
prt.left_margin = 0.5
prt.set_column = [2.0, 5.0]
prt.label = ["Fecha",u"Anotación"]
Tabla = getattr(model, anotacion.fuente)
@batok
batok / gist:658657
Created November 1, 2010 18:36
turbomail_gooble.py
def email(to, subject, body, filenames = []):
try:
usuario, password = get_google_account()
source = usuario
if "@" in usuario:
#if usuario.split("@")[-1] == "gmail.com":
#usuario = usuario.split("@")[:-1]
pass
else:
return False
class IniDialog(BaseDialog):
def AddControls(self):
lbox = gizmos.EditableListBox( self.pane, -1, u"Edición de INI", (100,100), (250,250))
with open("felec.ini") as f:
lineas = [ linea for linea in f.read().split("\n") if linea ]
lbox.SetStrings( lineas )
@batok
batok / gist:647342
Created October 26, 2010 17:21
ultimate.py
def anotaciones(self):
lc = self.lc
lc.ClearAll()
bg1 = wx.Colour(239,235,239)
bg2 = wx.Colour(255,207,99)
title = u"#,Fecha, Anotación"
for i, colTitle in enumerate(title.split(",")):
lc.InsertColumn(i,colTitle)
x = 0
for anotacion in model.session.query( model.Anotacion ).filter( model.Anotacion.relacion == self.data).order_by( model.Anotacion.fecha_elaboracion.desc()):
if c[1] == "fecha_iso":
wx.StaticText(self.pane,-1,"")
f_button = GB.GradientButton(self.pane,-1,None,"Editar Fecha Especial")
self.f_iso = text
wx.StaticText(self.pane,-1,"Porcentajes")
porc_button = GB.GradientButton(self.pane,-1,None,"Cambiar")
wx.StaticText(self.pane,-1,"Partidas")
subpane = sc.SizedPanel(self.pane,-1)
subpane.SetSizerType("horizontal")
import wx.lib.agw.gradientbutton as GB
import wx.lib.agw.genericmessagedialog as GMD
class GMDialog(object):
@classmethod
def show(cls, win, mensaje, titulo):
dlg = GMD.GenericMessageDialog(win, mensaje, titulo, wx.OK | ( wx.ICON_INFORMATION + GMD.GMD_USE_GRADIENTBUTTONS ) )
val = dlg.ShowModal()
dlg.Destroy()
return val
class Factura(Base):
__tablename__ = "facturas"
id = Column( Integer, primary_key = True )
folio = Column( Integer, unique = True )
fecha = Column( DateTime )
aprobacion = Column( Integer )
ano_aprobacion = Column( Integer )
certificado = Column(String(20))
cliente = Column( Integer , ForeignKey( "clientes.id"))
porcentaje_iva = Column( Numeric(6,3))
import sys, boto
from hashlib import md5
try:
bucket, key_name, local_name = sys.argv[1:]
except:
sys.exit("wrong arguments")
c = boto.connect_s3()
b = c.get_bucket(bucket, validate = False )
import boto, sys
c = boto.connect_s3()
b = c.get_bucket(sys.argv[1], validate = False)
for key in b.get_all_keys():
print key.name, key.etag
# works with python 2.7
import boto, sys, json
c = boto.connect_iam()
user = sys.argv[1]
policy_name = "list_all_buckets_{}".format( user )
policy = json.dumps(dict( Statement = [ dict(Effect = "Allow", Action = "s3:ListAllMyBuckets" , Resource = "arn:aws:s3:::*"),]))