Skip to content

Instantly share code, notes, and snippets.

View joshourisman's full-sized avatar

Josh Ourisman joshourisman

View GitHub Profile
==> make swig-pl
/bin/sh /private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/libtool --tag=CC --silent --mode=compile /usr/bin/cc -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -O3 -march=nocona -mfpmath=sse -w -pipe -Wall -DNDEBUG -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/subversion -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/subversion/include -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/subversion/bindings/swig -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/subversion/bindings/swig/include -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/subversion/bindings/swig/proxy -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/subversion/bindings/swig/proxy -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/apr/include -I/private/tmp/homebrew-subversion-1.6.12-iBiI/subversion-1.6.12/apr-util/include -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing
#!/usr/bin/env python
def search(array, term):
print "searching for %d in %s" % (term, array)
length = len(array)
if length == 1:
if array[0] == term:
print "Found %s in %s." % (term, array)
return True
else:
diff --git a/configure b/configure
old mode 100755
new mode 100644
index a9d0402..29cf71d
--- a/configure
+++ b/configure
@@ -6033,7 +6033,7 @@ echo $ECHO_N "checking for hstrerror prototype... $ECHO_C" >&6; }
if test "${sc_cv_have_prototype_hstrerror+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Copyright (c) 2008, Ryan Witt
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
from django.http import HttpResponse
from piston.resource import Resource
class FileResource(Resource):
def __init__(self, handler, authentication=None, filename=None):
if filename:
self.filename = filename
else:
self.filename = "export.txt"
super(FileResource, self).__init__(handler, authentication=authentication)
def all_objects(request, admin):
from my_project.my_app.admin import ThisAdmin
class AllItemsAdmin(ThisAdmin):
list_display = ('item_name', 'start_date', 'press_summaries', 'photos', 'owner', 'output', 'visible')
list_display_links = (None,)
actions = None
def __init__(self, model, admin_site, request):
self.request = request
def all_objects(request, admin):
return ThisAdmin(admin.model, admin.admin_site, request).changelist_view(request)
class ThisAdmin(admin.ModelAdmin):
def get_urls(self):
urls = super(ThisAdmin, self).get_urls()
my_urls = patterns('',
url(r'^all/$',
self.admin_site.admin_view(all_objects),
{'admin': self,},
name='all_initiatives'),
)
return my_urls + urls
class ThisAdmin(admin.ModelAdmin):
def queryset(self, request):
"""
Filter the objects displayed in the change_list to only
display those for the currently signed in user.
"""
qs = super(ThisAdmin, self).queryset(request)
if request.user.is_superuser:
return qs
return qs.filter(Q(owner=request.user) | Q(editors=request.user))
from struct import pack, unpack
def encode(ip_address):
return unpack('i', ''.join([pack('B', int(sub)) for sub in ip_address.split('.')]))[0]
def decode(packed_address):
return '.'.join(['%d' % unpack('B', sub)[0] for sub in pack('i', packed_address)])