Skip to content

Instantly share code, notes, and snippets.

View zodman's full-sized avatar
🤗
Code wins arguments!

Andres Vargas zodman

🤗
Code wins arguments!
View GitHub Profile
@zodman
zodman / invalid_chars.js
Created August 20, 2012 17:54
Validando caracteres extraños en un input
(function($){
$.fn.invalid_chars = function(){
return this.each(function(){
var obj = $(this);
obj.unbind("keyup");
obj.bind("keyup",function (e){
@zodman
zodman / uwsgi-projectname
Created August 1, 2012 17:22
uwsgi init new script
#!/bin/bash
# uwsgi - Use uwsgi to run python and wsgi web apps.
#
# chkconfig: - 85 15
# description: Use uwsgi to run python and wsgi web apps.
# processname: uwsgi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/uwsgi
@zodman
zodman / uwsgi-projectname
Created August 1, 2012 17:17
uwsgi init script
#!/bin/bash
# uwsgi - Use uwsgi to run python and wsgi web apps.
#
# chkconfig: - 85 15
# description: Use uwsgi to run python and wsgi web apps.
# processname: uwsgi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/uwsgi-2.7
"""
code: zodman
Fabric es una herramienta que uso desde mis proyectos para evitar realizar
tareas repetidas ( si lo hago mas de 2 veces hago un script).
Tiene una funcion especial que llama do_rebuild() esta funcion se encarga
de traers el ultimo log de svn y revisar palabras claves en el commit.
Dependiendo a esta palabra clave realiza una accion.
def sixteenize(string, filler=" "):
fill=16-len(string)%16
return string + filler*fill
from Crypto.Cipher import AES
from encoder import PKCS7Encoder
import base64
#declared outside of all functions
key = '################'
mode = AES.MODE_CBC
iv = '\x00' * 16
print (iv,)
a = AES.new("1234567890123456",AES.MODE_CBC,'This is an IV456')
In [22]: sixteenize("andres")
Out[22]: 'andres '
d= a.encrypt(sixteenize("andres"))
In [21]: base64.encodestring(d)
Out[21]: 'DnFT1bUDaLP7Y+8jgljWcQ==\n'
@zodman
zodman / backend.py
Created April 10, 2012 23:20
django Backend con ldap
# -*- coding: utf-8 -*-
""" Metodos de Autentificacion """
from django.contrib.auth.backends import RemoteUserBackend, ModelBackend
from django.contrib.auth.models import User
from mosketeros.settings import LDAP_SERVER,LDAP_BIND,LDAP_SEARCH
class DjangoAuth(ModelBackend):
""" Autentificacion del framework """
#create_unknown_user = False
#supports_anonymous_user = False
@zodman
zodman / test_ldap.py
Created April 10, 2012 23:19
ldap conection test
import ldap
import pprint
# tomado de
# http://www.grotan.com/ldap/python-ldap-samples.html#search
# conectamos al active directory
l = ldap.open("10.0.0.203")
#hacemos un bind
# cn =test objecto
@zodman
zodman / requires.txt
Created March 30, 2012 21:32
tryton hg requires
Genshi==0.6
PyWebDAV==0.9.8
cdecimal==2.3
egenix-mx-base==3.2.3
lxml==2.3.4
## FIXME: could not find svn URL in dependency_links for this package:
openoffice-python==0.1-20110209
polib==0.7.0
psycopg2==2.4.5
pyOpenSSL==0.13