Skip to content

Instantly share code, notes, and snippets.

View eos87's full-sized avatar

Helmy Giacoman eos87

View GitHub Profile
@eos87
eos87 / decorator
Last active October 11, 2015 13:57
decorator in python
def supercow_powers_required(func):
def wrapped_foo(request, **kwargs):
if request.user.is_someshit:
return func(request, **kwargs)
else:
return 'Denegado'
return wrapped_foo
@eos87
eos87 / gist:2705553
Last active October 4, 2015 21:57
Fullcalendar json response example
for evento in eventos:
d = {
'id': str(evento.id),
'title': str(evento.evento),
'start':str(evento.inicio),
'end':str(evento.final),
'allDay': True,
'color':str(evento.user.userprofile.contraparte.font_color)
}
var.append(d)
@eos87
eos87 / .bash_profile
Created February 7, 2012 17:46
.bash_profile bluehost
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PATH=$HOME/bin:${PATH}
@eos87
eos87 / md5.java
Created October 21, 2010 05:01
md5
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.*;
@eos87
eos87 / web.xml
Created October 21, 2010 04:59
web.xml
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
@eos87
eos87 / validation.java
Created October 21, 2010 04:56
validacion en java
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
@eos87
eos87 / backup.java
Created October 21, 2010 03:46
repaldo postgres desde java
try {
String path = "ruta_donde_repaldar"
Runtime r = Runtime.getRuntime();
//PostgreSQL variables
String user = "postgres";
String dbase = "base_datos";
String password = "tu_clave";
Process p;
ProcessBuilder pb;
@eos87
eos87 / logger.java
Last active July 5, 2018 12:42
logger
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.log4j.*;
/**
*
* @author e0s87
*/
public class logger {
@eos87
eos87 / gist:637803
Created October 21, 2010 02:17
down from youtube desde consola
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Uso: $0 "
exit 1
fi
ID=`echo $1 | cut -d= -f2 | cut -d\& -f1`
FILE="youtube-${ID}"
#Script sh para cambiar nombre por numeros masivamente
#!/bin/sh
for img in `ls *.jpg`
do
echo $img
nombre=$[$nombre+1]
mv $img $nombre.jpg
done