Elasticsearch is an open-source search engine built on top of Apache Lucene™, a full-text search-engine library in Java.
Elasticsearch stores data as JSON documents, making it easy to be used together with MongoDB or CouchBase.
| def remove_empty_fields(data_): | |
| """ | |
| Recursively remove all empty fields from a nested | |
| dict structure. Note, a non-empty field could turn | |
| into an empty one after its children deleted. | |
| E.g, | |
| { | |
| "location": { |
| /* | |
| * Authenticate Django users in node.js. | |
| * | |
| * Django is great for many projects, while node.js does some fantastic | |
| * jobs that Django couldn't. For example, you may have a Django app | |
| * managing your user accounts and another real-time service or application | |
| * running on Node, then you probably will need to read Django user session | |
| * to authenticate users in the Node project. | |
| * | |
| * This gist is not production ready yet, but it demonstrates how could it |
| URL_REGEX = re.compile(r"^(http|https)://.+$") | |
| IP_ADDRESS_V4_REGEX = re.compile(r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}" | |
| r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$") | |
| US_ZIP_REGEX = re.compile(r"\d{5}(\-\d{4})?$") | |
| UK_ZIP_REGEX = re.compile(r"^((GIR ?0AA)|((([A-PR-UWYZ][A-HK-Y]?[0-9][0-9]?)" | |
| r"|(([A-PR-UWYZ][0-9][A-HJKSTUW])" | |
| r"|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRV-Y]))) ?" |
| import UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | |
| // Override point for customization after application launch. | |
| class MyViewController: UIViewController { | |
| var scrollView = UIScrollView.newAutoLayoutView() | |
| var contentView = UIView.newAutoLayoutView() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| view.addSubview(scrollView) | |
| scrollView.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsetsZero) |
| import sys | |
| from boto.ec2 import connect_to_region | |
| from datetime import datetime, timedelta | |
| try: | |
| days = int(sys.argv[1]) | |
| except IndexError: | |
| days = 7 |
| aws s3 ls | awk '{print $3}' | while read -r bucket; do aws s3 rb "s3://$bucket" --force ; done |