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
| #!/usr/bin/env python | |
| import httplib, hashlib, json | |
| import feedparser | |
| def index_event(e): | |
| """ Pass the event to ElasticSearch for indexing """ | |
| id = hashlib.md5(e.link).hexdigest() | |
| body = json.dumps({'title': e.title, 'updated': e.updated, | |
| 'summary': e.summary, 'link': e.link}) | |
| connection = httplib.HTTPConnection('127.0.0.1:9200') |
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
| http = require('http'); | |
| querystring = require('querystring'); | |
| sys = require('sys'); | |
| /* Display the index page */ | |
| function showIndex(req, res) { | |
| // Write the static data | |
| res.write('<html>'); | |
| res.write('<h1>local.ch Töggeli Server</h1>'); | |
| res.write('<p>You want to play töggeli? Input your name to add yourself '); |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from random import randrange | |
| def fisher_yates_shuffle(unshuffled, shuffled): | |
| """ | |
| http://en.wikipedia.org/wiki/Fisher-Yates_shuffle#The_modern_algorithm | |
| ...but using recursion instead of counters | |
| """ | |
| if not unshuffled: return shuffled |
NewerOlder