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
#!/bin/bash | |
if [[ $# -ne 1 ]] | |
then | |
echo "To test for 16G capacity" | |
echo "usage: testcap.sh 16" | |
exit 1 | |
fi | |
echo "checking for capacity ${1}G" |
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
FROM ubuntu:bionic | |
RUN apt update | |
RUN apt install -y \ | |
bison \ | |
libncurses5-dev \ | |
libncursesw5-dev \ | |
libxml2-dev \ | |
libzip-dev \ | |
git |
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 | |
import pygame | |
# Something that look like object literal | |
class Object: | |
def __init__(self, **kwds): | |
self.__dict__.update(kwds) | |
g_event_map = {} |
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
# Something that look like a javascript object literal | |
class Object: | |
def __init__(self, **kwds): | |
self.__dict__.update(kwds) | |
def __str__(self): | |
return str(self.__dict__) | |
test = Object( | |
key=value |
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 inflatePNG(buffer, mark) { | |
const canvas = document.createElement('canvas'); | |
canvas.width = 512; | |
canvas.height = 512; | |
const context = canvas.getContext('2d'); | |
const result = new Uint8Array(512 * 512); | |
performance.mark(`${mark}-start`); | |
const url = window.URL.createObjectURL(new Blob([buffer], { type: 'image/png' })); | |
const image = await new Promise(resolve => { | |
const i = new Image(); |
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
function cross(rhs) { | |
const lhs = this; | |
if (lhs.shape[1] !== 1 || rhs.shape[1] !== 1 || lhs.shape[0] !== 3 || rhs.shape[0] !== 3) { | |
throw new Error(`cross product only implemented for vector of shape (3, 1)`); | |
} | |
// Cross product | |
const u = lhs.dataSync(); | |
const v = rhs.dataSync(); | |
return tf.tensor([ | |
[u[1] * v[2] - u[2] * v[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
function _loadScript(path) { | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = path; | |
document.head.appendChild(script); | |
} |
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 circularDepDetector = (function () { | |
const set = new Set(); | |
return function(key, value) { | |
if (set.has(value)) { | |
return 'CIRCULAR DEPENDENCY'; | |
} | |
set.add(value); | |
return value; | |
}; | |
})(); |
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
#[derive(Copy,Clone,Debug)] | |
struct Vector { | |
x: f32, | |
y: f32, | |
z: f32 | |
} | |
impl Vector { | |
fn new(x: f32,y: f32,z: f32) -> Vector { | |
Vector { x:x, y:y, z:z } |
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> | |
<title>Cube</title> | |
<!-- Trackball is used to test the rotation with the mouse, but you can rotate --> | |
<!-- the cube from the command line this way: --> | |
<!-- > rotateCube('cube1', [1, -1, 0], -Math.PI / 5); --> | |
<script src="trackball.js"></script> | |
<style> | |
* { box-sizing: border-box; } |