Skip to content

Instantly share code, notes, and snippets.

View jdmichaud's full-sized avatar

jdmichaud

View GitHub Profile
https://cgl.ethz.ch/teaching/scivis_common/stuff/StuttgartCourse/VIS-Modules-06-Direct_Volume_Rendering.pdf
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.3443&rep=rep1&type=pdf
@jdmichaud
jdmichaud / index.html
Created August 16, 2019 13:41
Resizable viewport
<!DOCTYPE html>
<html>
<head>
<title>Resizable Canvas</title>
<script type="text/javascript">
function main() {
const viewport = document.getElementsByClassName('viewport')[0];
const resizeObserver = new ResizeObserver(entries => {
entries.forEach(({ target, contentRect }) => {
const canvas = target.children[0];
@jdmichaud
jdmichaud / matrix.c
Last active September 26, 2019 11:32
C matrix
//usr/bin/cc -Wall -Wextra -Wpedantic matrix.c -o matrix && ./matrix; exit
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define EPSILON 1E-6
#define OK 0
#define NO_INVERSE 1
@jdmichaud
jdmichaud / source-install.sh
Last active December 26, 2022 00:27
Install from source
#!/usr/bin/env bash
set -eEx
# Set to the program's basename.
_ME=$(basename "${0}")
usage() {
cat <<HEREDOC
Installs from a remote tarball.
@jdmichaud
jdmichaud / main.js
Last active September 30, 2019 07:15
A mutex++ in javascript
async function main() {
const throttler = new Throttler();
const lock = await throttler.throttle();
console.log('first lock taken');
setTimeout(() => {
console.log('releasing first lock');
lock.release();
}, 2000);
setTimeout(async () => {
console.log('About to take third lock');
@jdmichaud
jdmichaud / pool.ts
Created October 17, 2019 19:03
Simple Pool pattern in Typescript
interface Pool<T> {
get(): T;
release(t: T): void;
}
class BasePool<T> implements Pool<T> {
private readonly elements: T[] = [];
constructor(
private readonly allocator: () => T,
@jdmichaud
jdmichaud / observables.hh
Created November 13, 2019 14:21
Observable Design
typedef std::function<std::function<void()>(Observer<T>)> SubscriberFunction<T>;
interface Subscription<T> {
Subscription<T>(Observer<T>, SubscriberFunction<T>);
void unsubscribe();
}
interface Observer<T> {
void start(Subscription<T>);
void next(const T&);
@jdmichaud
jdmichaud / wireless.sh
Created November 20, 2019 17:42
A wireless lifeline from the command line
# Connect to wifi
nmcli dev wifi list
nmcli dev wifi connect APName password <password>
# Connect to bluetooth
bluetoothctl
scan on
show
pair <device>
connect <device>
@jdmichaud
jdmichaud / debian
Last active August 3, 2024 13:51
qemu
# To install sudo, log in as root and
apt install sudo
# add user to sudoers list
adduser USER sudo
# (debian) For -nographic to work you need to make sure that grub is configured properly
# uncomment /etc/default/grub with:
GRUB_GFXMODE=text
# Update grub
@jdmichaud
jdmichaud / vpn-over-ssh.md
Created December 8, 2019 15:19
VPN over SSH