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/bash | |
set -e | |
# cd to /vagrant on login | |
if ! grep -q 'cd \/vagrant' /home/vagrant/.bashrc; then | |
echo 'cd /vagrant' >> /home/vagrant/.bashrc | |
fi | |
cd /vagrant |
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
#!/usr/bin/env ruby | |
# Map endpoint names to regexes that match them | |
Endpoints = { | |
'/api/users/{user_id}/count_pending_messages' => /^\/api\/users\/(?<user_id>\d+)\/count_pending_messages$/, | |
'/api/users/{user_id}/get_messages' => /^\/api\/users\/(?<user_id>\d+)\/get_messages$/, | |
'/api/users/{user_id}/get_friends_progress' => /^\/api\/users\/(?<user_id>\d+)\/get_friends_progress$/, | |
'/api/users/{user_id}/get_friends_score' => /^\/api\/users\/(?<user_id>\d+)\/get_friends_score$/, | |
'/api/users/{user_id}' => /^\/api\/users\/(?<user_id>\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
#!/usr/bin/env python | |
import json | |
import yaml | |
def convert(stream): | |
return json.dumps(yaml.load(stream), indent=2) | |
if __name__ == '__main__': | |
import sys |
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 shlex | |
def parse_procfile(filename): | |
""" | |
Return a dict of procfile process names to commands, e.g. | |
{'web': ['python', './manage.py', 'runserver']} | |
""" | |
commands = {} |
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
# Put a document into the index | |
curl -s -XPUT 'localhost:9200/test/doc/1' -d '{ | |
"text": "Search Advanced Search NAVIGATION Home Government in Action Economy Infrastructures Power, Oil & Gas National Security Rule of Law & Good Governance Education Healthcare Delivery Food Security Diplomacy Anti Corruption Politics and Power Environment Other News News Summary Matters of the Moment Photographs Speeches Last Updated: May 11th, 2012 - 16:13:24 Photographs President Goodluck Jonathan at the 2012 World Economic Forum on Africa in Addis Ababa Photographs of President Goodluck Jonathan at the 2012 World Economic Forum on Africa, in Addis Ababa, Ethiopia, May 9 - 11, 2012 May 11, 2012, 14:22 President Goodluck Jonathan in Abidjan for a one-day visit Photograph of President Goodluck Jonathan in Abidjan, Cote d'\''Ivoire, on a one-day visit, on Wednesday, May 9, 2012 May 9, 2012, 20:58 President Goodluck Jonathan at the Presidential workshop on Power President Goodluck Jonathan at the Presidential Workshop on Power |