Skip to content

Instantly share code, notes, and snippets.

View mick's full-sized avatar

Mick Thompson mick

View GitHub Profile
@mick
mick / gist:752349
Created December 23, 2010 00:11
siege results 2
Transactions: 5000 hits
Availability: 100.00 %
Elapsed time: 67.20 secs
Data transferred: 43.10 MB
Response time: 0.12 secs
Transaction rate: 74.40 trans/sec
Throughput: 0.64 MB/sec
Concurrency: 9.16
Successful transactions: 5000
Failed transactions: 0
@mick
mick / gist:752353
Created December 23, 2010 00:17
simple cache
if((couchcache["popular-"+page])&&(couchcache["popular-"+page].timesaved > (Date.now() - 60000))){
res.send(couchcache["popular-"+page].docs);
}else{
//...get doc...
if(page < 10){
couchcache["popular-"+page]={"timesaved":Date.now(),"docs":docs};
}
}
twistd -noy punjab.tac
/usr/local/lib/python2.6/dist-packages/punjab/httpb.py:16: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha, time
/usr/local/lib/python2.6/dist-packages/punjab/session.py:18: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
2011-02-28 16:09:00+0000 [-] Log opened.
2011-02-28 16:09:00+0000 [-] twistd 10.2.0 (/usr/bin/python 2.6.5) starting up.
2011-02-28 16:09:00+0000 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2011-02-28 16:09:00+0000 [-] twisted.web.server.Site starting on 5280
2011-02-28 16:09:00+0000 [-] Starting factory <twisted.web.server.Site instance at 0xb704354c>
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="guid"
t3st15
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="count"
2
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="userid"
"""HTTP/1.1 client library
<intro stuff goes here>
<other stuff, too>
HTTPConnection goes through a number of "states", which define when a client
may legally make another request or fetch the response for a particular
request. This diagram details these state transitions:
(null)
@mick
mick / gist:1189405
Created September 2, 2011 18:28 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Web Developer at occipital.com
Favorite Python project: graphite
Favorite Conference: OSCON.
Python Experience Level: Advanced. 5yr+
@mick
mick / gist:1218084
Created September 14, 2011 23:17
slide gists
{
"_id": "_design/gc-utils",
"_rev": "2-bd8fcdf5509cb9cc99560a39f0c642f0",
"vendor": {
"clustering": {
"KNNCluster": "/**\n * kNN-based Clustering\n */\n(function() {\n\tvar cluster = this.cluster = {};\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = cluster;\n\t}\n\t\n\t//TODO\n})();",
"ProximityCluster": "/**\n * Proximity based clustering\n */\n(function() {\n\n var proxcluster = this.proxcluster = {};\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = proxcluster;\n\t}\n\n var gju = require('vendor/geojson-js-utils/geojson-utils');\n\n proxcluster.PointCluster = function(threshold){\n this.clusters = [];\n this.points = [];\n this.distanceThreshold = threshold;\n\n };\n \n proxcluster.PointCluster.prototype.addToClosestCluster = function(point) {\n var distance = 40000; // Some large number\n var clusterToAddTo = null;\n var pos = point.geometry;\n
@mick
mick / steps.js
Created March 27, 2012 22:46
spark like steps for a given array
var list = [1,45,23,45,65,6,2];
var steps = 6;
var packed_list = [];
var min=0, max=0;
for(l in list){
if(min > list[l])
min = list[l];
@mick
mick / gist:2221357
Created March 27, 2012 23:16
subscription with bounds
<iq type='set'
from='admin@talkback.im'
to='geo.talkback.im'
id='sub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe
node='test'
jid='admin@talkback.im'/>
<options node='test' jid='admin@talkback.im'>
<x xmlns='jabber:x:data' type='submit'>
@mick
mick / geos-config
Created June 20, 2012 04:10
geos config
#!/bin/sh
prefix=/app/.geo/geos
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
usage()
{
cat <<EOF
Usage: geos-config [OPTIONS]
Options: