This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WorkEditView(DetailDisplayView, ModelFormMixin): | |
"""Shows the edit page for a work.""" | |
get_object = user_check("user_can_edit")(DetailDisplayView.get_object) | |
queryset = Work.objects.all() | |
template_resource_name = "work" | |
template_name = 'artists/work_edit.html' | |
def get(self, request, *args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Restpose search server" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
script | |
/usr/bin/setuidgid restpose /usr/bin/restpose -p 7777 -d /var/lib/restpose >> /var/log/restpose.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Some simple filters | |
* `user_can`, which filters an object taking a string | |
parameter, returning True or False depending on whether the current | |
user "can" do the action in the parameter. This is done by calling | |
`user_can_<action>` on the object. | |
Anonymous users always return `False`. | |
* `user_has`, which pulls the result of the `user_has_<feature>()`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
import cPickle | |
from django.conf import settings | |
# shamelessly stolen from | |
# http://wiki.python.org/moin/PythonDecoratorLibrary?action=recall&rev=111#Memoize | |
class memoize(object): | |
'''Decorator. Caches a function's return value each time it is called. | |
If called later with the same arguments, the cached value is returned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- python-mode -*- | |
import datetime | |
import sys | |
import os | |
import os.path | |
if os.path.isdir('/home/af-web/releases/current'): | |
# live |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- python-mode -*- | |
import sys | |
import redis | |
c = redis.Redis() # if you need a password or to monitor non-defaults... | |
# We draw a number of graphs: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- python-mode -*- | |
import boto.ec2.elb | |
import sys | |
elbs = [ 'my_elb' ] # or whatever | |
AWS_ACCESS_KEY_ID = '' # fill this out! | |
AWS_SECRET_ACCESS_KEY = '' # this too! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tests = [ | |
([-7, 1, 5, 2, -4, 3, 0], [3,6]), | |
([1, 2, 3, 4, 3, 2, 1], [3]), | |
([99, 0, 66, 32, 1] , [1]), | |
([1, -1, 1, -1, 1, -1, 1], [0,1,2,3,4,5,6]), | |
([0,0,0], [0,1,2]), | |
([0,53,9], -1), | |
([0,1,-1], [0]), | |
([-1, 0, 1], -1), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var menuOpen = false; | |
$('.hamburger').click(function(){ | |
if( menuOpen ) { | |
menuOpen = false; | |
$('#header ul').slideUp(function() { | |
$('#header ul').removeAttr("style"); | |
}); | |
} else { | |
menuOpen = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make[2]: Entering directory `/media/fort/7e6babdb-eb0b-4e79-b97e-cab980e57e92/wikipedia/restpose/restpose' | |
/bin/bash ./libtool --tag=CXX --mode=link g++ -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Wshadow -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-self -Wlogical-op -Wmissing-declarations -g -O2 -o restpose src/restpose.o libmongoimporter.a libhttpserver.a librest.a libfeatures.a libserver.a libjsonxapian.a libjsonmanip.a libngramcat.a libcjktokenizer.a liblogger.a libdbgroup.a libutils.a libpostingsources.a libmatchspies.a libgeospatial.a libxapiancommon.a libmongocdriver.a libcli.a libjsoncpp.a libs/libmicrohttpd/src/daemon/libmicrohttpd.la -lxapian | |
libtool: link: g++ -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Wshadow -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-s |
OlderNewer