Skip to content

Instantly share code, notes, and snippets.

View epicserve's full-sized avatar

Brent O'Connor epicserve

View GitHub Profile
{% if is_paginated %}
{% load i18n %}
<ul class="pagination">
<li{% if not page_obj.has_previous %} class="disabled"{% endif %}><a href="{% if not page_obj.has_previous %}#{% else %}?page={{ page_obj.previous_page_number }}{{ getvars }}{% endif %}">&laquo;</a></li>
{% if show_first %}
<li><a href="?page=1{{ getvars }}">1</a></li>
<li><span>...</span></li>
{% endif %}
@claar
claar / nginx.conf
Last active August 29, 2015 14:11
nginx config - FIPS complient, SSL stapling, POODLE mitigation, session caching
##
# Global SSL settings - nginx.conf in http section
##
##
# For additional performance, enable SPDY support for each site by changing the:
#
# listen 443 ssl;
#
# line to:

Git Notes

Good Basic Global Git Config Settings

[color]
    diff = auto
    status = auto
    branch = auto
[user]

name = Your Name

@epicserve
epicserve / postgres-notes.mdown
Created October 9, 2010 22:04
Postgres Notes

Postgres Notes

Controlling Postgres

Start Postgres

$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

Stop Postgres

@timtrueman
timtrueman / django_cached_count_proxy.py
Created November 18, 2010 00:15
Django cached .count() proxy for querysets that is generic and works with pagination in object_list (which clones and overrides any monkeypatched count method so you have to override the clone method first).
class CachedCountCloneProxy(object):
''' This allows us to monkey-patch count() on QuerySets so we can cache it and speed things up.
._clone is called so we have to monkey-patch that first...
'''
def __init__(self, queryset):
self._queryset = queryset
self._queryset._clone_original = self._queryset._clone
def __call__(self):
@epicserve
epicserve / sublime_text_2_notes.md
Created July 27, 2011 15:40
Notes on My Sublime Text 2 Setup

User File Settings

{
    "draw_indent_guides": false,
    "fold_buttons": true,
    "font_face": "Meslo LG S",
    "font_size": 13,
    "highlight_line": true,
    "ignored_packages": [],

"open_files_in_new_window": false,

"""
Author: Jeff Triplett
Based off: https://code.djangoproject.com/wiki/PaginatorTag
Thanks to Brent O'Connor for pointing it out.
"""
from django import template
register = template.Library()
@jefftriplett
jefftriplett / output.txt
Last active October 9, 2015 18:18
uses pip + pypi to see what is upgradeable
$ ./pip.sh outdated
Fabric (1.4.3 != 1.5.1)
gunicorn (0.17.0 != 0.17.2)
$ ./pip.sh install -U gunicorn
Downloading/unpacking gunicorn==0.17.2
Using download cache from /Users/jefftriplett/.pip/download_cache/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fg%2Fgunicorn%2Fgunicorn-0.17.2.tar.gz
Running setup.py egg_info for package gunicorn
Installing collected packages: gunicorn

A Simple Plan of Salvation

Question Scripture
What is sin? [1 John 3:4][1]
Can one sin by doing nothing? [James 4:17][2]
From where does sin come? [Mark 7:20-23][3]
What is the result of sin? [Romans 8:5-8][4]
What has been done about sin? [Romans 5:6-11][5]
@wiredfool
wiredfool / gist:5730478
Created June 7, 2013 16:20
valgrind run.
(et-test)erics@builder-1204-x64:~/et-test/et-issue-example$ valgrind --tool=massif python manage.py generate_all_thumbnail_aliases
==16695== Massif, a heap profiler
==16695== Copyright (C) 2003-2011, and GNU GPL'd, by Nicholas Nethercote
==16695== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==16695== Command: python manage.py generate_all_thumbnail_aliases
==16695==
1; RSS: 142912; Unshared: 0; Obj: 27683
2; RSS: 142912; Unshared: 0; Obj: 27535
3; RSS: 177228; Unshared: 0; Obj: 27563
4; RSS: 177228; Unshared: 0; Obj: 27591