The purpose of this article is to be an informal reminder on how do we get from
$1+1=2$
to $i^i=e^{-\frac{\pi}{2}}$
.
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
// npm install express highlight.js marked morgan mustache | |
const fs = require('fs'); | |
const express = require('express'); | |
const morgan = require('morgan'); | |
const marked = require('marked'); | |
const highlight = require('highlight.js'); | |
const Mustache = require('mustache'); | |
const config = { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Least Squares</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/4.4.2/math.js"></script> | |
<script src="main.js"></script> | |
<style> | |
.graph { | |
border: solid 1px black; | |
display: block; |
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
gnuplot -e "set term png; f(x)=1+4*x-x**2; plot f(x)" | imgcat | |
gnuplot -e "set term png; set output 'plot.png'; f(x)=1+4*x-x**2; plot f(x)" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Code Mirror Tests</title> | |
<link rel="stylesheet" href="dist/bundle.css"> | |
<script src="dist/main.js"></script> | |
<script> | |
window.onload = () => { | |
createEditor(document.getElementById('editor')); | |
} |
Install the emscripten toolchain. See instructions here
We will compile a simple c
program using emscripten which will generate
WebAssembly code. Then, in a simple web page, we will load the resulting wasm
generated file and pass it to the WebAssembly facility now found in any decent
browser. Simple as that!
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
import sys | |
# How to run: | |
# cat << EOF | python ks.py | |
# 1 | |
# 10 | |
# 2 6 7 1 5 | |
# 1 1 1 1 1 | |
# EOF | |
# [(2, 1), (1, 1), (5, 1)] |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=UTF-8> | |
<title>Canvas interpolation test</title> | |
<script> | |
function main() { | |
const canvas = document.getElementById('canvas'); | |
canvas.width = 2; | |
canvas.height = 2; |
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
import math | |
import numpy | |
import imageio | |
from matplotlib import pyplot | |
def resize(img, size): | |
(width, height) = size | |
resized = [] | |
wratio = len(img[0]) / width |
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
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <sys/mman.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main(int argc, char **argv) { |