Skip to content

Instantly share code, notes, and snippets.

View jamstooks's full-sized avatar
🐶

Benjamin W Stookey jamstooks

🐶
  • Bellingham, WA
View GitHub Profile
@jamstooks
jamstooks / chartbeat.py
Created May 29, 2013 20:50
Just a quick tool I put together to output the number of people on a site using the chartbeat api and the python requests library. Useful for GeekTool and other visualization tools.
#!/usr/bin/env python
"""
A quick tool to output the number of people on a site
using the chartbeat api and the python requests library
Useful for GeekTool and other visualization tools
"""
import requests
Traceback (most recent call last):
File "/usr/sbin/xm", line 8, in <module>
from xen.xm import main
File "/usr/src/xen-3.3.0/dist/install/usr/lib64/python/xen/xm/main.py", line 56, in <module>
File "/usr/src/xen-3.3.0/dist/install/usr/lib64/python/xen/util/acmpolicy.py", line 31, in <module>
File "/usr/src/xen-3.3.0/dist/install/usr/lib64/python/xen/util/xsm/acm/acm.py", line 39, in <module>
File "/usr/src/xen-3.3.0/dist/install/usr/lib64/python/xen/xend/XendOptions.py", line 483, in instance
File "/usr/src/xen-3.3.0/dist/install/usr/lib64/python/xen/xend/XendOptions.py", line 139, in __init__
File "/usr/src/xen-3.3.0/dist/install/usr/lib64/python
@jamstooks
jamstooks / gist:1067706
Created July 6, 2011 16:40
Orderable List Mixins
from leaguejam.apps.manage.org.views import OrgContextMixin
from leaguejam.apps.manage.org.participants.forms import ParticipantSearchForm
from django.views.generic.list import ListView, MultipleObjectMixin
from django.views.generic.edit import FormMixin
from django.db.models import Q
import re
class FormMixinGET(FormMixin):
@jamstooks
jamstooks / mixin.py
Created June 9, 2011 21:36
Mixin Class extending Django generic class-based views to provide a persistent custom context. Used mostly for using the request to access an object. Snippet included that uses TemplateWithContextMixin to add the requested org (from /path/to/org) to the t
from django.views.generic.base import TemplateResponseMixin
from django.shortcuts import get_object_or_404
from django.http import Http404
from leaguejam.apps.menus.manage_org import manage_org_menu
from leaguejam.apps.accounts.models import Org
class TemplateWithContextMixin(TemplateResponseMixin):
"""
Class Based view that stores a `custom_context` property that extends