Skip to content

Instantly share code, notes, and snippets.

Jonas Finnemann Jensen jonasfj

Block or report user

Report or block jonasfj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jonasfj /
Created Jan 20, 2020
Notes on how to query all pubspecs on ``.

Query pubspec.yaml for all packages

When considering introduction of a new field in pubspec.yaml, or wondering how many packages use a certain feature, it can be useful to query all pubspecs from The following notes have some scripts to make this easy.


Helper script to convert YAML to JSON.

jonasfj / count_mono_repo_pub_packages.dart
Created Oct 6, 2019
Count the number of packages on that uses package:mono_repo.
View count_mono_repo_pub_packages.dart
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
import 'dart:async' show FutureOr;
import 'dart:async';
import 'dart:convert' show utf8, json;
import 'dart:io' show Directory, Process, IOException, File;
import 'package:http/http.dart' as http;
import 'package:retry/retry.dart' show retry;
import 'package:pool/pool.dart' show Pool;

Two simple test files for

  1. Run dart download.dart
  2. Run dart extract.dart

Have fun..

jonasfj / grpc_googleapis_example.dart
Created Jan 23, 2019
Example of how to generate GRPC APIs from protobufs and use them in Dart.
View grpc_googleapis_example.dart
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Experiments with dart, grpc and googleapis
// ==========================================
// 1. Install `protoc`
// 2. `pub global activate protoc_plugin`
// 3. `git clone`
// 4. `protoc --dart_out=grpc:lib/src/generated -I googleapis/ -I /usr/local/include/ googleapis/google/cloud/vision/v1/image_annotator.proto`
import requests
from relengapi.lib.permissions import p
def scope_satisfied(req, scopes):
Returns true, if scopes satisfies req
return any((
s == req or (s.endswith('*') and req.startswith(s[:-1])) for s in scopes
View yubikey-setup.txt
Decent links:
* Or just google for gpg, yubikey, ssh, there is a lot of guides.
## The GPG setup
jonasfj / signin-aws
Created Nov 8, 2017
A simple script for forcing 2FA usage with AWS credentials
View signin-aws
# This script expects AWS credentials:
# And optionally the TOTP entry name in your yubikey
# Put these environment variables into your .bashrc.local (or .bashrc, if you
# don't sync dot-files). In your .bashrc you'll also want:
# alias signin-aws='eval `signin-aws`'
View jsone-light.js
import _ from 'lodash';
import assert from 'assert';
// Render string given context
let renderString = (value, context) => {
return value.replace(/\${([^}]+)}/g, (expr, key) => {
if (context[key] === undefined) {
throw new Error('Undefined variable referenced in: ' + expr);
if (!_.includes(['number', 'string'], typeof(context[key]))) {
jonasfj / actions-utils.js
Created Jan 20, 2017
Untested example code demonstrating how to use the `public/actions.json` artifact to display in-tree action in treeherder.
View actions-utils.js
import _ from 'lodash';
import Ajv from 'ajv';
import assert from 'assert';
import taskcluster from 'taskcluster-client';
let data = {}; // TODO: Load actions.json from decision task
if (data.version > 1) {
throw Error('Unsupported version of public/actions.json');
You can’t perform that action at this time.