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; |
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 SpeechGenerator { | |
constructor() { | |
this._word_pause = 8; | |
this._char_pause = 8; | |
this._ready = false; | |
this._queued = []; | |
this._voice_index = 0; | |
this._rate = 1; | |
var my = this; | |
window.speechSynthesis.addEventListener('voiceschanged', function() { |
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
const MorseCodes = { | |
"A": ".-", | |
"B": "-...", | |
"C": "-.-.", | |
"D": "-..", | |
"E": ".", | |
"F": "..-.", | |
"G": "--.", | |
"H": "....", | |
"I": "..", |