Skip to content

Instantly share code, notes, and snippets.

View macagua's full-sized avatar
🏠
Working from home

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
@macagua
macagua / gist:4702161
Last active December 12, 2015 02:49
Terminating a Python script, is a example of terminate a Python script
# -*- coding: utf8 -*-
import sys
sys.exit()
@macagua
macagua / gist:4702250
Last active December 12, 2015 02:49
Cleanup action to a shell console from a Python script, is a example python script that simulate the cleanup action to a shell console, it do that to scroll the screen down lots of lines.
# -*- coding: utf8 -*-
def cls():
''' Python script main function '''
print "\n" * 100
if __name__ == '__main__':
''' Python script main function '''
@macagua
macagua / gist:4702326
Created February 3, 2013 16:09
Demo of a main menu for choose a option from a Python script.
# -*- coding: utf8 -*-
def menu():
''' Main menu to choose an item '''
chosen_element = 0;
print "#############################################################################"
print "######## ########"
print "######## My Company Super Client Number 1' ########"
@macagua
macagua / gist:4709197
Last active December 12, 2015 03:48
A example for try to fixing user input from Python script
# -*- coding: utf8 -*-
print "Insisting on fixing user input"
first = 1
second = 2
third = 3
while 1:
try:
extra = input("What is the extra value? ")
@macagua
macagua / gist:4722804
Created February 6, 2013 14:24
A setuptools configuration (setup.py) for define the package name
# the package name
name = 'collective.mypackage'
# get packages from the package name: '1.2.3' -> ['1','1.2','1.2.3']
>>> packages = [name.rsplit('.',x)[0] for x in reversed(range(len(name.split('.'))))]
>>> packages
['collective', 'collective.mypackage']
>>> # all except the last are treated as namespace_packages
>>> namespace_packages = packages[:-1]
>>> namespace_packages
['collective']
@macagua
macagua / gist:4942318
Created February 13, 2013 04:39
zopeskel configuration file for Buildout projects
# .zopeskel configuration file for Buildout projects
# This file can contain preferences for zopeskel.
# To do so, uncomment the lines that look like:
# variable_name = Default Value
[DEFAULT]
# Expert Mode? (What question mode would you like? (easy/expert/all)?)
expert_mode = easy
@macagua
macagua / webalizer_lang.spanish
Created February 27, 2013 14:36
It is the Language Support file for Spanish (webalizer_lang.spanish) with full Spanih translation for webalizer software (http://www.webalizer.org/)
/*
webalizer_lang.spanish
Webalizer V2.0x Language Support file for Spanish.
27-Feb-2013 Translated by Leonardo J. Caballero G. (leonardocaballero@gmail.com)
29-May-1998 Translated by Alfredo Sola (alfredo@intelideas.com)
31-May-1998 Modified for level 1.1 support (brad@mrunix.net)
23-Jul-1998 Modified for level 1.2 support (brad@mrunix.net)
29-Jul-1998 Translation for most countries and 1.2 new strings
by (alfredo@intelideas.com)
@macagua
macagua / gist:5072640
Created March 2, 2013 19:10
This recipe helps to copy backup Plone data from one place to another via rsync with a crontab job. For options see http://pypi.python.org/pypi/z3c.recipe.usercrontab
# This recipe helps to copy backup data from one place to another via rsync with a crontab job.
# For options see http://pypi.python.org/pypi/z3c.recipe.usercrontab
[move-zodb-back]
recipe = z3c.recipe.usercrontab
times = 0 3 * * 7
keep = 0
gzip = true
command = rsync -av ${buildout:directory}/var/backups/filestorage/Data.fs* user@DNS_SERVER:/path/to/backups/directory/
@macagua
macagua / dc.ldif
Last active August 29, 2015 13:56
This a example file for OpenGEVER LDAP Demo
# Root of directory tree "dc=4teamwork,dc=ch"
dn: dc=ch
objectClass: domain
objectClass: top
dc: ch
dn: dc=4teamwork,dc=ch
objectClass: domain
objectClass: top
dc: 4teamwork
@macagua
macagua / correo.html
Created March 19, 2014 02:46
Email Anti-spam with HTML and CSS styles
<style type="text/css">
span.test { direction: rtl; unicode-bidi:bidi-override; }
</style>
<p><span>leonardocaballero@gmail.com</span></p>
<p><span class="test">moc.liamg@orellabacodranoel</span></p>