Skip to content

Instantly share code, notes, and snippets.

View tourist's full-sized avatar

Michał Oleniec tourist

View GitHub Profile
@tourist
tourist / maintenance.html
Last active August 29, 2015 14:26 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page (mobile friendly)
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 20px; }
@media (min-width: 768px){
body{ padding-top: 150px; }
}
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; max-width: 650px; margin: 0 auto; }
@tourist
tourist / ssh tunneling.md
Last active August 29, 2015 14:26 — forked from mhulse/ssh tunneling.md
SSH Tunneling: Map port from remote machine to your local machine so you can work from the remote DB (example using Django DB settings)...

SSH Tunneling

  1. In your local_settings.py file:

    DATABASES = {
    	'default': {
    		'ENGINE': 'django.db.backends.postgresql_psycopg2',
    		'NAME': 'django_%s' % (PROJECT_NAME,),
    

'USER': xxxx,

@tourist
tourist / gulpfile.js
Last active August 29, 2015 14:24 — forked from mlouro/gulpfile.js
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');
@tourist
tourist / sitecache.py
Created March 20, 2012 16:00 — forked from Ciantic/sitecache.py
My Site object cache
"""Cache of Site related settings
Site IDs and urlconfs are such that are testd on *all* requests thus they need
to be cached.
"""
from django.conf import settings
from django.contrib.sites.models import Site
@tourist
tourist / multisitedmiddleware.py
Created March 20, 2012 15:59 — forked from Ciantic/multisitedmiddleware.py
MultiSitedMiddleware
"""Allows serving multiple sites per Django instance
"""
from django.utils.cache import patch_vary_headers
from sitecache import get_site_id, get_urlconf
class MultiSitedMiddleware:
@tourist
tourist / Reviewing profiles
Created June 9, 2011 23:59 — forked from mmalone/Reviewing profiles
Replacement Django runserver command that does profiling... because I've rewritten this too many times.
>>> import pstats
>>> p = pstats.Stats('p.1258156459.52174278XcQE.prof')
>>> p.strip_dirs().sort_stats(-1).print_stats(5)
Fri Nov 13 15:54:20 2009 p.1258156459.52174278XcQE.prof
124278 function calls (122386 primitive calls) in 0.589 CPU seconds
Ordered by: standard name
List reduced from 1014 to 5 due to restriction <5>