Skip to content

Instantly share code, notes, and snippets.

View joac's full-sized avatar
🔥

Joaquín Sorianello joac

🔥
View GitHub Profile
@joac
joac / cdata_element_tree.py
Last active February 17, 2021 18:50
Monkey Patching Element Tree To support CDATA
import xml.etree.ElementTree as ET
CDATA_KEY = "__CDATA__" #cdata tag name for sustitution
def monkey_patch():
"""Monkey Patch ElementTree, to support CDATA"""
_serialize_xml = ET._serialize_xml
def _serialize_xml_cdata(write, elem, encoding, qnames, namespaces):
tag = elem.tag
@joac
joac / indent_ET.py
Created June 4, 2013 16:50
indent for element tree
def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
@joac
joac / builder_example.py
Created June 5, 2013 17:16
example for my blog
# Imports, for base primitives
from tryton_builder import Module, Model, Field
# We create a new module
module = Module('HelloWorld')
# Two models
hello = Model('Hello', 'hello.hello')
# Add models to module
☁ tryton_builder [master] ⚡ wc example.py
19 51 398 example.py
☁ tryton_builder [master] ⚡ python2 example.py
ElementTree was Monkey Patched to suport CDATA
☁ tryton_builder [master] ⚡ wc HelloWorld/*
12 32 279 HelloWorld/hello.py
44 109 1673 HelloWorld/hello.xml
6 13 130 HelloWorld/__init__.py
6 6 54 HelloWorld/tryton.cfg
68 160 2136 total
/*"basado en lo que llego a entender
* Hay cuatro puntos p1, p2, p3, p4 de traking y el punto k
* considero:
* p1----p2
* | |
* | |
* p3----p4
* |
* |
* k
@joac
joac / ClasePyPi.md
Last active December 18, 2015 07:49
Curso

PyPI y virtualenv

Como laburar con elementos de terceros usando pip

Tenemos que instalar las dependencias de debian

  • python-pip
  • python-virtualenv

Como no queremos mezclar las dependencias de nuestra aplicacion con las del sistema, vamos a crear un virtualenv:

dameLayer = "Precomp-B"
comp(dameLayer).layer("trakBoca").transform.position
dameLayer = "Precomp-B"
comp(dameLayer).layer("trakBoca").transform.position
import pygame
from pygame.locals import QUIT
from bluetooth import BluetoothSocket, BluetoothError, L2CAP
import thread, time
WIDTH = 800 #512
HEIGHT = 256 # 256 Don't change this one
#ADDRESS = '00:1F:32:8C:A7:B0' # Cambiar por la mac del wiimote que estan probando, la mac se averigua con el comando "hcitool scan"
#ADDRESS = '00:1E:35:DE:29:82' # Cambiar por la mac del wiimote que estan probando, la mac se averigua con el comando "hcitool scan"
ADDRESS = "00:18:00:2E:72:41"

Keybase proof

I hereby claim:

  • I am joac on github.
  • I am joac (https://keybase.io/joac) on keybase.
  • I have a public key whose fingerprint is BBC8 9FAB 3910 FFAB A2F4 452C D47D 6094 4F4A EFAC

To claim this, I am signing this object: