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
<html> | |
<head> | |
<title>Picture-to-Dice</title> | |
<script> | |
const loadImg = (file) => { | |
const reader = new FileReader(); | |
const src = new Image(); | |
const count = parseInt(document.getElementById('count').value) || 64000; | |
const canvas = document.createElement('canvas'); |
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
Physical design: | |
- 16 digital/analog headers | |
- 10 digital-only headers | |
- Configuration enable (CE) slide switch | |
- Configuration clear (CC) microswitch | |
Initial configuration flow | |
- Slide CE to "on" |
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
import React from 'react'; | |
/** | |
* Convert a number into a 12-digit binary number string | |
*/ | |
const dots = num => { | |
const n = num.toString(2).padStart(12, 0).split('').slice(0, 12); | |
return `1${n.substr(0, 6)}11${n.substr(6)}1`; | |
}; | |
/** | |
* See generateShaperNumbers.js to see how this is generated. |
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 CURRENT_YEAR = new Date(new Date().getFullYear(), 0, 0, 0, 0, 0, 0); | |
const DAY = 1000 * 60 * 60 * 24; | |
const dates = ['Feb 22', 'Oct 30', 'Apr 13', 'Mar 16', 'Apr 28', 'July 11', 'Mar 15', 'Dec 5', 'Feb 9', 'Mar 29', 'Nov 2', 'Nov 24', 'Jan 7', 'Nov 23', 'Apr 23', 'Feb 12', 'Dec 29', 'Apr 27', 'Oct 4', 'Nov 19', 'Oct 5', 'Mar 18', 'Aug 20', 'Jan 29', 'Oct 27', 'Sep 15', 'Dec 28', 'Nov 2', 'July 4', 'Aug 10', 'Jan 30', 'May 8', 'Oct 14', 'May 29', 'Aug 27', 'Jan 9', 'July 14', 'Oct 1', 'Feb 6', 'June 12', 'Aug 19', 'July 6', 'Aug 4', 'June 14']; | |
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
const TAU = Math.PI * 2; | |
const getDayNum = d => { | |
let diff = +new Date(d) - CURRENT_YEAR; | |
return Math.floor(diff / DAY); | |
}; |
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
#!/bin/bash | |
# Will maximize the current window to a new desktop, or, if the window is not | |
# Use your window manager's keybindings to attach this script to the key combination of your choice | |
# Requires the following packages in Ubuntu: | |
# xdotool x11-utils wmctrl | |
function goFull() { | |
echo $1 | |
DESKTOP=`wmctrl -d | cut -d \ -f 1 | tail -1` |
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
((win, btoa, atob) => Object.assign(win, { | |
btoa: (str) => btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(parseInt(p1, 16)))), | |
atob: (str) => decodeURIComponent(atob(str).split('').map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')) | |
}))(this, btoa, atob); |
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
#include <Audio.h> | |
#include <SerialFlash.h> | |
#include <play_sd_mp3.h> | |
#define USE_TEENSY3_OPTIMIZED_CODE | |
// SD-hosted MP3 file source | |
AudioPlaySdMp3 playMp31; | |
// Stereo DAC (Teensy 3.5/3.6) |
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
# Spaces | |
<Multi_key> <space> <space> : " " nobreakspace # NO-BREAK SPACE | |
<Multi_key> <4> <n> <space> : " " U2000 # en quad | |
<Multi_key> <4> <m> <space> : " " U2001 # mutton quad | |
<Multi_key> <n> <space> : " " U2002 # en space | |
<Multi_key> <m> <space> : " " U2003 # em space | |
<Multi_key> <1> <3> <m> <space> : " " U2004 # 1/3 em space | |
<Multi_key> <1> <4> <m> <space> : " " U2005 # 1/4 em space | |
<Multi_key> <1> <6> <m> <space> : " " U2006 # 1/6 em space | |
<Multi_key> <f> <space> : " " U2007 # Figure space |
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
/** | |
* Draw a line graph in Chrome/Chromium's dev console | |
* Examples: | |
* console.lineGraph([[5, 3], [10, 8], [-10, 1], [7, -3], [3, 0]], 320, 240); | |
* console.lineGraph(Math.sin, 420, 240, -Math.PI, Math.PI, 0.001); | |
* console.lineGraph(function (x) { | |
return [ | |
Math.sqrt(1 - x*x) + Math.abs(x) - 0.75, | |
(Math.abs(x)-Math.sqrt(1 - x*x)) / 2 - 0.25 | |
]; |