Skip to content

Instantly share code, notes, and snippets.

View thomaswilburn's full-sized avatar
🦝

Thomas Wilburn thomaswilburn

🦝
View GitHub Profile
@thomaswilburn
thomaswilburn / letsencrypt.sh
Last active September 16, 2016 23:04
A wrapper for acme-tiny to request and update certificates
#!/usr/bin/env bash
#Crash on any failed command
set -e
dir=`dirname $0`
# the domains directory should contain one config file per domain
# each file contains a list of subdomains
# for example, here's domains/thomaswilburn.net:
# thomaswilburn.net
# www.thomaswilburn.net
@thomaswilburn
thomaswilburn / a.js
Last active March 10, 2017 00:30
AMD promises
define(async function() {
console.log("a loaded");
var b = await require("b.js");
return { a: true, b };
});
@thomaswilburn
thomaswilburn / index.js
Created April 26, 2017 23:22
Methode to Markdown
var minimist = require("minimist");
var sax = require("sax");
var fs = require("fs");
var args = minimist(process.argv);
var input = fs.createReadStream(args.i);
var parser = sax.createStream();
@thomaswilburn
thomaswilburn / index.js
Created June 22, 2017 18:17
Archive that blogspot feed that you really like
var async = require("async");
var cheerio = require("cheerio");
var FeedParser = require("feedparser");
var request = require("request");
var shell = require("shelljs");
var fs = require("fs");
var path = require("path");
var url = require("url");
var zlib = require("zlib");
@thomaswilburn
thomaswilburn / csv.js
Created June 24, 2017 00:46
Minimal CSV module
var isNumber = /^-?\d[\d.,]*$/;
var cast = function(str) {
if (typeof str != "string") return str;
if (str == "true" || str == "false") {
return str == "true" ? true : false;
}
if (isNumber.test(str)) {
return parseFloat(str.replace(/,/g, ""));
}
@thomaswilburn
thomaswilburn / index.js
Last active July 22, 2017 21:23
ASP page scraper with comments
// Built-in modules
var csv = require("csv");
var fs = require("fs");
var url = require("url");
// Loaded from NPM
var $ = require("cheerio"); // jQuery-like DOM library
var async = require("async"); // Easier concurrency utils
var request = require("request"); // Make HTTP requests simply
@thomaswilburn
thomaswilburn / voronoi.html
Last active September 9, 2017 03:00
Voronoi diagram in WebGL
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Voronoi</title>
</head>
<body>
<canvas class="voronoi"></canvas>
<style>
canvas {
@thomaswilburn
thomaswilburn / groovy.html
Last active September 12, 2017 05:44
Lava lamp metaballs
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Groovy</title>
</head>
<body>
<canvas></canvas>
<style>
canvas {
@thomaswilburn
thomaswilburn / code.js
Created August 23, 2016 19:33
Apps Script Lock demo
// This is the main web handler, and uses the lock service
var sheetID = "xxxx";
var rowConfig = "timestamp name location favorite note lifespan season contact lat lng city zone approve feature".split(" ");
/***
Requests may come in with the following parameters:
name
@thomaswilburn
thomaswilburn / gl.js
Last active October 14, 2017 12:24
Annotated WebGL sample.
/*
We're going to start by adding a canvas to the page and getting a context for it.
*/
var canvas = document.createElement("canvas");
canvas.width = canvas.height = 320;
document.body.appendChild(canvas);
var gl = canvas.getContext("experimental-webgl");
/*
WebGL doesn't know how to draw anything onscreen out of the box. We have to