Skip to content

Instantly share code, notes, and snippets.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dapibus quam vitae augue condimentum pharetra. Aliquam sit amet nisi risus. Cras eget sem sodales metus consectetur eleifend. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam hendrerit sapien non augue molestie egestas. Proin eu semper ipsum. Quisque vulputate nisl id hendrerit volutpat. Nunc condimentum dui id sagittis consequat. Cras ac cursus augue, ut sagittis quam. Nullam pulvinar eget elit ut finibus. Cras facilisis eu quam non mattis. Nullam ac neque vitae neque ultrices porttitor sed in est.
Ut ultrices at turpis non aliquet. Pellentesque facilisis tellus at neque consectetur, eu bibendum justo finibus. Aenean felis ligula, rhoncus id placerat imperdiet, consectetur nec eros. Nullam et pretium ligula. Integer bibendum massa at est pharetra, non eleifend sem sodales. Fusce porttitor gravida diam id tincidunt. Cras in ullamcorper orci. Nulla sit amet diam nisl. Sed a nisi ornare, efficitur diam ac, tristique ante. Pellentes
16-06-18 00:00 2714
16-06-18 00:10 2756
16-06-18 00:20 2807
16-06-18 00:30 2837
16-06-18 00:40 2862
16-06-18 00:50 2883
16-06-18 01:00 2860
16-06-18 01:10 2877
16-06-18 01:20 2889
16-06-18 01:30 2848
const fs = require("fs");
const modelText = String(fs.readFileSync("Bunny.obj"));
const parseOBJ = function(modelText) {
let lines = modelText.split("\n");
let vertexes = [];
let faces = [];
for(let line of lines) {
/* ACSEF Program: find prime numbers */
/* Compile with -DDEBUG to print all primes */
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#define MAX_PRIME 100000000
<html>
<head>
<title>Mandelbrot</title>
</head>
<body>
<canvas id="output" width="600" height="400" style="border: 1px solid black;"></canvas>
<script>
const canvas = document.getElementById("output");
const ctx = canvas.getContext("2d");
// deps
const net = require("net");
const makeVarInt = (value) => {
const buf = [];
do {
let cur = value & 0b01111111;
value >>>= 7;
if(value != 0) {
cur |= 0b10000000;
// crude, primitive module for tackling CSVs
// use something better i beg
const parseCSV = (text, delimiter = ",") => {
// extract column headers
const firstNewline = text.indexOf("\n");
const columns = text.slice(0, firstNewline).split(delimiter);
// read
// quick and dirty cache
module.exports = class {
constructor(maxAge, maxSize) {
this.maxAge = maxAge;
this.maxSize = maxSize;
this.cache = new Map();
}
// query making helper
// written while feeling very sick
class Query {
constructor(db, tableName) {
this.db = db;
this.tableName = tableName;
}
const nthPrime = (n) => {
// conservative upper bound for nth prime is n log(n log n)
// works for all n >= 6
const max = Math.floor(n * Math.log(n * Math.log(n)));
// allocate sieve
const sieve = new Uint8Array(Math.ceil(max / 8)).fill(0);
// we need to keep track of how many primes we've encountered so far because the upper bound probably includes more than `n` primes