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
| async function fmait(callbacks, array) { | |
| for (const callback of callbacks) { | |
| array = await Promise.all(array.map(item => Promise.resolve(callback(item)))); | |
| } | |
| return array; | |
| } |
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
| window.keybindr = (() => { | |
| // Declare set of keys that are pressed | |
| const keys = new Set(); | |
| // Declare "associative array" of bindings to callback | |
| const bindings = []; | |
| function tokenizeKeys(keys){ | |
| // Get array of different keys from string | |
| return keys.split("+"); | |
| } | |
| window.addEventListener("keydown", ({key}) => { |
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 degrees = radians => radians * 180 / Math.PI; | |
| const radians = degrees => degrees * Math.PI / 180; | |
| function vecTo(x1, y1, x2, y2) { | |
| const xDist = x2 - x1; | |
| const yDist = y2 - y1; | |
| let direction; | |
| if (xDist > 0 && yDist > 0) { | |
| direction = degrees(Math.atan(yDist / xDist)); | |
| } else if (xDist > 0 && yDist < 0) { | |
| direction = 360 + degrees(Math.atan(yDist / xDist)); |
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
| library(deSolve) | |
| library(reshape2) | |
| library(ggplot2) | |
| initial_state_values <- c(S = 0.999, E = 0, I = 0.001, R = 0, M = 0) # S = Susceptible, E = Exposed, I = Infected, R = Recovered, M = Dead | |
| parameters <- c( | |
| beta = 0.07142857142 * 3, # Contact Rate | |
| theta = 0.2, # 1 / (Length of Latent Period) | |
| gamma = 0.07142857142, # 1 / (Length of Infection) | |
| ro = 0.00130718954, # 1 / (Length of Immunity) | |
| nu = 0.00003281917, # Birth Rate |
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
| library(deSolve) | |
| library(reshape2) | |
| library(ggplot2) | |
| initial_state_values <- c(I = 1000000, R = 0, M = 0) | |
| parameters <- c(gamma = 0.1, mu = 0.2) | |
| times <- seq(from = 0, to = 28, by = 1) | |
| cohort_model <- function(time, state, parameters) { | |
| with (as.list(c(state, parameters)), { | |
| dI <- -gamma * I - mu * I | |
| dR <- gamma * I |
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
| runs <- 1 | |
| for(run in 1:runs) { | |
| beta <- 0.65 | |
| gamma <- 0.15 | |
| N <- 1000 | |
| S <- c(999) | |
| I <- c(1) | |
| R <- c(0) | |
| for(i in 1:(7*8)){ | |
| l <- rbinom(1, round(I[length(I)]), beta) |
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
| library(deSolve) | |
| library(reshape2) | |
| library(ggplot2) | |
| N <- 1000 | |
| initial_state_values <- c( | |
| S = 0.999, | |
| E = 0, | |
| IMI = 0.001, | |
| IM = 0, | |
| A = 0, |
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 SQUARE_SIZE = 5; | |
| let storage = []; | |
| function setup() { | |
| createCanvas(600, 600); | |
| for (let x = 0; x < width / SQUARE_SIZE; x++) { | |
| storage[x] = []; | |
| for (let y = 0; y < height / SQUARE_SIZE; y++) { | |
| storage[x].push((Math.random() > 0.5) ? "red" : "blue") | |
| } |
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 fs = require("fs"); | |
| const R = require("ramda"); | |
| const tf = require("@tensorflow/tfjs-node"); | |
| const fsExtra = require('fs-extra') | |
| const text = fs.readFileSync("input.txt").toString(); | |
| const chars = Array.from(new Set(text.split(""))); | |
| const encoding = Object.fromEntries(chars.map((x, i) => [x, i])); | |
| const decoding = Object.fromEntries(chars.map((x, i) => [i, x])); | |
| const sampleLength = 20; // when I change this to 100, my lstm's loss goes to NaN | |
| const epochSize = 5000; |
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
| async function main() { | |
| const fs = require("fs"); | |
| const R = require("ramda"); | |
| const tf = require("@tensorflow/tfjs-node"); | |
| const fsExtra = require('fs-extra'); | |
| const text = fs.readFileSync("input.txt").toString(); | |
| const chars = Array.from(new Set(text.split(""))); | |
| const encoding = Object.fromEntries(chars.map((x, i) => [x, i])); | |
| const decoding = Object.fromEntries(chars.map((x, i) => [i, x])); | |
| const sampleLength = 50; |
OlderNewer