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 / gist:1994975
Created March 7, 2012 18:31
set MyISAM on all mysql connections!
DATABASES["default"].update({
"NAME":"volaris",
"USER":"yey!",
'OPTIONS': {'init_command':"set storage_engine=MYISAM;"}
})
@zodman
zodman / validator.py
Created March 2, 2012 17:01
Validator image width and height
from django.core.files.images import get_image_dimensions
from django.core.exceptions import ValidationError
HELP_TEXT_570 = _(u"El tamaño debe ser 570px y altura variable.")
HELP_TEXT_604 = _(u"El tamaño debe ser ancho 604px y altura variable.")
def validator_570( image ):
w, h = get_image_dimensions(image)
if h != 570:
ValidationError(HELP_TEXT_570)
@zodman
zodman / remmina
Created January 25, 2012 15:58
localnetwork ips
296512382395.remmina
20:server=10.0.0.200
1317161015928.remmina
26:server=10.0.0.179
1318452389130.remmina
26:server=10.0.0.100
1319680312680.remmina
@zodman
zodman / __init__.py
Created October 16, 2011 06:17
tryton admin jsonrpc
from jsonrpclib import Server as ServerProxy
import base64
import jsonrpclib
import json
class AdminTrytonException(Exception):
def __init__(self, result):
self.result = result
@zodman
zodman / test.py
Created June 14, 2011 20:21
order a list of dicts by dict key
l = []
for i in bloques:
if i.donativo:
nombre = i.donativo.nombre
apellido = i.donativo.apellido
pais = i.donativo.pais.nombre
fecha = i.donativo.fecha_creacion
else:
nombre = i.perfil.nombre
apellido = i.perfil.apellidos
jQuery(function($) {
$('div.inline-group').sortable({
items: 'tr.has_original',
handle: 'td',
update: function() {
$(this).find('tr.has_original').each(function(i) {
$(this).find('input[name$=sequence]').val(i+1);
$(this).removeClass('row1').removeClass('row2');
$(this).addClass('row'+((i%2)+1));
});
@zodman
zodman / gist:769923
Created January 7, 2011 18:57
bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@zodman
zodman / gist:732164
Created December 7, 2010 18:11
un filter fuera de lo comun
# coding: utf-8
from django.template import Library
from django.db import models
from django.utils.translation import ugettext as _
register = Library()
def estado_filter(cl):
if not getattr(cl.model_admin, 'estado_filter', False):
return
@zodman
zodman / vimrc
Created November 24, 2010 17:23
.vimrc
set nu
set ts=4
set sw=4
set sts=4
nnoremap <silent> ,q :bp<CR>
nnoremap <silent> ,w :bn<CR>
nnoremap <silent> ,d :bd<CR>
@zodman
zodman / fliddler.py
Created November 23, 2010 21:20
fliddler.py
from twisted.internet import reactor
from twisted.web import http
from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient
class InterceptingProxyClient(ProxyClient):
def handleResponsePart(self, buffer):
if 'x-requested-with' in self.headers.keys():
print(buffer)
ProxyClient.handleResponsePart(self, buffer)