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
| { | |
| "japanese_template": { | |
| "template": "*ja", | |
| "settings": { | |
| "analysis": { | |
| "filter": { | |
| "romaji": { | |
| "type": "kuromoji_readingform", | |
| "use_romaji": true | |
| } |
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
| { | |
| "size": 0, | |
| "query": { | |
| "bool": { | |
| "filter": [{ | |
| "range": { | |
| "created_at": { | |
| "gte": "now-3M", | |
| "lte": "now" | |
| } |
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
| { | |
| "size": 0, | |
| "query": { | |
| "bool": { | |
| "filter": [{ | |
| "range": { | |
| "created_at": { | |
| "gte": "now-1M", | |
| "lte": "now" | |
| } |
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": {"_index": "userkeyword", "_type": "logs"}} | |
| {"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
| {"index": {"_index": "userkeyword", "_type": "logs"}} | |
| {"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
| {"index": {"_index": "userkeyword", "_type": "logs"}} | |
| {"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
| {"index": {"_index": "userkeyword", "_type": "logs"}} | |
| {"keyword": "銀座", "created": "2015-12-18T12:35:00"} | |
| {"index": {"_index": "userkeyword", "_type": "logs"}} | |
| {"keyword": "銀座三越", "created": "2015-12-18T12:35:00"} |
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
| <!-- Add the following lines to theme's html code right before </head> --> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
| <script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
| <script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script> | |
| <!-- | |
| Usage: just add <div class="gist">[gist URL]</div> | |
| Example: <div class="gist">https://gist.github.com/1395926</div> | |
| --> |
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
| def dictsorted(dic, valuesort=False): | |
| if valuesort: | |
| return [(k, v) for k, v in sorted(d.items(), key=lambda x:x[1])] | |
| return [(k, v) for k, v in sorted(d.items())] | |
| if __name__ == '__main__': | |
| d = {'A':500, 'C':300, 'D':100, 'E':400, 'B':200} | |
| print dictsorted(d, False) | |
| print dictsorted(d, True) |
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
| def dictsorted(dic, valuesort=False): | |
| if valuesort: | |
| return [(k, v) for k, v in sorted(d.items(), key=lambda x:x[1])] | |
| return [(k, v) for k, v in sorted(d.items())] | |
| if __name__ == '__main__': | |
| d = {'A':500, 'C':300, 'D':100, 'E':400, 'B':200} | |
| print dictsorted(d, False) | |
| print dictsorted(d, True) |
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
| # -*- coding: utf-8 -*- | |
| from os.path import abspath, dirname, join | |
| PROJECT_PATH = abspath(dirname(__file__)) | |
| DATABASES = { | |
| 'default': { | |
| 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | |
| 'NAME': join(PROJECT_PATH, 'django.db'), # Or path to database file if using sqlite3. | |
| # The following settings are not used with sqlite3: | |
| 'USER': '', |
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
| for i, v in enumerate(['a', 'b', 'c']): | |
| print i, v |
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
| # -*- coding: utf-8 -*- | |
| import hashlib | |
| try: | |
| import cPickle as pickle | |
| except ImportError: | |
| import pickle | |
| class PythonObjectCache(object): | |
| @classmethod |
NewerOlder