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 Log = require("log").Log; | |
var TAG = __file__.getName(); | |
Log.d(TAG, "initializing hello world"); | |
exports.name = 'Hello'; | |
exports.description = 'Hello World'; | |
exports.icon = 'http://example.com/icon.png' |
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
def toBigDecimal(x : java.math.BigDecimal) : BigDecimal = { | |
Option(x) match { | |
case Some(i) => i | |
case None => BigDecimal(-1) | |
} | |
} |
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 pprint | |
def oper(op): | |
def _oper(arg): | |
return {op: arg} | |
return _oper | |
ne = oper('$ne') | |
gt = oper('$gt') |
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 json | |
import base64 | |
import os | |
from argparse import ArgumentParser | |
import getpass | |
import pprint | |
from Crypto.Cipher import AES | |
from Crypto import Random |
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
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "Simple", | |
"Resources" : { | |
"VPC" : { | |
"Type" : "AWS::EC2::VPC", | |
"Properties" : { |
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
class Test(object): | |
''' | |
this is a test object | |
''' | |
pass |
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
class Test(object): | |
''' | |
this is a test object | |
''' | |
x = 1 |
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
page_tags = Table('page_tags', meta.metadata, | |
Column('page_id', Integer, ForeignKey('pages.id'), primary_key=True), | |
Column('tag_id', Integer, ForeignKey('tags.id'), primary_key=True) | |
) | |
class Metadata(AppBase, Base): | |
__tablename__ = 'metadata' | |
id = Column(Integer, primary_key=True) | |
page_id = Column(Integer, ForeignKey('pages.id')) |
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 threading import Thread, BoundedSemaphore | |
class Worker(Thread): | |
def __init__(self, sema, target, args, kwargs): | |
super(Worker, self).__init__() | |
self.sema = sema | |
self.target = target | |
self.args = args | |
self.kwargs = kwargs |
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
# Courtesy of http://norvig.com/python-iaq.html?a | |
class Struct(object): | |
def __init__(self, **kwargs): | |
self.update(kwargs) | |
def update(self, d): | |
self.__dict__.update(d) | |
def __repr__(self): | |
return 'Struct(%s)' % ', '.join('%s=%s' % (k, repr(v)) for (k,v) in vars(self).items()) |
OlderNewer