Skip to content

Instantly share code, notes, and snippets.

View jonasfj's full-sized avatar

Jonas Finnemann Jensen jonasfj

View GitHub Profile
import aws from 'aws-sdk-promise';
import url from 'url';
import https from 'https';
import fs from 'mz/fs';
import _ from 'lodash';
import path from 'path';
import crypto from 'crypto';
(async function() {
@jonasfj
jonasfj / rust-make-request-server.rs
Created August 17, 2015 17:17
Not sure how to close a `hyper::server::Server` after I've started listening, ideas? I want to make test cases where I make a request and handle it.
extern crate hawk;
extern crate hyper;
use std::thread;
use hyper::server::{Server, Request, Response, Listening};
use std::net::Ipv4Addr;
use hyper::status::StatusCode;
use std::io::Write;
static PHRASE: &'static [u8] = b"Hello World!";
@jonasfj
jonasfj / export.js
Created October 1, 2015 21:08
Quick hack to export all my etherpads as text...
// npm install babel promise superagent superagent-promise
// ./node_modules/.bin/babel-node export.js
var pads = [
'jonasfj-pad-list'
];
var seen = ['jonasfj-pad-list'];
var fs = require('fs');
var Promise = require('promise');
@jonasfj
jonasfj / export.js
Created October 1, 2015 21:14
Export linked etherpads as html... just a quick hacl...
// npm install babel promise superagent superagent-promise
// ./node_modules/.bin/babel-node export.js
var pads = [
'jonasfj-pad-list'
];
var seen = ['jonasfj-pad-list'];
var fs = require('fs');
var Promise = require('promise');
# Alternative to None that is used to mark that something was optional and the
# slot in the container should be deleted. This is how we support optional
# properties
deleteMarker = {}
def renderString(string, params):
# Could also use pystache
for k,v in params.items():
string = string.replace('{{' + k + '}}', v)
@jonasfj
jonasfj / readme.md
Created November 19, 2015 21:57 — forked from gregarndt/readme.md

Docker Images for use in TaskCluster

This folder contains various docker images used in taskcluster as well as other misc docker images which may be useful for hacking on gecko.

Organization

Each folder describes a single docker image. These images depend on one another, as described in the FROM line at the top of the Dockerfile in each folder.

Quick hack show how to use taskcluster auth to authenticate requests in python.

This is not much fun without also generating an API reference as you won't get API clients for free. But if used with taskcluster-proxy in docker-worker this could work with curl from a shell script.

def authenticate(description=None):
"""
Open a web-browser to login.taskcluster.net and listen on localhost for
a callback with credentials in query-string.
The description will be shown on login.taskcluster.net, if not provided
a default message with script path will be displayed.
"""
# Importing here to avoid loading these 'obscure' module before it's needed.
# Most clients won't use this feature, so we don't want issues with these
# modules to affect the library. Maybe they don't work in some environments
@jonasfj
jonasfj / data.js
Created January 4, 2016 17:54
secrets data layout proposal...
let base = require('taskcluster-base');
let taskcluster = require('taskcluster-client');
/** Entities for secrets */
let Secret = base.Entity.configure({
version: 1,
signEntities: true,
partitionKey: base.Entity.keys.HashKey('parent'),
rowKey: base.Entity.keys.StringKey('name'),
properties: {
<b>Hi, <span id="name"></span>,</b><br>
Enter your deepest secret and I'll remeber it:<br>
<input type="text" id="secret"><button onClick="save()">Save</button>
<script>
// Load name from location.hash
document.getElementById("name").innerHTML = window.location.hash;
// Load existing secret
document.getElementById("secret").value = (localStorage.secret || 42);
// Save secret
function save() {