Skip to content

Instantly share code, notes, and snippets.

View trxcllnt's full-sized avatar

Paul Taylor trxcllnt

View GitHub Profile
@trxcllnt
trxcllnt / golden-ratio-squares.js
Last active April 19, 2023 04:55
copy and paste this into an `about:blank` JS console
((goldenRatioConjugate = 0.618033988749895) => {
// console.clear();
document.body.style.background = 'gray';
Array.from(document.body.children).forEach((x) => {
document.body.removeChild(x);
});
const cnv = document.body.appendChild(document.createElement('canvas'));
cnv.style.width = '100%';
cnv.style.height = '100%';
cnv.width = window.innerWidth;
@trxcllnt
trxcllnt / config.yml
Created June 7, 2022 02:35
basic `clangd` C/C++/CUDA config
# Apply this config conditionally to all C files
If:
PathMatch: .*\.(c|h)$
CompileFlags:
Compiler: /usr/bin/gcc
---
# Apply this config conditionally to all C++ files
If:
# View registry settings
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0
# Change registry settings
# Reverse mouse wheel scroll FlipFlopWheel = 1
# Normal mouse wheel scroll FlipFlopWheel = 0
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
# Restore default scroll direction
# Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 1 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 0 }
bash << "EOF"
read -p "cmake version (default: 3.15.2): " V </dev/tty
CMAKE_VERSION=$([ -z "${V// }" ] && echo "3.15.2" || echo "$V");
sudo apt install \
curl zlib1g-dev libssl-dev libcurl4-openssl-dev \
&& curl -o ./cmake-${CMAKE_VERSION}.tar.gz \
-L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \
&& tar -xvzf cmake-${CMAKE_VERSION}.tar.gz \
&& cd cmake-${CMAKE_VERSION} \
&& ./bootstrap --qt-gui --system-curl \
if (typeof ReadableStream === 'undefined') {
(() => {
const mozFetch = require('fetch-readablestream');
const streams = require('@mattiasbuelens/web-streams-polyfill');
const { makeXhrTransport } = require('fetch-readablestream/lib/xhr');
const { createReadableStreamWrapper } = require('@mattiasbuelens/web-streams-adapter');
const toPolyfilledReadableStream = createReadableStreamWrapper(streams.ReadableStream);
const defaultFactory = require('fetch-readablestream/lib/defaultTransportFactory').default;
mozFetch.transportFactory = !supportsXhrResponseType('moz-chunked-arraybuffer') ? defaultFactory :
((transport) => () => transport)(makeXhrTransport({
```const readFile = (...xs) => require('fs').createReadStream(require('path').resolve(...xs));
const tableMerge = require('child_process').spawn('python', ['-c', pymerge()], {
stdio: ['pipe', 'inherit', 'inherit', 'pipe', 'pipe']
});
readFile('./table-1.arrow').pipe(tableMerge.stdio[3]);
readFile('./table-2.arrow').pipe(tableMerge.stdio[4]);
function pymerge() {
return (
// const memwatch = require('memwatch-next');
// require('segfault-handler').registerHandler("async.log");
// memwatch.on('leak', ({ growth, reason }) => console.log(`Leak: ${round(growth >> 10, 2)}mb ${reason}`));
let eventID = 0;
const assert = require('assert');
const cl = require('node-opencl');
const { promisify } = require('util');
const sleep = promisify(setTimeout);
const MemoryPool = createMemoryPoolClass();
@trxcllnt
trxcllnt / esnextbin.md
Created August 31, 2017 17:48
esnextbin sketch
@trxcllnt
trxcllnt / RotatingSkipList.ts
Created August 13, 2017 10:34
A JavaScript implementation of the non-blocking RotatingSkipList algorithm described in Dick, I. Fekete, A. Gramoli, V. (2016) "A Skip List for Multicore", to appear in Concurrency and Computation Practice and Experience 2016
/*
A JavaScript implementation of the non-blocking RotatingSkipList algorithm described in:
Dick, I. Fekete, A. Gramoli, V. (2016)
"A Skip List for Multicore", to appear in
Concurrency and Computation Practice and Experience 2016
http://poseidon.it.usyd.edu.au/~gramoli/web/doc/pubs/rotating-skiplist-preprint-2016.pdf
https://github.com/gramoli/synchrobench/blob/master/c-cpp/src/skiplists/rotating/nohotspot_ops.c
*/
@trxcllnt
trxcllnt / esnextbin.md
Created May 30, 2017 23:29
esnextbin sketch