Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| #!/usr/bin/env python | |
| # -*- coding: UTF-8 -*- | |
| #------------------------------------------------------------------------------- | |
| # Name: maskedit.py | |
| # Purpose: | |
| # | |
| # Author: Maxwell Morais ([email protected]) | |
| # | |
| # Created: 10/04/2013 |
| // How to define: | |
| // -------------- | |
| var callableObjectFn = function() { | |
| // Use CallableObject as name in constructor function, but also when setting property below. | |
| var CallableObject = (function(CallableObject) { | |
| return function() { | |
| return CallableObject(); | |
| }; | |
| }(callableObjectFn)); | |
| CallableObject.property = 'value'; |
| //Superseeded: https://gist.github.com/devinrhode2/4705947 | |
| /** | |
| * Keep a histroy array of console log's | |
| * See example at bottom | |
| */ | |
| window.originalConsole = window.console; | |
| window.originalLog = window.console.log; | |
| window.logWithHistory = function logWithHistoryFn() { |
| function exceptionalException(message) { | |
| 'use strict'; | |
| if (exceptionalException.emailErrors !== false) { | |
| exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?'); | |
| } | |
| } | |
| //test | |
| //exceptionalException('try 1!'); | |
| //exceptionalException('try 2!'); |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| // 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'); | |
| } |
| '''A micro-asyncronous script derived from twisted.''' | |
| import sys | |
| import traceback | |
| from collections import deque | |
| __all__ = ['Deferred', 'MultiDeferred'] | |
| def iterdata(stream): |
| 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) |
| # 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 |
| 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', |