This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.thewhodidthis.dnsmasq</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/opt/pkg/sbin/dnsmasq</string> | |
<string>--keep-in-foreground</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sips *.jpg -s dpiHeight 72.0 -s dpiWidth 72.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resize, optimize and save sprite as looping animated gif | |
convert -resize 50% +repage -fuzz 1.6% -delay 8 -loop 0 *.png -layers OptimizePlus -layers OptimizeTransparency output.gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from, | |
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadedmetadata_event | |
async function getBlobDuration(blob) { | |
const buffer = document.createElement('video') | |
const result = new Promise((resolve, reject) => { | |
buffer.onerror = reject | |
buffer.onloadedmetadata = () => { | |
resolve(buffer.duration) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node --use-strict | |
const path = require('path') | |
const { exec, execSync } = require('child_process') | |
const { readdir } = require('fs') | |
const bento4 = require('bento4-installer') | |
const assets = path.join(__dirname, './assets') | |
readdir(assets, async (error, filesMaybe) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="description" content="Select all to reveal page content"> | |
<title>Select all</title> | |
<style> | |
html { | |
color: white; | |
display: flex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_URL) or exit; | |
// This allows for catching warnings eg. when offline, or `$url` resource missing | |
set_error_handler( | |
function ($severity, $message, $file, $line) { | |
if (error_reporting() & $severity) { | |
throw new ErrorException($message, 0, $severity, $file, $line); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "1.2" -> 1.2 | |
console.assert(convert('1.2') === 1.2) | |
// " " -> " " (not a number) | |
console.assert(isNaN(convert(' '))) | |
console.assert(isNaN(convert(''))) | |
// "12a" -> "12a" (not a number) | |
console.assert(convert('12a') === '12a') | |
console.assert(isNaN(convert('12a'))) | |
// null -> null (not a number) | |
console.assert(convert(null) === null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const { exec } = require('child_process') | |
const assert = require('assert') | |
const fs = require('fs') | |
const path = require('path') | |
const util = require('util') | |
const { minify } = require('terser') | |
const readFile = util.promisify(fs.readFile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert') | |
// I'm trusting R's built in helper for calculating expected values | |
// https://repl.it/repls/IroncladLightpinkBookmark | |
const samples = [ | |
{ | |
input: [187], | |
expected: 187, | |
}, | |
{ |