This file contains hidden or 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 peewee import * | |
| from models import News, database | |
| compiler = database.get_compiler() | |
| print(News.select().where(News.url == 'test').sql(compiler)) |
This file contains hidden or 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 sys | |
| import os | |
| import time | |
| MAX_INTERVAL = 1.0 | |
| class Poller: | |
| def __init__(self, files): |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <string.h> | |
| #include "groonga.h" | |
| static void execute_gql(grn_ctx *ctx, char *gql, int len) | |
| { | |
| unsigned int result_size; | |
| char *result = NULL; |
This file contains hidden or 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 groongaql import Context, ENC_DEFAULT, SUCCESS | |
| """groongaql test scrip | |
| 1. groonga -s | |
| 2. python script.py | |
| """ | |
| def main(): | |
| ctx = Context(flags=0, encoding=ENC_DEFAULT) |
This file contains hidden or 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 sys | |
| from base64 import encodestring | |
| with open(sys.argv[1]) as f: # argv[1] is 'xx.png' | |
| print encodestring(f.read()) |
This file contains hidden or 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 pgmagick | |
| import time | |
| # fast read | |
| b = time.time() | |
| img = pgmagick.Image(pgmagick.Blob(open('org.jpg').read()), pgmagick.Geometry(180, 120)) | |
| img.scale('180x120') | |
| img.write('t.jpg') | |
| print time.time() - b |
This file contains hidden or 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 pgmagick import Image | |
| from pgmagick import CompositeOperator as co | |
| img_a = Image('a.jpg') | |
| img_b = Image('b.jpg') | |
| img_c = Image('c.jpg') | |
| print img_a.compare(img_b) | |
| print img_a.compare(img_c) |
This file contains hidden or 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
| Index: grin.py | |
| =================================================================== | |
| --- grin.py (revision 80) | |
| +++ grin.py (working copy) | |
| @@ -762,6 +762,8 @@ | |
| help="show program's version number and exit") | |
| parser.add_argument('-i', '--ignore-case', action='append_const', | |
| dest='re_flags', const=re.I, default=[], help="ignore case in the regex") | |
| + parser.add_argument('-w', '--word-regexp', action='store_true', default=False, | |
| + dest='is_matchword', help="force regex to match only whole words") |
NewerOlder