Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<section>
<input type="file" id="input" />
<input type="number" id="maxWidth" /> &times; <input type="number" id="maxHeight" />
<button onclick="convert()">Convert</button>
</section>
<section><pre id="output"></pre></section>
<section><img id="outputImage"></pre></section>
<script type="application/javascript">
function convert() {
#include <nmmintrin.h>
#include <stdint.h>
#include <stdio.h>
int main() {
for (uint64_t i = 0; i < 0x100000000ULL; ++i)
if (_mm_crc32_u32(0, i) == i)
printf("%08x\n", (uint32_t)i);
return 0;
}
@kotarou3
kotarou3 / timetable-formatter.js
Last active July 20, 2016 19:26
Format UNSW timetable for conversion to PDF
let printoutHeight = 18; // In centimetres
function xpath(node, path) {
let elems = document.evaluate(path, node, null, XPathResult.ANY_TYPE, null);
let elem;
let result = [];
while (elem = elems.iterateNext())
result.push(elem);
return result;
@kotarou3
kotarou3 / examine-middlewares.js
Created February 3, 2016 07:39
Scripts to help with examining middlewares
function examineMiddlewares(middlewares) {
"use strict";
let results = [];
for (let middleware of middlewares) {
let script = %FunctionGetScript(middleware);
let position = %FunctionGetScriptSourcePosition(middleware);
let line = script.source.slice(0, position).split("\n").length - 1;
let source = %FunctionGetSourceCode(middleware);
#!/usr/bin/nodejs
"use strict";
require("prfun/smash");
const co = require("co");
const execFile = Promise.guard(
require("os").cpus().length + 1,
(cmd, args) => require("mz/child_process").execFile(cmd, args, {maxBuffer: 100 * 1024 * 1024})
);
const fs = require("mz/fs");
@kotarou3
kotarou3 / find-top-level-packages.py
Last active December 19, 2023 16:41
Find top-level packages of the dependency graph for debian packages
#!/usr/bin/python3
import argparse, sys
import apt
import networkx as nx
parser = argparse.ArgumentParser(
description = "Find top-level packages of the dependency graph"
)
parser.add_argument(
@kotarou3
kotarou3 / 0001-Hack-in-C++-support.patch
Last active March 6, 2017 08:38
For COMP9242 16s2
From 16fb4aa41e1ac236cf1f57747b70ab650292658d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E5=A4=AA?= <nospam@kota.moe>
Date: Thu, 4 Aug 2016 21:55:53 +1000
Subject: [PATCH] Hack in C++ support
Also via a unusual method to update the musl version without creating a huge
diff that give won't accept.
musl needed to be updated because libc++ depends on a newer one than the one
provided.
剕 [あしきり] /(n) (arch) (See 五刑) cutting off the leg at the knee (form of punishment in ancient China)/EntL2542150/
劓 [はなきり] /(n) (arch) (See 五刑) cutting off the nose (form of punishment in ancient China)/EntL2542140/
匜;半挿 [はそう;はぞう] /(n) (1) (esp. ) wide-mouthed ceramic vessel having a small hole in its spherical base (into which bamboo was probably inserted to pour liquids)/(2) (See 半挿・はんぞう・1) teapot-like object made typically of lacquerware and used to pour hot and cold liquids/EntL2791750/
噯;噯気;噫気;噯木(iK) [おくび(噯,噯気);あいき(噯気,噫気,噯木)] /(n) (uk) belch/eructation/burp/EntL2007450X/
垜;安土;堋 [あずち] /(n) mound on which targets are placed (in archery)/firing mound/EntL2542010/
杮;木屑;柿(iK) [こけら] /(n) (1) chopped wood/wood chips/(2) (abbr) (See こけら板) thin shingles/EntL2097450/
棈;阿部槙(ateji) [あべまき;アベマキ] /(n) (uk) Chinese cork oak (Quercus variabilis)/EntL2827052/
楣;目草 [まぐさ] /(n) (uk) {archit} (See 蹴放し) lintel (lacking the grooves needed for a sliding door)/EntL2056390X/
氐 [てい] /(n) (1) Di (ancient Chinese ethnic group)/(2) {as

Stream audio from Windows to Linux

Tested on Ubuntu 16.04 and Windows 10 Redstone 1

Both boxes need to be on the same network (such that multicast packets can be passed between them)

Installing

Linux

  1. Setup JACK (easy to do with Cadence)

Windows

Liquid Cooling Quick-Disconnect Comparison

The accompanying CSV compares various liquid cooling quick-disconnect couplers that satisfy the following criteria:

  • No-spill (<100µL loss on disconnect)
  • Hand mate (requires releasing an interlock to disconnect)
  • Material compatible with a copper loop (e.g., brass, plastic, stainless steel)
  • 0~60°C operating temperature
  • Nominal inner diametre of 6~10mm