Skip to content

Instantly share code, notes, and snippets.

View alejandrobernardis's full-sized avatar
🐻

Alejandro M. BERNARDIS alejandrobernardis

🐻
View GitHub Profile
@alejandrobernardis
alejandrobernardis / app.py
Created September 13, 2012 21:06
Tornado App, Base
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
pkg = '/src'
root_path = os.path.dirname(__file__)
sys.path.insert(0, root_path.replace(pkg, '/src'))
sys.path.insert(0, root_path.replace(pkg, '/lib'))
sys.path.insert(0, root_path.replace(pkg, '/libs'))
sys.path.insert(0, '/Volumes/Amelie/alejandro/development/library/python')
@alejandrobernardis
alejandrobernardis / demo.py
Created September 14, 2012 06:32
Data Base, User Demo
from settings import DATABASE_USERS
from com.ak.common.security import token
from mongoengine import connect as mongo_connect
settings = dict(host='127.0.0.1', port=27017)
mongo_connect(DATABASE_USERS, **settings)
User.drop_collection()
u = User()
u.username = 'alejandro.bernardis'
u.password = 'alejandro.bernardis'
u.email = 'alejandro.bernardis@gmail.com'
@alejandrobernardis
alejandrobernardis / DATABASE_MULTIPLE.py
Created September 14, 2012 16:57
DATABASE MULTIPLE
DATABASE_MULTIPLE = dict(
principal = dict(
name = 'com-ak-proc3ss-local',
user = 'root',
pasw = 'root',
host = '127.0.0.1',
port = 27017,
conn = 100,
areq = True,
ugls = False
@alejandrobernardis
alejandrobernardis / demo.py
Created September 15, 2012 23:31
por estas cosas amo a python!
try:
import importame.una.clase
except ImportError:
raise Exception(u'puta, no cargo... por estas cosas amo a python!')
@alejandrobernardis
alejandrobernardis / demo.py
Created September 15, 2012 23:34
por estas cosas amo a python!
class A(object):
@staticmethod
def sm(cls, p1=None, p2=None):
print cls, p1, p2
@classmethod
def cm(cls, p1=None, p2=None):
print cls, p1, p2
class B(A):
@alejandrobernardis
alejandrobernardis / code.c
Created September 30, 2012 04:12
Tree Command, in mac os x
# L: 1107
# } else return sprintf(buf, sizeof(off_t) == sizeof(long long)? " %11lld" : " %9ld", size);
# } else return sprintf(buf, sizeof(off_t) == sizeof(long long)? " %11lld" : " %9lld", size);
int psize(char *buf, off_t size)
{
static char *iec_unit="BKMGTPEZY", *si_unit = "dkMGTPEZY";
char *unit = siflag ? si_unit : iec_unit;
int idx, usize = siflag ? 1000 : 1024;
TimeZone
========
$: cp /etc/localtime /etc/localtime.old
$: cp -f /usr/share/zoneinfo/Mexico/General /etc/localtime
-------------------------------------------------------------------------------
Base
====
@alejandrobernardis
alejandrobernardis / build.properties
Created December 29, 2012 18:59
Ant, Deploy with HTML/CSS/JS Compress
################################################################################
## Project Information
################################################################################
project.author =
project.author.email =
project.owner =
project.owner.url =
project.fullname =
project.name =
<?xml version="1.0"?>
<project name="asumikamikaze-site" default="test" basedir=".">
<!-- == properties ===================================================== -->
<property file="build.properties" />
<!-- == common ========================================================= -->
<macrodef name="common.data">
<sequential>
<tstamp>
<format property="build.date" pattern="yyyyMMddHHmmss" unit="minute" locale="en" />
<format property="build.fullDate" pattern="yyyy/MM/dd HH:mm:ss" unit="minute" locale="en" />
<div class="login box white span3">
<div class="box-header">
<h2 class="box-title">Sign in to Admin</h2>
</div>
<div class="js-alert box-alert">
</div>
<div class="box-content">
<form class="">
<fieldset>