Skip to content

Instantly share code, notes, and snippets.

View dokipen's full-sized avatar
🤪

Bob Corsaro dokipen

🤪
  • Medium.com
  • Newburyport, MA
View GitHub Profile
class ResponseHandler:
def __init__(callback):
self.counter = 0
self.callback = callback
def start:
self.counter += 1 # lock
def _on_response:
@dokipen
dokipen / manifest.json
Created September 1, 2011 18:26
Google Plus Chrome App
{
"name": "Google+",
"description": "Google Plus",
"version": "1.0",
"icons": {
"128": "128.png"
},
"app": {
"urls": [
"https://plus.google.com/"
$ mkdir ~/src/google_plus
$ vim ~/src/google_plus/manifest.json
@dokipen
dokipen / gist:1230045
Created September 20, 2011 19:20
oops
09-20 19:19:11 ERROR log.error:36 - -*- settings.PLAN_FEATURES -*-
09-20 19:19:11 ERROR log.error:36 - {None: ['oembed', 'preview', 'objectify', 'objectify_two', 'iframe', 'safe-browse', 'analytics', 'mobile', 'email-support', 'no-strict', 'feature_info', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two', u'oembed', u'preview', u'objectify', u'objectify_two
@dokipen
dokipen / pseudo.py
Created November 7, 2011 20:59
Proclog Psuedo Code
def process(log):
api_key, urls, status = parse(log)
if status in (200,404):
rounded_timestamp = round(log.timestamp)
url_ids = hash_urls(urls)
customer_id = get_customer_id(api_key)
zkey = "hourly::$customer_id::$rounded_timestamp"
# Cassandra YAML generated from previous config
# Configuration wiki: http://wiki.apache.org/cassandra/StorageConfiguration
cluster_name: 'x Cluster'
auto_bootstrap: true
binary_memtable_throughput_in_mb: 256
authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
column_index_size_in_kb: 128
commitlog_directory: /var/lib/cassandra/commitlog
commitlog_rotation_threshold_in_mb: 128
0 98176 46 8795688 30 8795688 30 str
1 49763 23 4389216 15 13184904 45 tuple
2 6009 3 3188952 11 16373856 56 dict (no owner)
3 779 0 1870856 6 18244712 62 dict of module
4 12633 6 1515960 5 19760672 67 types.CodeType
5 1650 1 1487032 5 21247704 72 type
6 12277 6 1473240 5 22720944 77 function
7 1649 1 1140632 4 23861576 81 dict of type
8 662 0 725264 2 24586840 84 dict of class
9 3334 2 642096 2 25228936 86 list
#!/usr/bin/python
import os
import tempfile
import tornado.httpclient
import tornado.curl_httpclient
import tornado.ioloop
class HttpDownload(object):
def __init__(self, url, ioloop):
import requests
import sys
for i in range(1,10000):
response = requests.post('http://apply.embed.ly/1', data={'answer': str(i)})
if response.status_code == 302:
print i
sys.exit(0)
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
worker_rlimit_nofile 20240;
events {
worker_connections 20240;
use epoll;