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
""" | |
My dependency injection framework for Python. Using a context manager it allows | |
you to rewrite globals (such as imports, top-level classes and functions, whatever | |
you want) in a module and have them replaced at the end of the with block. This is | |
usually enough. `proxy` is just a dict-wrapping type class which will create a | |
type with "class variables" for every key you give it. | |
Usage: | |
from di import * | |
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
@interface NSString (WordTruncation) | |
- (NSString *)substringOfHTMLToWordIndex:(NSUInteger)to appendOnTruncate:(NSString *)append softLimit:(int)leSoftLimit; | |
- (NSString *)substringToWordIndex:(NSUInteger)to; | |
@end |
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) 2010-2013 Samuel Sutch [[email protected]] | |
# | |
#Permission is hereby granted, free of charge, to any person obtaining a copy | |
#of this software and associated documentation files (the "Software"), to deal | |
#in the Software without restriction, including without limitation the rights | |
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
#copies of the Software, and to permit persons to whom the Software is | |
#furnished to do so, subject to the following conditions: | |
# | |
#The above copyright notice and this permission notice shall be included in |
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 collections import namedtuple | |
from magickwand.image import Image | |
Size = namedtuple('Size', ['width','height']) | |
Point = namedtuple('Point', ['x','y']) | |
Rect = namedtuple('Rect', ['origin', 'size']) | |
class ResizeMethods: |
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
ass |
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/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
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
stream_columnfamily = pycassa.ColumnFamily(pool, 'Stream', autopack_names=True, autopack_values=False, | |
read_consistency_level=pycassa.ConsistencyLevel.ONE, | |
write_consistency_level=pycassa.ConsistencyLevel.QUORUM) |
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
key = self.stream_key + '/' + last | |
column = {object_id: object_type} | |
print 'column', column | |
return self.batch.insert(key, column) |
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
stream/public 1.545907 | |
stream/public 0.820901 | |
stream/public 0.607766 | |
stream/public 1.033473 | |
stream/public 0.821086 | |
stream/public 0.597097 | |
stream/public 0.600137 | |
stream/public 0.653457 | |
stream/public 0.587955 | |
stream/public 0.618521 |
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
## ON EC-2 0.8.4 | |
## java version "1.6.0_20" | |
## OpenJDK Runtime Environment (IcedTea6 1.9.8) (amazon-52.1.9.8.34.amzn1-x86_64) | |
## OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode) | |
>>> import api.cass | |
>>> s=api.cass.Stream(-1,'Public') | |
>>> x,y=s.get() | |
>>> t=[_[0] for _ in y] | |
>>> t == sorted(t) | |
False |
OlderNewer