Skip to content

Instantly share code, notes, and snippets.

View lesthack's full-sized avatar
⚔️
Struggling

Jorge Hernández lesthack

⚔️
Struggling
View GitHub Profile
@lesthack
lesthack / daluen.conf
Created October 7, 2011 19:52
VirtualHost daluen
<VirtualHost *:80>
ServerName daluen.localhost.org #server local
ServerAdmin jhernandez@s3.com.mx #Mail del sysadmin
#Establecer la ruta del proyecto
DocumentRoot /home/lesthack/public_html/daluen
#Establecer la ruta del proyecto
<Directory /home/lesthack/public_html/daluen>
Options FollowSymLinks
@lesthack
lesthack / gist:1302376
Created October 20, 2011 21:04
Extract metatags from multimedia file with python
from mutagen import File
file = File('some.mp3') # mutagen can automatically detect format and type of tags
artwork = file.tags['APIC:'].data # access APIC frame and grab the image
with open('image.jpg', 'wb') as img:
img.write(artwork) # write artwork to new image
@lesthack
lesthack / gist:1302380
Created October 20, 2011 21:05
Sample of Keybinder in python
#!/usr/bin/env python
"""
example.py
Created in 2010 by Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
This work is placed in the public domain.
"""
import gtk
import keybinder
@lesthack
lesthack / gist:1636194
Created January 18, 2012 22:22
parameters
prototipo_parameters:
_attributes: { phpName: Parameters }
id:
name: { type: VARCHAR, size: '50', required: true }
value: { type: VARCHAR, size: '100', required: true }
from gi.repository import Gtk,WebKit
def ftest():
print "testing ok"
def load_finish(param1, param2):
print "termino de cargar"
dom = view.get_dom_document()
test = dom.get_element_by_id("test")
test.connect_object('click-event', ftest, test)
@lesthack
lesthack / gist:2890025
Created June 7, 2012 16:53
Dupstep Playlist
http://www.youtube.com/watch?v=ecMBOZ8YDew
http://www.youtube.com/watch?v=YOjrkrudZj8
http://www.youtube.com/watch?v=6rSizcgAtXA&feature=related
http://www.youtube.com/watch?v=5EgPIfKXolc
http://www.youtube.com/watch?v=fsd1R74t8DM
@lesthack
lesthack / gist:3145314
Created July 19, 2012 17:00
parseArrayToJson
<?php
...
public function parseArrayToJSon($object){
if( $this->is_assoc($object) ){
$ctotal = count($object);
$ccount = 0;
$source = "";
foreach($object as $key=>$value){
@lesthack
lesthack / gist:3504909
Created August 28, 2012 22:27
VirtualHost Django
<VirtualHost *:80>
ServerName django.localhost.com
ServerAdmin j.hernandez@maices.com
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE preventa.settings
PythonDebug On
PythonPath "['/home/lesthack/public_html/django', '/home/lesthack/public_html/django/preventa'] + sys.path"
@lesthack
lesthack / gist:5258831
Last active December 15, 2015 12:18
pong.c
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
main()
{
int a,b;
int n,xc;
# -*- coding: utf-8 -*-
ADMINS = (
('', ''),
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'nibiru', # Or path to database file if using sqlite3.