Skip to content

Instantly share code, notes, and snippets.

View mythmon's full-sized avatar

Michael Cooper mythmon

View GitHub Profile
# My added stuff
base.MIDDLEWARE_CLASSES = get_middleware(
exclude=(),
append=(
'debug_toolbar.middleware.DebugToolbarMiddleware',
))
base.INSTALLED_APPS = get_apps(
exclude=(),
append=(
'debug_toolbar',
>>> from fjord.feedback.models import Simple, SimpleIndex
>>> s = Simple(happy=True, description="Test for unindexing.")
>>> S = SimpleIndex.search
>>> s.save()
>>> s.id
1533L
>>> S().filter(id=s.id).values_dict()
[{u'prodchan': u'', u'platform': u'', u'description': u'Test for unindexing.', u'created': datetime.datetime(2012, 9, 19, 11, 44, 2), u'locale': u'', u'url': u'', u'browser_version': u'', u'user_agent': u'', u'browser': u'', u'id': 1533, u'happy': True}]
>>> SimpleIndex.unindex(s.id)
Traceback (most recent call last):
Traceback (most recent call last):
File "/home/mythmon/src/fjord/vendor/lib/python/celery/execute/trace.py", line 34, in trace
return cls(states.SUCCESS, retval=fun(*args, **kwargs))
File "/home/mythmon/src/fjord/vendor/lib/python/celery/task/base.py", line 248, in __call__
return self.run(*args, **kwargs)
File "/home/mythmon/src/fjord/vendor/lib/python/celery/decorators.py", line 52, in run
return fun(*args, **kwargs)
File "/home/mythmon/src/fjord/fjord/search/tasks.py", line 66, in index_item_task
doc = mapping_type.extract_document(item_id)
File "/home/mythmon/src/fjord/fjord/feedback/models.py", line 89, in extract_document
@mythmon
mythmon / magic.py
Created September 11, 2012 20:50
Oh no, why would you ever do this?
>>> class Foo(object):
... def __getattr__(self, name):
... if name.startswith("magic_"):
... rest = name[6:]
... def m():
... return rest
... return m
... else:
... return self.__getattribute__(name)
...
@mythmon
mythmon / panel.sh
Created September 7, 2012 17:29
My pokemans
#!/bin/bash
########## ARGS ##########
monitor=${1:-0}
########## OPTIONS ##########
panel_height=15
font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
bgcolor=$(herbstclient get frame_border_normal_color)
selbg=$(herbstclient get window_border_active_color)
@mythmon
mythmon / autostart
Created August 7, 2012 21:18
Herbstluftwm configs
#!/bin/bash
# this is a simple config for herbstluftwm
function hc() {
herbstclient "$@"
}
# Add location of autostart file to path
BASE="$(dirname $0)"
*background: black
*foreground: grey
*scrollBar: false
*cursorBlink: true
*imLocale: en_US.utf8
*termName: screen-256color-bce
*fading: 10
! Fake transparency
*inheritPixmap: true
#!/bin/bash
# wrapper script for post-recieve
enabled_hooks="$(git config hooks.enabled)"
hooks_path="/usr/local/share/git/hooks/"
if [ -n "${enabled_hooks}" ] ; then
read input
# change separate to comma
OLDIFS="$IFS"
##### modules/foo/manifests/init.pp
class foo {
if $operatingsystem == "Fedora" {
include repos::rpmfusion
} else {
include repos::foo
}
package { "foo":
@mythmon
mythmon / post-receive
Created March 27, 2012 06:07
The post-receive hook that allows to selectively run git hooks.
#!/bin/bash
# wrapper script for post-recieve
enabled_hooks="$(git config hooks.enabled)"
hooks_path="/usr/local/share/git/hooks/"
if [ -n "${enabled_hooks}" ] ; then
# change separate to comma
OLDIFS="$IFS"
IFS=","