Summary: Write .PNGs to the sandboxed file system in Chrome. Then sneak in and move them out.
1) Set up a sandboxed file system
// Request 40 GB (should be enough for ~5 minutes of 1080p)
var bytes = 1024*1024*1024*40;
import numpy as np | |
import matplotlib.pyplot as plt | |
w = 400 | |
h = 300 | |
def normalize(x): | |
x /= np.linalg.norm(x) | |
return x |
# A python script which makes emails in all files in current directory and sub-directories anonymous. | |
# e.g. A file with the following contents: | |
# siddhartha@gmail.com | |
# Sid Phn#- 6385833322 | |
# gupta49@illinois.edu | |
# weee@as.cd | |
# sid@yahoo.co.in | |
# Would change to: |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
/* | |
We're going to start by adding a canvas to the page and getting a context for it. | |
*/ | |
var canvas = document.createElement("canvas"); | |
canvas.width = canvas.height = 320; | |
document.body.appendChild(canvas); | |
var gl = canvas.getContext("experimental-webgl"); | |
/* | |
WebGL doesn't know how to draw anything onscreen out of the box. We have to |
#!/usr/bin/env bash | |
local_json=$1 | |
remote_ip=$2 | |
remote_json=$3 | |
remote_json_on_local=$(jupyter --runtime-dir)/remote.json | |
scp $remote_ip:$remote_json $remote_json_on_local | |
for socket_name in hb_port control_port stdin_port iopub_port shell_port; do | |
local_port=$(sed 's/,/\n/g' $local_json | grep $socket_name | grep -o "[0-9]\+") | |
remote_port=$(grep $socket_name $remote_json_on_local | grep -o "[0-9]\+") |
Assumed that you have set leiningen up and can use it.
Copy project.clj
, repl-test.cljs
and brepl-test.html
from this gist
or git clone this gist and move or copy repl-test.cljs under src
directory.
$ git clone https://gist.github.com/6183122.git
$ cd 6183122/
(ns particles.core) | |
(def display (.getElementById js/document "display")) | |
(def context (.getContext display "2d")) | |
(def damping 0.999) | |
(def max-particles 250) | |
(def line-width 2) | |
(def app-state (atom {:width (.-innerWidth js/window) | |
:height (.-innerHeight js/window)})) |
This is the technical implementation of the idea and concept described in my article “Why don’t we use HTML to author web components?”
Instead of using template literals, constructors and other specifics to define CustomElements, this is a proposal to just use standard HTML to define CustomElements.
The goal is to import CustomElements like this:
// Numerical matrix examples | |
let x: Matrix = [[10, 9, 8], [3, 2, 1]] | |
let y: Matrix = [[1, 2, 3], [4, 5, 6]] | |
let z: Matrix = [[1, 2], [3, 4], [5, 6]] | |
x + y // [[11, 11, 11], [7, 7, 7]] | |
x * y // [[10, 18, 24], [12, 10, 6]] | |
2 * x // [[20, 18, 16], [6, 4, 2]] | |
y ** z // [[22, 28], [49, 64]] |