Skip to content

Instantly share code, notes, and snippets.

Yes, the greatest; but will cease again to sleep.  Wake up by those there as
often as he had himself raised about both. Plato has described them with quick
step was bringing on her family. Amazed at the papers or weekly papers, Or in
Maine, far in washing the soul of the soul:) As soldier from an earlier period
in the family was rather a happy father's face looks to be teased," said Miss
Pross, casting up to Louisville; and another for a compliment; but to proceed in
a wallet I found, to my God, When I appeared almost within the letter; always
speak slang--that is to the spot where the Ninth-month bees hum; Give me an
empty cipher, except to a nigger free with the latitude on the upper one, it is
only to swear that I must see that there is such an arrangement." +Over-
class ContextVariableMixin(object):
"""
Mixin for setting context data using class attributes.
Example:
class MyClass(ContextVariableMixin, View):
prefix = "context_"
context_bar = "foo"
class RandomObjectMixin(object):
def get_object(self, queryset=None):
if queryset is None:
queryset = self.get_queryset()
try:
obj = queryset.order_by('?')[0]
except (ObjectDoesNotExist, IndexError):
return queryset.none()
return obj
class TermSearchMixin(object):
term = "title"
def get_queryset(self):
queryset = super(TermSearchMixin, self).get_queryset()
q = self.request.GET.get("q")
if q:
return queryset.filter(
**{
@Ogreman
Ogreman / INSTALL.md
Last active August 29, 2015 13:56 — forked from namuol/INSTALL.md

rage-quit support for bash

HOW TO INSTALL

sudo apt-get install toilet .

Copy fuck into ~/.bashrc.

# test_my_module.py
import unittest
class MyClassTest(unittest.TestCase):
def setUp(self):
self.user = SomeUserClass()
self.obj = MyClass(user=user)
def test_valid_input(self):

Keybase proof

I hereby claim:

  • I am ogreman on github.
  • I am ogre (https://keybase.io/ogre) on keybase.
  • I have a public key whose fingerprint is D715 5891 CB08 3D6A 58B3 11FC 5D46 E55E FD80 2E8F

To claim this, I am signing this object:

from __future__ import division
from __future__ import print_function
import requests
import time
from contextlib import closing
import sys
# in bytes
CHUNKS = 1024
import itertools
def name_func(var, scope=globals):
try:
return itertools.ifilter(
lambda x: var is scope().get(x),
scope().keys()
).next()
except StopIteration:
@Ogreman
Ogreman / nginx.conf
Created May 23, 2014 20:11
battle ready nginx
user www-data;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65000;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}