Skip to content

Instantly share code, notes, and snippets.

View ozten's full-sized avatar

Austin King ozten

View GitHub Profile
@ozten
ozten / extract_public_key.js
Created July 16, 2012 20:20
Get public key or other fields from a cert
/*
cd into directory with root.cert
node extract_public_key.js
*/
var fs = require('fs');
cert = fs.readFileSync('root.cert').toString('utf8');
var pkEnc = cert.split('.')[1]
@ozten
ozten / gen_well_known_browserid.py
Created June 22, 2012 13:04
Creates a proper /.well-known/browserid from a key.publickey
#!/usr/bin/env python
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"""Usage: gen_well_known_browserid.py key.publickey > www/.well-known/browserid
Generates the /.well-known/browserid file based on your public key.
@ozten
ozten / browserid.js
Created June 22, 2012 10:17
Newer watch based API for Drupal module
(function ($) {
// currentUser is null or '[email protected]'
var currentUser = "<?= loggedInUser ?>",
handleLogin,
handleLogout;
handleLogin = function (assertion) {
if (assertion) {
$.post(Drupal.settings.basePath +'index.php?q=browserid/verify', {
'assertion': assertion,
@ozten
ozten / bigtent.diff
Created June 12, 2012 22:37
bigten diff
diff --git a/ChangeLog b/ChangeLog
index e30219c..74cc136 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,22 +1,7 @@
-train-2012.06.22: (in progress)
- *
-
-train-2012.06.08:
- * rebrand from 'browserid' to 'persona': (including regressions #1711 #1706 #1716 #1719)
@ozten
ozten / tobi_session.js
Created June 8, 2012 18:16
Simple clientSessions and tobi
const
clientSessions = require('client-sessions'),
config = require('../../../lib/configuration')
express = require('express'),
sess_config = config.get('client_sessions'),
tobi = require('tobi');
var app = express.createServer();
app.use(clientSessions({
cookieName: sess_config.cookie_name,
@ozten
ozten / iptables.sh
Created June 8, 2012 17:21
Mock Out OpenID HTTP traffic
iptables -t nat -F
YourIP=www.google.com
#YourIP=74.125.127.99
# 173.194.79.99
YourPort=80
TargetIP=192.168.186.138
TargetPort=8442
iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT \
@ozten
ozten / scripts_mysql_proxy.js
Created May 22, 2012 18:42
A simple single connection proxy
var net = require('net');
var ops = 0;
var proxy = net.createServer(function(bid_conn) { //'connection' listener
console.log('BrowserID (re)-CONNected ', ops);
if (ops < 8 || ops > 10) {
ops = 0;
console.log('RESETTING OPS, allowing new connection');
var mysql_conn = net.connect(3306, 'localhost');
@ozten
ozten / test_old_json_new_golden.js
Created May 3, 2012 23:55
Boostrap a golden JSON test file into the new golden test file
var new_test_data = {
tests: []
};
fs.readFile('data/user_agents.json', 'utf-8', function (err, data) {
if (err) {
console.error(err);
} else {
var test_data = JSON.parse(data);
for (var i=0; i < test_data.tests.length; i++) {
@ozten
ozten / json_from_html.js
Created May 3, 2012 23:52
A script to parse useragentstring.com HTML into test JSON
var fs = require('fs');
// Parses HTML from http://www.useragentstring.com/pages/All/
/* Build a json object like:
{
tests: [
{
comment: "Internet Explorer"
},
@ozten
ozten / identity_layout.txt
Created April 27, 2012 23:46
Our blueprint for source code layout
docs
DEV_NOTES.md
TESTING.md
OPS_NOTES.md
locale (via SVN)
node_modules (not under git versioning)
server
bin
app
config