Skip to content

Instantly share code, notes, and snippets.

@kamituel
kamituel / session.php
Created March 18, 2013 12:01
Mozilla Persona's IdP impl helper file.
function activeSessionFor(email) {
<?php
if ( isset($_SESSION['email']) && strlen($_SESSION['email']) > 0 ) {
echo "return true;";
} else {
echo "return false;";
}
?>
}
@kamituel
kamituel / provision.php
Last active December 15, 2015 02:19
Mozilla Persona provision page
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<script src="https://login.persona.org/provisioning_api.js"></script>
<script>
<?php require('session.php'); ?>
@kamituel
kamituel / sign_in.php
Last active December 15, 2015 02:19
Mozilla Persona sign_in page.
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<script src="https://login.persona.org/authentication_api.js"></script>
<?php
if ( isset($_POST['emailf']) ) {
$_SESSION['email'] = $_POST['emailf'];
@kamituel
kamituel / gist:5063933
Last active December 14, 2015 09:18
Running two Trac instances at once, one of which is pointing to a single project only. This way you can password protect all your projects but one. See blog post for details: http://tmblr.co/ZRgRYwfFmZiH.
# Private, password protected instance for all projects
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption PYTHON_EGG_CACHE /tmp/python_egg_cache
PythonOption TracEnvParentDir /home/services/trac/projects
AuthType Basic
AuthName "innovationTM authentication"
@kamituel
kamituel / gist:4579150
Last active December 11, 2015 09:18
Buildbot's master.cfg for B2G/unagi
# -*- python -*-
# ex: set syntax=python:
c = BuildmasterConfig = {}
from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave("example-slave", "pass")]
c['slavePortnum'] = 9989
from buildbot.changes.gitpoller import GitPoller
@kamituel
kamituel / gist:4579087
Last active December 11, 2015 09:18
One of the steps of building B2G
sudo apt-get install zip libasound2 yasm
@kamituel
kamituel / gist:4579020
Created January 20, 2013 14:22
Buildbot: install correct python-sqlalchemy version
$ sudo apt-get install python-pip
$ pip uninstall sqlalchemy
$ pip install "sqlalchemy==0.6.2"
@kamituel
kamituel / gist:4579014
Created January 20, 2013 14:21
Buildbot error for wrong python-sqlalchemy version.
from sqlalchemy import exceptions as sa_exceptions
ImportError: cannot import name exceptions”
@kamituel
kamituel / gist:4564291
Created January 18, 2013 12:29
Buildbot: running master and slave nodes.
$ buildbot start master/
$ buildslave start slave/
@kamituel
kamituel / gist:4564281
Last active December 11, 2015 07:08
Buildbot: create master and slave with default configuration options.
# Syntax: buildbot create-master DIR/
$ buildbot create-master master/
$ cp master/master.cfg.sample master/master.cfg
# Syntax: buildslave create-slave DIR MASTER_CONN NAME PASS
$ buildslave create-slave slave/ localhost:9989 example-slave pass