Skip to content

Instantly share code, notes, and snippets.

View alienzhou's full-sized avatar
💭
I may be slow to respond.

Alien ZHOU alienzhou

💭
I may be slow to respond.
View GitHub Profile
@alienzhou
alienzhou / mk-openssl-webassembly.sh
Created November 28, 2021 16:49
Creates OpenSSL as WASM
#!/bin/sh
OPENSSL="openssl-1.1.1d"
if [ -d ${OPENSSL} ]; then
rm -rf ${OPENSSL}
fi
if [ ! -f ${OPENSSL}.tar.gz ]; then
curl -O https://www.openssl.org/source/${OPENSSL}.tar.gz
@alienzhou
alienzhou / utils.d.ts
Created October 11, 2021 13:57
Utils in Typescript
// from https://gist.github.com/navix/6c25c15e0a2d3cd0e5bce999e0086fc9
export type DeepPartial<T> = T extends Function ? T : (T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T);
export type DeepRequired<T> = T extends Function ? T : (T extends object ? { [P in keyof T]-?: DeepRequired<T[P]>; } : T);
@alienzhou
alienzhou / FlameGraphDiff.hs
Created April 3, 2021 14:43 — forked from gelisam/FlameGraphDiff.hs
a simple algorithm to diff two flame graphs
-- in response to https://twitter.com/jfischoff/status/1228861734271647745
--
-- The challenge is to visualize the diff of two flame graphs. My idea is: we
-- need to draw both Trees in the same image, so we draw each node as the _sum_
-- of the two durations. The color of the node indicates whether the nodes above
-- it are slower or faster. Grey is "same speed", orange is "slower" (burns more
-- resources), and blue is "faster" (dousing the flames).
--
-- Note that I'm using a simple 'Tree' from the containers library, not whatever
-- is the real output from 'perf', so more work would be needed to make this