Skip to content

Instantly share code, notes, and snippets.

View jonasfj's full-sized avatar

Jonas Finnemann Jensen jonasfj

View GitHub Profile
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

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.

@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.

# 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 / 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');
@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 / 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!";
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() {
#!/bin/bash -e
# Test AWS credentials
if [ "$AWS_ACCESS_KEY_ID" == "" ] ; then
echo "Missing credentials";
exit 1;
fi
# Find public IP of hostname
IP=`dig +short $1`;
@jonasfj
jonasfj / main.js
Created July 6, 2015 07:28
Initial hack for interactive tutorials...
var util = require('util');
var slugid = require('slugid');
var ace = require('brace');
require('brace/mode/javascript');
require('brace/theme/ambiance');
var babel = require('babel-core/lib/babel/api/browser');
// Babel runtime part we use
require('babel-runtime/regenerator');
require('babel-runtime/core-js/promise');