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 timeit | |
sorted_setup = """ | |
a = range(1000000) | |
""" | |
unsorted_setup = """ | |
from random import shuffle | |
{} | |
shuffle(a) |
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
$ http --verbose --form GET http://www.esvapi.org/v2/rest/readingPlanInfo key==IP reading-plan==bcp | |
GET /v2/rest/readingPlanInfo?key=IP&reading-plan=bcp HTTP/1.1 | |
Accept: */* | |
Accept-Encoding: gzip, deflate, compress | |
Content-Length: 0 | |
Content-Type: application/x-www-form-urlencoded; charset=utf-8 | |
Host: www.esvapi.org | |
User-Agent: HTTPie/0.4.1 |
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
In [33]: msgpack_lt, pickle_lt, marshal_lt | |
Out[33]: (0.004015207290649414, 0.039834022521972656, 0.007205963134765625) | |
In [34]: msgpack_dt, pickle_dt, marshal_dt | |
Out[34]: (0.015387773513793945, 0.04079103469848633, 0.006851911544799805) | |
In [35]: len(s_msgpack), len(s_pickle), len(s_marshal) | |
Out[35]: (16, 48, 41) |
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
var Lock = Backbone.Model.extend({ | |
initialize: function () { | |
this._queue = []; | |
this.set('_locked', false); | |
this.on('change:_locked', this._on_change_lock, this); | |
}, | |
_on_change_lock: function (m, locked) { | |
if (!locked && this._queue.length) { | |
var d = this._queue.shift(); |
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
/*global Backbone:false, $:false, _:false, extend:false */ | |
// Copyright (c) 2012, David Eyk for Good News Publishers | |
// All rights reserved. | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions | |
// are met: | |
// Redistributions of source code must retain the above copyright | |
// notice, this list of conditions and the following disclaimer. |
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
base_url = 'http://nymkit.com/generators/chatterbots/gort/' | |
module.exports = (robot) -> | |
robot.catchAll (msg) -> | |
if msg.message.text.match(/\bgort\b/i) or msg.message.text.match(/\n/) | |
# When addressed, I'll pull something out of my... sock | |
# drawer. Or, if it's a multi-line message, I'll add my | |
# two cents. | |
json_params = | |
name: 'gort' |
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
*.pyc | |
bin/ | |
include/ | |
lib/ |
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
In [4]: u.password | |
Out[4]: u'crypt$MNVY.9ajgdvDQ$MNVY.9ajgdvDQ' | |
In [5]: u.check_password('foo') | |
--------------------------------------------------------------------------- | |
ValueError Traceback (most recent call last) | |
.../lib/python2.7/site-packages/django_extensions/management/commands/shell_plus.pyc in <module>() | |
----> 1 u.check_password('foo') | |
.../src/passlib/passlib/ext/django/utils.pyc in check_password(user, raw_password) |
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 time | |
import re | |
from django.test import TestCase | |
from django.test.client import Client | |
from django.contrib.auth.models import User | |
from oauth_provider.models import Resource, Consumer | |
from oauth_provider.models import Token |
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 | |
# -*- coding: utf-8 -*- | |
"""nginx_error_rate -- Munin plugin to report the error rate in an access log. | |
The access log defaults to `/var/log/nginx/access.log`. This may be | |
customized with the following stanza in your munin plugin conf: | |
[nginx_error_rate] | |
env.access_log /path/to/access.log | |
""" |