A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
# General | |
http_port 3130 | |
http_port 3128 intercept | |
https_port 3129 intercept ssl-bump cert=/etc/squid/ssl_cert/srtpl.pem generate-host-certificates=on dynamic_cert_mem_cache_size=4MB | |
acl DiscoverSNIHost at_step SslBump1 | |
acl NoSSLIntercept ssl::server_name_regex -i "/etc/squid/url.nobump" | |
ssl_bump splice NoSSLIntercept | |
ssl_bump peek DiscoverSNIHost |
# import config. | |
# You can change the default config with `make cnf="config_special.env" build` | |
cnf ?= config.env | |
include $(cnf) | |
export $(shell sed 's/=.*//' $(cnf)) | |
# import deploy config | |
# You can change the default deploy config with `make cnf="deploy_special.env" release` | |
dpl ?= deploy.env | |
include $(dpl) |
<?php | |
// Licence: WTFPL ! http://www.wtfpl.net/about/ | |
$fbAuth = array("facebook_id" => "123456789", "facebook_token" => "<Use charles proxy to do man-in-middle SSL sniffing and extract fb token>"); | |
// Do the magic. | |
$tinderToken = tinderCall("auth", "token", $fbAuth); // Authenticate | |
$authToken = "X-Auth-Token: $tinderToken\r\nAuthorization: Token token=\"$tinderToken\"\r\n"; |
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
/* | |
* This script will download a package (and all of its dependencies) from the | |
* online NPM registry, then create a gzip'd tarball containing that package | |
* and all of its dependencies. This archive can then be copied to a machine | |
* without internet access and installed using npm. | |
* | |
* The idea is pretty simple: | |
* - npm install [package] | |
* - rewrite [package]/package.json to copy dependencies to bundleDependencies | |
* - npm pack [package] |
#!/usr/bin/env python | |
''' | |
Mocking Httpclient and AsyncHttpclient in Tornado Server | |
''' | |
import unittest | |
import urllib | |
import tornado.gen | |
import tornado.ioloop | |
import tornado.web |
from tornado.web import asynchronous, RequestHandler, Application | |
from tornado import gen | |
from tornado.testing import AsyncHTTPTestCase, gen_test | |
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPResponse | |
from mock import patch, Mock | |
from tornado.concurrent import Future | |
import StringIO | |
class FooHandler(RequestHandler): |
var Sequelize = require('sequelize') | |
, sequelize = new Sequelize('sequelize_test', 'root', null, { | |
logging: false | |
}) | |
var Project = sequelize.define('project', { | |
name: Sequelize.STRING | |
}) | |
var Task = sequelize.define('task', { |
#!/bin/bash | |
# nexusdeb builds a debian package of the Nexus repository manager. nexusdeb | |
# downloads nexus by itself. You run it by | |
# nexusdeb.sh <version> <maintainer> | |
# Example: | |
# nexusdeb.sh 2.0.5 "Denny Colt <[email protected]>" | |
# | |
# The script has been tested with version 2.0.5. | |
if [ -z $1 ] |