This file contains hidden or 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,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,5,18,23,2153,2226,2229,2231,2236,2237,2237,2238,2238,2238,2238,2239,2242,2242,2243,2243,2246,2247,2247,2248,2250,2250,2250,2264,2283,2283,2283,2283,2283,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2284,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2285,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,2286,22 |
This file contains hidden or 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
| function kmeans(k, arr) { | |
| var clusters = []; | |
| var sorted = [...new Set(arr)].sort((a, b) => a - b); | |
| var size = Math.abs(sorted.length/k); | |
| for (var i = 0; sorted.length>0; i += size) { | |
| if (sorted.length < size*2) size = size*2; | |
| clusters.push(sorted.splice(0, size)); | |
| } | |
| console.log(clusters.map((a) => JSON.stringify(a.sort((a, b) => a - b)))); | |
| var center = (a) => { |
This file contains hidden or 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
| from bs4 import BeautifulSoup | |
| import requests | |
| import os | |
| def fetch(url): | |
| if (url[0:4] != "http"): | |
| url = 'http://www.arrl.org'+url | |
| fname = url.split("/")[-1] | |
| print("Fetching [{}] from {}".format(fname, url)) | |
| if os.path.isfile(fname): |
This file contains hidden or 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
| { | |
| let log = (str, styles) => { | |
| styles = styles || {}; | |
| var args = []; | |
| var active = []; | |
| var flushed = true; | |
| str = str.replace(/(?:(?:\[([^\]]+)\]|([^[]+)))/g, (a, b) => { | |
| if (a.match(/^\[\//)) { | |
| let changed = false; |
This file contains hidden or 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
| function getSpeech(cb) { | |
| if (!webkitSpeechRecognition) return false; | |
| var recognition = new webkitSpeechRecognition(); | |
| recognition.interimResults = true; | |
| recognition.onresult = (event) => { | |
| var transcript = event.results[0][0].transcript; | |
| cb(transcript); | |
| } | |
| recognition.start(); |
This file contains hidden or 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
| class UIState { | |
| constructor(...selectors) { | |
| this._selectors = {}; | |
| this._memoized = {}; | |
| this.__state = {}; | |
| for (let s of selectors) this.selectors = s; | |
| } | |
| bind(name) { | |
| return (...a) => { this.update(name); }; | |
| } |
This file contains hidden or 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
| var __contexts = 0; // Just for debugging. | |
| class Context { | |
| constructor(parent, transaction=false) { | |
| this._data = {}; | |
| this._children = []; | |
| this._parent = parent; | |
| this._transaction = transaction; | |
| this._revision = __contexts++; | |
| } |
This file contains hidden or 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
| (function() { | |
| /** | |
| * Lets you add words to a dictionary and then retrieve words | |
| * based on a set of letters that you'd like to include. | |
| * | |
| * So you can be like, "Hey, I only know the letters E, T and A, what | |
| * words can I spell?" | |
| * | |
| * The dict structure is a graph sorted on character frequency |
This file contains hidden or 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
| class AlphabetGenerator { | |
| constructor() { | |
| this._playback_rate = 3; | |
| this.audio = document.getElementById('nato-alphabet'); | |
| var my = this; | |
| this.audio.addEventListener('loadeddata', function(ev) { | |
| my.audioLoaded(); | |
| }); | |
| window.setTimeout(function update() { |
This file contains hidden or 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
| class AlphabetGenerator { | |
| constructor() { | |
| const context_name = '_MORSE_AUDIO_CONTEXT' | |
| var ac = window[context_name] || new window.AudioContext(); | |
| var an = ac.createAnalyser(); | |
| an.connect(ac.destination); | |
| an.minDecibels = -140; | |
| an.maxDecibels = 0; | |
| this._audio_loaded = false; |