http POST https://loop.services.mozilla.com/v0/fxa-oauth/params
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Hawk-Session-Token
Connection: keep-alive
This file contains hidden or 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/env python | |
from __future__ import print_function | |
import base64 | |
import hmac | |
import os | |
import sys | |
from six.moves.urllib.parse import urlparse | |
from fxa import core | |
from fxa import errors |
This file contains hidden or 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
lettre_morse = { | |
"a": ".-", | |
"b": "-...", | |
"c": "-.-.", | |
"d": "-..", | |
"e": ".", | |
"f": "..-.", | |
"g": "--.", | |
"h": "....", | |
"i": "..", |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import json | |
import redis | |
r = redis.StrictRedis(host='localhost', port=6379, db=1) | |
# List of permissions that gives us this permission | |
PERMISSIONS_INHERITANCE = { | |
'bucket:write': { |
This file contains hidden or 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
var dgram = require('dgram'); | |
var socket = dgram.createSocket('udp4'); | |
//var testMessage = "[hello world] pid: " + process.pid; | |
var message = new Buffer([0x65, | |
'I', 'P', 'A', 'D', 0x00, | |
'N','A', 'M', 'E', 0x00, | |
'J', 'S', 'O', 'N', 0x00, | |
'V', 'E', 'R', 'S', 0x00, | |
'U', 'U', 'I', 'D', 0x00, |
I hereby claim:
- I am Natim on github.
- I am natim (https://keybase.io/natim) on keybase.
- I have a public key whose fingerprint is 6EE7 90DE 2D5B 88AA F079 11BC A500 E24B 9540 5094
To claim this, I am signing this object:
One of the problem when doing full HTML5 apps is the Authentication.
With Firefox Account, the OAuth dance implies a server. Here are some tips that we are using to provide the Oauth token to the client app after the Oauth dance.
- First add a button to the login page: GET /fxa-oauth/login?redirect=https://web-ui/#login-cb
- When the user clicks it will do the oauth-dance and come back to your redirect endpoint.
- At this time just GET /fxa-oauth/token to get the user oauth-token.
This file contains hidden or 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 startFxAOauthDance(host, options) { | |
if (host === undefined) { | |
throw new Error("You should provide a host."); | |
} | |
if (options === undefined || options.redirect_uri === undefined) { | |
throw new Error("You should provide a options.redirect_uri parameter."); | |
} | |
return request({ |
This file contains hidden or 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
"""Delete all your couchdb database matching a pattern.""" | |
import requests | |
import urllib | |
for db in requests.get("http://localhost:5984/_all_dbs").json(): | |
print db, | |
if db.startswith("couchdb"): | |
print "DELETE", | |
r = requests.delete("http://localhost:5984/%s" % urllib.quote_plus(db)) | |
r.raise_for_status() |
This file contains hidden or 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 asyncio | |
import aiohttp | |
def fetch_page(url, idx, num): | |
# Num per client | |
for i in range(num): | |
response = yield from aiohttp.request('GET', url) | |
if response.status == 200: |