For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
| def run_pg_fouine(): | |
| info = host_info[env.host_string] | |
| db_name = info.tags.get('Name') | |
| sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf') | |
| sudo('/etc/init.d/postgresql reload') | |
| time.sleep(30) | |
| sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf') | |
| sudo('/etc/init.d/postgresql reload') | |
| run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt') | |
| run('gzip -f /tmp/pgfouine.txt') |
| from time import sleep | |
| from tornado.httpserver import HTTPServer | |
| from tornado.ioloop import IOLoop | |
| from tornado.web import Application, asynchronous, RequestHandler | |
| from multiprocessing.pool import ThreadPool | |
| _workers = ThreadPool(10) | |
| def run_background(func, callback, args=(), kwds={}): | |
| def _callback(result): |
| cd ~ | |
| sudo apt-get update | |
| sudo apt-get install unzip curl python-software-properties -y | |
| #sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" | |
| sudo add-apt-repository ppa:ferramroberto/java | |
| sudo apt-get update | |
| sudo apt-get install sun-java6-jre sun-java6-plugin -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz |
| from geventwebsocket.handler import WebSocketHandler | |
| from gevent.pywsgi import WSGIServer | |
| from flask import Flask, request, render_template | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return render_template('index.html') |
| import logging | |
| from tastypie.authentication import Authentication | |
| import oauth2 | |
| from oauth_provider.consts import OAUTH_PARAMETERS_NAMES | |
| from oauth_provider.store import store | |
| from oauth_provider.store import Error as OAuthError | |
| from oauth_provider.utils import get_oauth_request | |
| from oauth_provider.utils import get_oauth_server |
| #!/usr/bin/env python | |
| """ | |
| Use pip to get a list of local packages to check against one or more package | |
| indexes for updated versions. | |
| """ | |
| import sys | |
| import xmlrpclib | |
| import subprocess | |
| from distutils.version import StrictVersion, LooseVersion |
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django.conf import settings | |
| from django.utils.encoding import force_unicode | |
| import redis | |
| class SessionStore(SessionBase): | |
| """ Redis store for sessions""" | |
| def __init__(self, session_key=None): | |
| self.redis = redis.Redis( |
These are field notes gathered during installation of website search facility for the ElasticSearch website.
You may re-use it to put a similar system in place.
The following assumes:
| def queryset_generator(queryset, chunksize=1000): | |
| """ | |
| Iterate over a Django Queryset ordered by the primary key | |
| This method loads a maximum of chunksize (default: 1000) rows in its | |
| memory at the same time while django normally would load all rows in its | |
| memory. Using the iterator() method only causes it to not preload all the | |
| classes. | |
| Note that the implementation of the generator does not support ordered query sets. |