Frequency Calculation = CLK / 16 * TP
- Lowest Possible Note: B0 (30.87Hz ~=
0xFD1
) - Highest Possible Note: G#8 (6644.88Hz ~=
0x013
) - Possible loss of accuracy; verify effective frequency with oscilloscope.
const _ = require('lodash') | |
const tournaments = _.range(1, 100000) | |
const dieA = [1, 1, 4, 4, 4, 4] | |
const dieB = [3, 3, 3, 3, 3, 3] | |
const dieC = [2, 2, 2, 2, 5, 5] | |
const roll = (die) => _.sample(die) | |
const count = (as, e) => _.filter(as, (x) => x === e).length |
<main class="container"> | |
<section class="content"> | |
<canvas class="canvas" id="canvas" resize></canvas> | |
</section> | |
</main> |
<main class="container"> | |
<section class="content"> | |
<canvas class="canvas" id="canvas" resize></canvas> | |
</section> | |
<footer class="footer"> | |
<div class="footer__body"> | |
<p class="footer__text">A template for quickly starting a PaperJS project. <span class="signature">-CH</span></p> | |
</div> | |
<nav class="footer__nav"> | |
<a href="https://codepen.io/cooper_hu" target="_blank">Other Pens</a> |
// Primitives | |
type Theorem = string | |
type Parenthesis<T> = `(${T extends Theorem ? T : never})` | |
type P = 'P' | |
type Q = 'Q' | |
type R = 'R' | |
type And<A extends Theorem, B extends Theorem> = `(${A}&${B})` | |
type Or<A extends Theorem, B extends Theorem> = `(${A}|${B})` |
import chisel3._ | |
def bits(x: Int) = Math.ceil((Math.log(x) / Math.log(2))).toInt | |
class hvsync_generator( | |
h_display: Int, h_back: Int, h_front: Int, h_sync: Int, | |
v_display: Int, v_top: Int, v_bottom: Int, v_sync: Int) extends Module { | |
val h_sync_start = h_display + h_front | |
val h_sync_end = h_display + h_front + h_sync - 1 |
From the rant
channel, here comes the recommended books to live in (and with) these crazy times:
import fc = require('fast-check') | |
import isArraySorted = require('is-array-sorted') | |
class AsyncSemaphore { | |
private promises = Array<() => void>() | |
constructor(private permits: number) {} | |
signal() { | |
this.permits += 1 |
const isArraySorted = require('is-array-sorted') | |
async function testAsyncQueueBehavior(nOps: number): Promise<Boolean> { | |
const result = new Array<number>() | |
const q = new AsyncQueue<number>() | |
const enqueue = (m: number) => q.enqueue(m) | |
const dequeue = () => q.dequeue() | |
const promises = Array<Promise<void>>() |