Skip to content

Instantly share code, notes, and snippets.

@jacobd
jacobd / taktech.js
Created October 30, 2023 17:40
taktech Web FM synth keyboard binding
// paste in the js console of https://www.taktech.org/takm/WebFMSynth/
const k1wwhich = { 65: 18, 83: 19, 68: 20, 70: 21, 71: 22, 72: 23, 74: 24, 75: 25, 76: 26, 186: 27, 222: 28, 87: 3, 69: 4, 84: 5, 89: 6, 85: 7, 79: 8, 88: 9, 221: 10 }, km = {}; const noteTable = [ new NoteTableItem(28, 0, 44, 110, 54), new NoteTableItem(89, 0, 44, 110, 56), new NoteTableItem(150, 0, 44, 110, 58), new NoteTableItem(233, 0, 44, 110, 61), new NoteTableItem(303, 0, 44, 110, 63), new NoteTableItem(386, 0, 44, 110, 66), new NoteTableItem(447, 0, 44, 110, 68), new NoteTableItem(508, 0, 44, 110, 70), new NoteTableItem(590, 0, 44, 110, 73), new NoteTableItem(660, 0, 44, 110, 75), new NoteTableItem(743, 0, 44, 110, 78), new NoteTableItem(804, 0, 44, 110, 80), new NoteTableItem(866, 0, 44, 110, 82), new NoteTableItem(0, 0, 9, 188, 52), new NoteTableItem(9, 0, 51, 188, 53), new NoteTableItem(60, 0, 51, 188, 55), new NoteTableItem(111, 0, 51, 188, 57), new NoteTableItem(162, 0, 51, 188, 59), new NoteTableItem(213, 0, 51, 188, 60), new
@jacobd
jacobd / FileSize.swift
Created December 11, 2020 19:36
FileSize struct with Double extension
import Foundation
//
struct FileSize {
enum Unit: Int {
case b = 0, kb, mb, gb, tb, pb, eb, zb, yb
}
var bytes: Int = 0
init(_ bytes: Int) {
self.bytes = bytes

Keybase proof

I hereby claim:

  • I am jacobd on github.
  • I am jacobd (https://keybase.io/jacobd) on keybase.
  • I have a public key ASD40p04ixexJpxWw0tobbMkwGOeYN1Ywmmg-qbZkCl0kgo

To claim this, I am signing this object:

Verifying that +jacobd is my Bitcoin username. You can send me #bitcoin here: https://onename.io/jacobd

Keybase proof

I hereby claim:

  • I am jacobd on github.
  • I am jacobd (https://keybase.io/jacobd) on keybase.
  • I have a public key whose fingerprint is 7955 2723 C6DB 8453 BCBB 1ED7 C959 55B6 4386 3CEB

To claim this, I am signing this object:

@jacobd
jacobd / signed_unix_timestamp.sql
Created June 13, 2012 17:10
Stored MySQL function to return a signed Unix timestamp compatible with pre Unix Epoch dates
DELIMITER |
CREATE FUNCTION SIGNED_UNIX_TIMESTAMP (d DATETIME)
RETURNS BIGINT
DETERMINISTIC
BEGIN
DECLARE tz VARCHAR(100);
DECLARE ts BIGINT;
SET tz = @@time_zone;
SET time_zone = '+00:00';
SELECT DATEDIFF(d, FROM_UNIXTIME(0)) * 86400 +