Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| #!/bin/bash | |
| usage () | |
| { | |
| cat <<UsageHERE | |
| boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host | |
| Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT | |
| or boot2docker-fwd -d RULE_NAME | |
| or boot2docker-fwd -l | |
| or boot2docker-fwd -A |
| from django.conf.urls import patterns, include, url | |
| from django.contrib.auth.decorators import login_required | |
| from django.contrib.admin.views.decorators import staff_member_required | |
| from django.contrib import admin | |
| from application.views import ApplicationFormView, ApplicationListView | |
| admin.autodiscover() | |
| urlpatterns = patterns('', |
| # Call virtualenvwrapper's "workon" if .venv exists. This is modified from-- | |
| # http://justinlilly.com/python/virtualenv_wrapper_helper.html | |
| # which is linked from-- | |
| # http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory | |
| check_virtualenv() { | |
| if [ -e .venv ]; then | |
| env=`cat .venv` | |
| if [ "$env" != "${VIRTUAL_ENV##*/}" ]; then | |
| echo "Found .venv in directory. Calling: workon ${env}" | |
| workon $env |
| # Call virtualenvwrapper's "workon" if .venv exists. This is modified from-- | |
| # http://justinlilly.com/python/virtualenv_wrapper_helper.html | |
| # which is linked from-- | |
| # http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory | |
| check_virtualenv() { | |
| if [ -e .venv ]; then | |
| env=`cat .venv` | |
| echo "Found .venv in directory. Calling: workon ${env}" | |
| workon $env | |
| fi |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| __author__ = 'archeg' | |
| import httplib | |
| import urllib | |
| import urllib2 | |
| import re | |
| def URLRequest(url, params, headers, method="GET"): | |
| if method == "POST": |
| # admin.py: admin action definition | |
| def make_copy(self, request, queryset): | |
| form = None | |
| if 'apply' in request.POST: | |
| form = CopyPageForm(request.POST) | |
| if form.is_valid(): | |
| issue = form.cleaned_data['issue'] |
| ''' | |
| This code is an example of Flask-SuperAdmin app with basic authentication. Use it for anything you like. | |
| Based on this snippet: http://flask.pocoo.org/snippets/8/ | |
| ''' | |
| import flask | |
| from flask.ext.superadmin import Admin, expose, AdminIndexView as _AdminIndexView | |
| from flask.ext.superadmin.model import ModelAdmin as _ModelAdmin | |
| from flask.ext.sqlalchemy import SQLAlchemy |
| == PostgreSQL | |
| Braintree | |
| * https://www.braintreepayments.com/braintrust/scaling-postgresql-at-braintree-four-years-of-evolution | |
| * http://www.databasesoup.com/2012/04/sharding-postgres-with-instagram.html | |
| * http://media.postgresql.org/sfpug/instagram_sfpug.pdf | |
| * http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram#_=_ | |
| * http://instagram-engineering.tumblr.com/post/40781627982/handling-growth-with-postgres-5-tips-from-instagram |
| define([ | |
| 'jquery', | |
| 'underscore', | |
| 'app/app', | |
| 'jquery.handsontable', | |
| 'moment', | |
| 'jquery.tools' | |
| ], function($, _, app, Handsontable, moment) { |