This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lxml.etree | |
def pprint(elem): | |
print lxml.etree.tostring(elem, pretty_print=True) | |
class Bind(object): | |
def __init__(self, path, converter=None, first=False): | |
''' | |
path -- xpath to select elements | |
converter -- run result through converter | |
first -- return only first element instead of a list of elements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import struct | |
import socket | |
import hashlib | |
import sys | |
from select import select | |
import re | |
import logging | |
from threading import Thread | |
import signal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The JavaScript implementation of the Secure Hash Algorithm 1 | |
* | |
* Copyright (c) 2008 Takanori Ishikawa <[email protected]> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: iso-8859-15 -*- | |
import Tkinter as tkinter | |
import urllib2, urllib | |
import json | |
TRANSLATE_URL = 'http://ajax.googleapis.com/ajax/services/language/translate' | |
TO_ENGLISH = 'fr|en' | |
TO_FRENCH = 'en|fr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
db=$1 | |
user=$2 | |
passwd=$3 | |
if [ "$db" = "" ]; then | |
echo "Usage: $0 db_name user password" | |
exit 1 | |
fi | |
clear | |
for sql_file in *.sql; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TinyORM = (function(options) { | |
/* a hash containing all the available models */ | |
var Models = {}; | |
var connection = null; | |
var config = _.extend({ | |
/* The name of the database which Ti will open. The local db is located at: | |
~/Library/Application Support/iPhone Simulator/4.2/Applications/APP_ID/Library/Application Support/database/dbname | |
*/ | |
dbname: 'add.db', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2011, Eng Eder de Souza | |
# ___ _ _ ___ | |
# | __|__| |___ _ _ __| |___ / __| ___ _ _ _____ _ | |
# | _|/ _` / -_) '_| / _` / -_) \__ \/ _ \ || |_ / _` | | |
# |___\__,_\___|_| \__,_\___| |___/\___/\_,_/__\__,_| | |
#Accessing the Google API for speech recognition! | |
#Open a file type Wav to speech recognition | |
#This source does not require any external programs to perform audio conversions :-) | |
#http://ederwander.wordpress.com/2011/11/06/accessing-the-google-speech-api-python/ | |
#Eng Eder de Souza |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
def get_white_noise_image(width, height): | |
pil_map = Image.new("RGBA", (width, height), 255) | |
random_grid = map(lambda x: ( | |
int(random.random() * 256), | |
int(random.random() * 256), | |
int(random.random() * 256) | |
), [0] * width * height) | |
pil_map.putdata(random_grid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''A micro-asyncronous script derived from twisted.''' | |
import sys | |
import traceback | |
from collections import deque | |
__all__ = ['Deferred', 'MultiDeferred'] | |
def iterdata(stream): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add a trigger on field "custom_field1" | |
cur_frm.cscript.custom_field1 = function(doc, cdt, cdn) { | |
// update a new field "custom_field3" | |
doc.custom_field3 = flt(doc.custom_field1)*flt(doc.custom_field2)/1000; | |
// refresh in form | |
refresh_field('custom_field3'); | |
} |
OlderNewer