Skip to content

Instantly share code, notes, and snippets.

View groovecoder's full-sized avatar

luke crouch groovecoder

View GitHub Profile
def validate_vapid_key(self, b64_signed_token):
try:
key_data = urlsafe_b64decode(str(self.vapid_key))
key_string = extract_public_key(key_data)
verifying_key = ecdsa.VerifyingKey.from_string(
key_string,
curve=ecdsa.NIST256p
)
signed_token = urlsafe_b64decode(str(b64_signed_token))
if (verifying_key.verify(signed_token, str(self.vapid_key_token))):
class Payout(models.Model):
user= models.ForeignKey(settings.AUTH_USER_MODEL)
bid = models.ForeignKey(Bid)
amount = models.DecimalField()
created = models.DateTimeField(null=True, blank=True)
modified = models.DateTimeField(null=True, blank=True, auto_now=True)
diff --git a/dashboard/settings.py b/dashboard/settings.py
index c345d54..c6d28fc 100644
--- a/dashboard/settings.py
+++ b/dashboard/settings.py
@@ -13,6 +13,9 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
import os
from decouple import config
+
+from django.utils.translation import ugettext_lazy as _
VAPID_KEY_STATUS_CHOICES = (
('pending', 'pending'),
('valid', 'valid'),
('invalid', 'invalid'),
('recording', 'recording')
)
class MessagesAPIError(Exception):
def __init__(self, message):
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import timezone
from django.contrib.auth.models import User
@groovecoder
groovecoder / gist:964f87ba79277ca42daf
Created February 26, 2016 16:07
push server messages API endpoints
https://szdqmc7xl7.execute-api.us-east-1.amazonaws.com/test
https://szdqmc7xl7.execute-api.us-east-1.amazonaws.com/test/keys
https://szdqmc7xl7.execute-api.us-east-1.amazonaws.com/test/messages/SOMEPUBLICKEY
@groovecoder
groovecoder / gist:7aabbf1799edb8b5d84f
Created January 27, 2016 16:40
autopush test output
lcrouch:autopush lcrouch$ make test
/Users/lcrouch/code/autopush/bin/tox
pypy develop-inst-noop: /Users/lcrouch/code/autopush
pypy installed: apns==2.0.1,autobahn==0.10.4,-e git+git@github.com:mozilla-services/autopush.git@7924372a3b53a80e8431c6da18dbf53d440f0126#egg=AutoPush,backports.ssl-match-hostname==3.5.0.1,boto==2.38.0,cffi==1.5.0,characteristic==14.3.0,ConfigArgParse==0.9.3,coverage==4.1b2,cryptography==0.9.1,cyclone==1.1,datadog==0.5.0,decorator==4.0.0,eliot==0.7.1,enum34==1.0.4,flake8==2.5.1,Flask==0.10.1,funcsigs==0.4,gcm-client==0.1.4,greenlet==0.4.5,hawkauthlib==0.1.1,httpretty==0.8.9,idna==2.0,ipaddress==1.0.14,itsdangerous==0.24,Jinja2==2.7.3,MarkupSafe==0.23,mccabe==0.3.1,mock==1.3.0,-e git+https://github.com/bbangert/moto.git@3bdb75a961148ea5aa526f0e88d9e7835a30df3a#egg=moto,nose==1.3.7,pbr==1.3.0,pep8==1.7.0,pluggy==0.3.0,psutil==3.1.1,pyasn1==0.1.8,pyasn1-modules==0.0.6,pycparser==2.14,pyflakes==0.8.1,Pympler==0.4.2,pyOpenSSL==0.15.1,raven==5.3.1,readline==6.2.4.1,repoze.lru==0.6,requests==
# Only enable CORS for fonts when the request is coming from a Mozilla domain
Header unset Access-Control-Allow-Origin
SetEnvIf Origin "https?://(.*\.(mozilla|allizom)\.(com|org|net))" CORS=$0
SetEnvIf Origin "https?://(mdn\.mozillademos\.org)" CORS=$0
Header set Access-Control-Allow-Origin %{CORS}e env=CORS
# block hotlinking by referer to .woff, .woff2, .eof, .ttf files except mozilla domains
RewriteCond "%{HTTP_REFERER}" "!https?://.*\.(mozilla|allizom)\.(com|org|net)/.*$"
RewriteRule \.(woff|woff2|eot|ttf)$ - [F,NC,L,E=!CORS]
2015-08-19T16:30:47.871201+00:00 heroku[api]: Attach DATABASE resource by luke.crouch@gmail.com
2015-08-19T16:30:47.871201+00:00 heroku[api]: Release v6 created by luke.crouch@gmail.com
2015-08-19T16:30:56.226781+00:00 heroku[api]: Release v7 created by luke.crouch@gmail.com
2015-08-19T16:30:56.226781+00:00 heroku[api]: Deploy 4c44508 by luke.crouch@gmail.com
2015-08-19T16:30:56.295724+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-19T16:30:56.295744+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-19T16:41:42.200587+00:00 heroku[web.1]: Unidling
2015-08-19T16:41:42.201523+00:00 heroku[web.1]: State changed from down to starting
2015-08-19T16:41:47.482427+00:00 heroku[web.1]: Starting process with command `./gulp run`
2015-08-19T16:41:50.702159+00:00 app[web.1]: DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log
mysql> UPDATE wiki_revision SET tags = REPLACE(tags, ',"Reference"', '') WHERE document_id IN (SELECT id FROM wiki_do
cument WHERE locale = 'fr');
Query OK, 2851 rows affected (1 min 17.31 sec)
Rows matched: 53572 Changed: 2851 Warnings: 0
mysql> UPDATE wiki_revision SET tags = REPLACE(tags, '"Reference",', '') WHERE document_id IN (SELECT id FROM wiki_doc
ument WHERE locale = 'fr');
Query OK, 404 rows affected (53.62 sec)
Rows matched: 53572 Changed: 404 Warnings: 0