method: GET
fields: token, or email and api-key
headers: x-api-key (instead of api-key parameter)
returns: { status: ok, user data } on success
{ status: error, desc: <desc> } on error
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
{ | |
// required | |
"name": "Name of the project. (e.g. Bedrock)", | |
"description": "Awesome website of sweetness", | |
"repository": { | |
"type": "git", | |
"url": "https://github.com/mozilla/bedrock" | |
}, | |
// optional |
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
#!/bin/sh | |
# Allows you to use both VirtualBox and KVM virtualization on the same machine. | |
# I replaced the commands to start both VB and KVM with this script. | |
# you'll also need to disable both services from starting automatically. | |
# sudo update-rc.d qemu-kvm disable | |
# sudo update-rc.d vboxdrv disable | |
case "$1" in |
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
from types import MethodType | |
from django.http import CompatCookie, HttpRequest | |
def _set_cookie(self, key, value='', max_age=None, expires=None, path='/', | |
domain=None, secure=False): | |
self._resp_cookies[key] = value | |
self.COOKIES[key] = value | |
if max_age is not None: |
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 zlib | |
from base64 import b64decode, b64encode | |
from django.db import models | |
# django-jsonfield | |
from jsonfield import JSONField | |
class CompressedJSONField(JSONField): |
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
from django.db.models.manager import Manager | |
class PassThroughManager(Manager): | |
''' | |
Inherit from this Manager to enable you to call any methods from your | |
custom QuerySet class from your manager. Simply define your QuerySet | |
class, and return an instance of it from your manager's `get_query_set` | |
method. | |
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
from django.conf import settings | |
from django.http import HttpResponsePermanentRedirect | |
class EnforceHostnameMiddleware(object): | |
""" | |
Enforce the hostname per the ENFORCE_HOSTNAME setting in the project's settings | |
The ENFORCE_HOSTNAME can either be a single host or a list of acceptable hosts | |
""" | |
def process_request(self, request): |
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
sha1certcheck() { | |
cert_type=$( : | openssl s_client -connect ${1}:443 -ssl3 -cipher 'DES-CBC3-SHA' 2>/dev/null <<< Q | openssl x509 -text | grep 'Signature Algorithm' | cut -d ':' -f 2 | uniq) | |
if [ "${cert_type:1}" = "sha1WithRSAEncryption" ]; then | |
echo "All's well" | |
else | |
echo "Bad cert type: $cert_type" | |
fi | |
} |
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
# Draft script to fix the token mappings in the Basket database, | |
# given a list of valid email-token mappings | |
from django.db.models import Q | |
from news.models import Subscriber | |
# Let's assume we have the data in the form of a dictionary, | |
# where each key is an email address and its value is the corresponding |
I believe all the files can be processed into a single JSON file with the following format.
{
"public-figures": ["first last", "first last", ...],
"businesses": ["name", ...],
"organizations": ["name", ...],
"private-individuals": ["first last", ...],
"members-of-congress": ["first last", ...]
}
NewerOlder