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
mport socket | |
import struct | |
import re | |
MAC_PATT = re.compile('([a-fA-F0-9]{2}[:|\-]?){6}') | |
MAC_PARTS_PATT = re.compile('[a-fA-F0-9]{2}') | |
def WOL(mac_addr, ip): | |
"""comments go here""" | |
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
def bind(self, values, **options): | |
exclude = options.get('exclude', []) | |
rename_fields = options.get('rename_fields', {}) | |
for (field_name, field_value) in values.iteritems(): | |
if field_name not in exclude: | |
if field_name in rename_fields.keys(): | |
field_name = rename_fields[field_name] | |
field = self._meta.get_field(field_name) | |
if field.choices: |
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
<!-- http://twitter.com/mgrouchy/status/13429079254 --> | |
<style type='text/css'> | |
.bbpBox{background:url(http://s.twimg.com/a/1271891196/images/themes/theme15/bg.png) #022330;padding:20px;} | |
p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} | |
p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} | |
p.bbpTweet span.metadata span.author{line-height:19px} | |
p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} | |
p.bbpTweet a:hover{text-decoration:underline} | |
p.bbpTweet span.timestamp{font-size:12px;display:block} | |
</style> |
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 os | |
import sys | |
apache_configuration= os.path.dirname(__file__) | |
project = os.path.dirname(apache_configuration) | |
workspace = os.path.dirname(project) | |
sys.path.append(project) | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' |
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
#first generate a key for your domain | |
openssl genrsa -out yourdomain.com.key 2048 | |
#then generate the request | |
openssl req -new -key yourdomain.com.key -out yourdomain.com.csr |
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
if settings.DEBUG: | |
urlpatterns += patterns("", | |
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes':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
mkdir ~/virtualenvs |
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
" Vim syntax file | |
" Language: Django template | |
" Maintainer: Dave Hodder <dmh@dmh.org.uk> | |
" Last Change: 2010 May 19 | |
" For version 5.x: Clear all syntax items | |
" For version 6.x: Quit when a syntax file was already loaded | |
if version < 600 | |
syntax clear | |
elseif exists("b:current_syntax") |
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
patterns = [ | |
(r'^(?P<resource_name>offer)/(?P<pk_list>\w[\w/;-]*)/$', someview), | |
(r'^offer/(?P<offer_id>\d+)/(?P<resource_name>transaction)/$', someotherview), | |
(r'^offer/(?P<offer_id>\d+)/(?P<resource_name>transaction)/(?P<offer_transaction_id>\d+)/$', someview), | |
] | |
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
def override_urls(self): | |
return [ | |
url(r'^offer/(?P<offer_id>\d+)/(?P<resource_name>%s)/(?P<offer_transaction_id>\d+)/$' % self._meta.resource_name, self.wrap_view('get_offer_transaction_id'), name="api_get_offer_transaction_id"), | |
url(r'^offer/(?P<offer_id>\d+)/(?P<resource_name>%s)/$' % self._meta.resource_name, self.wrap_view('get_offer_transaction'), name="api_get_offer_transaction"), | |
] |
OlderNewer