Skip to content

Instantly share code, notes, and snippets.

@dontcallmedom
dontcallmedom / tz.py
Last active October 14, 2022 09:26 — forked from reagle/tz.py
Print world clock in terminal
#!/usr/bin/env python3
# Print world clock in terminal
# (c) Copyright 2022 by Joseph Reagle
# Licensed under the GPLv3, see <http://www.gnu.org/licenses/gpl-3.0.html>
# from https://gist.github.com/reagle/499355b362bb43cf73285c2fc0f78f5a
# replacing: https://superuser.com/questions/164339/timezone-conversion-by-command-line
import argparse # http://docs.python.org/dev/library/argparse.html
import sys
@dontcallmedom
dontcallmedom / update-interface-data.js
Created September 10, 2021 08:09
node.js script to generate the list of MDN interface data from webref
const fs = require("fs").promises;
// @@@ download latest tagged version of @webref/idl repo
const webrefPath = "../../webref/ed/";
(async function () {
const interfaceData = {};
const index = JSON.parse(await fs.readFile(webrefPath + "idlnames.json", "utf-8"));
(await Promise.all(
Object.entries(index)
.sort(([k1, v1], [k2, v2]) => k1.localeCompare(k2))
@dontcallmedom
dontcallmedom / extract-rfc-refs.sh
Last active July 7, 2021 07:34
RFC references extractor
# we're in a directory where the plain text RFCs and their json metadata have been extracted
# move obsolete RFCs to an obsolete dir
mkdir obsolete
for i in *.json ; do if [ -n "`jq '.obsoleted_by[]' $i`" ] ; then mv $i obsolete/ ; fi ; done
# working dir
mkdir refs
# directory where we will store the results:
# one file per RFC which lists the name of normatively referenced rfcs
mkdir rfc-refs
@dontcallmedom
dontcallmedom / process-extracted-editors.js
Last active May 6, 2021 19:33
Process editors extracted from a custom reffy run
const {JSDOM} = require("jsdom");
const {Parser} = require("json2csv");
const fs = require("fs");
const specData = require(process.argv[2]);
const affiliations = {};
const sortKeys = (o) =>
@dontcallmedom
dontcallmedom / update-specs.js
Created January 24, 2019 08:27
MDN BCD / W3C status comparator
const fs = require("fs");
const specData = JSON.parse(fs.readFileSync("macros/SpecData.json", "utf-8"));
const w3cSpecData = JSON.parse(fs.readFileSync("../spec-dashboard/spec-list.json", "utf-8"));
const not = f => x => !f(x);
const isW3CDomain = function(url) {
const w3cDomains = [
/w3\.org/,
@dontcallmedom
dontcallmedom / ReadMe.md
Created March 2, 2018 13:51 — forked from rolfen/ReadMe.md
Get GPS coordinates for major cities
<meta charset=utf-8>
<textarea style="width: 100%; height:100%"></textarea>
<script>
function stripIntro(doc) {
while (doc.body.firstChild.id != 'goals')
doc.body.firstChild.remove();
}
function anolisToBikeshed(doc) {
// remove all internal markup from IDL blocks
for (let idl of [].slice.call(doc.body.querySelectorAll('pre.idl'))) {
request = require 'request'
Restzilla = require 'restzilla'
BUGZILLA_URL = 'https://www.w3.org/Bugs/Public/'
BURL = 'http://localhost:8000/AudioWG/MIDI%20API/'
GH_USER = 'jussi-kalliokoski'
GH_REPO = 'webmidi-issues'
GH_URL = 'https://api.github.com/repos/' + GH_USER + '/' + GH_REPO + '/issues'
GH_AUTH =
username: 'octocat'
@dontcallmedom
dontcallmedom / .procmail.github
Created October 6, 2014 16:01
Procmail rule to sort github notifications in one maildir per repo
# filter mail from github repos
:0
* ^List-ID: .* <[a-z0-9-]+\.[^.]+\.github\.com>
* ^List-ID: .*<\/[a-z0-9-]+
$MAILDIR/.github.$MATCH/
@dontcallmedom
dontcallmedom / gist:7544230
Created November 19, 2013 11:47
Podio currently exports tasks as iCalendar events, which is both noisy in a calendar view, and doesn't make it possible to integrate them cleanly in a Todo app. This PHP code runs regexp on the iCalendar output from Podio and turns it into a list of VEVENT and VTODO depending on their category (relying on the fact that Podio uses UID prefixed wi…
<?php
$userid= "xxxx"; // get From Podio
$token = "yyyy"; // get From Podio
$cal = file_get_contents("https://api.podio.com/calendar/ics/".$userid."/".$token."/?priority=10");
$begintodo = preg_replace('/BEGIN:VEVENT((?:(?!UID:).)*UID:task)/s','BEGIN:VTODO$1',$cal);
$due = preg_replace('/DTSTART((?:(?!UID:).)*UID:task)/s','DUE$1',$begintodo);
$endtodo = preg_replace('/(UID:task(?:(?!END:VEVENT).)*)END:VEVENT/s', '$1END:VTODO', $due);
print $endtodo;