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 random import choice | |
| MALE_NAMES_FILE = 'dist.male.first' | |
| FEMALE_NAMES_FILE = 'dist.female.first' | |
| LAST_NAMES_FILE = 'dist.all.last' | |
| if __name__ == '__main__': | |
| MALE_NAMES = list(line.split()[0] for line in open(MALE_NAMES_FILE)) | |
| FEMALE_NAMES = list(line.split()[0] for line in open(FEMALE_NAMES_FILE)) | |
| LAST_NAMES = list(line.split()[0] for line in open(LAST_NAMES_FILE)) |
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 tornado.httpserver | |
| import tornado.ioloop | |
| import tornado.options | |
| import tornado.web | |
| import tornado.wsgi | |
| from tornado.options import define, options | |
| define("port", default=8888, help="run on the given port", type=int) |
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 -*- | |
| def getitem(l, index, default=None): | |
| """Returns value of index or default""" | |
| try: | |
| return l[index] | |
| except IndexError: | |
| return 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
| #!/usr/bin/env python | |
| # Needs php and java in executable path | |
| B64=""" | |
| UEsDBBQAAAAIAIVyUjx/yWgsbQIAAP0CAAAHABwAcHJvYmxlbVVUCQADeTB9S3ow | |
| fUt1eAsAAQToAwAABOgDAAAdUsmumlAA3fcrGtNFX1zABblgXm2jOACXSRBEY9Jc | |
| 5knmSb6+vi7OkJyzO+fXnx8T6W4WrB3LbiuOBxXMfNRNW8Wn9NipMa4QbVv8MQVL | |
| 05STYRfqADEysKpWFm/3mViqu5EtXlzGPVl6zauMly7vUNt3S9ji1LESwdn63jCN | |
| DZkNHrzCc78lb8/mucZtFFM45ckrs1XnmtOYo34WENfnXkzC9vQ6s3sJEpCifalp | |
| BtvFDjI50bJunpHhegTuhAKuKsh49uGhN9tXPJpkNxknpCaHjgoxivp4MNg4YQSG | |
| V+K8IXs3KvSzK2IcaJOxvWny89ztEn66vIpYcNpw1jnkr7CplWUCGGNneZ0Y3mdK |
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 smtplib | |
| gmail_account = '[email protected]' | |
| gmail_pass = 'misuperpass' | |
| to_emails = ['[email protected]'] | |
| message = """From: %s | |
| To: %s | |
| Subject: python rulz! |
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
| var tcp = require('tcp'); | |
| var sys = require('sys'); | |
| var count = 0; | |
| var connected_callback = function(conn, name) { | |
| return function() { | |
| count++; | |
| sys.debug("Connected " + name); | |
| conn.send("GET / HTTP/1.1\r\n"); |
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
| var sys = require('sys'), | |
| http = require('http'), | |
| b64 = require('./base64'), | |
| query = require('querystring') | |
| // Creates a streaming connection with twitter, and pushes any incoming | |
| // statuses to a tweet event. | |
| var TwitterNode = exports.TwitterNode = function(options) { | |
| if(!options) options = {} | |
| this.port = options.port || 80 |
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
| var TwitterNode = require('./lib').TwitterNode; | |
| var sys = require('sys'); | |
| var twit = new TwitterNode({ | |
| user: 'tuitersbolivia' | |
| , password: 'asdf' | |
| }); | |
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
| rho@ubuntuhh:~/projects/nodejs/twitter-node$ node stream.js | |
| DEBUG: GET /1/statuses/sample.json | |
| DEBUG: Tweet Rate: 0.0 tweet/sec | |
| DEBUG: Memory Usage: 5.55M | |
| DEBUG: Tweet Rate: 9.0 tweet/sec | |
| DEBUG: Memory Usage: 6.22M | |
| DEBUG: Tweet Rate: 8.2 tweet/sec | |
| DEBUG: Memory Usage: 6.87M | |
| DEBUG: Tweet Rate: 8.2 tweet/sec | |
| DEBUG: Memory Usage: 7.55M |
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 test_callable(response): | |
| pass | |
| def capitalize_urls(urls): | |
| for url in urls: | |
| yield url.upper() | |
| class TesSpider(UrlSpider): |