This file contains 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 { createContext, useContext, useRef } from "react"; | |
const TelescrollContext = createContext({ | |
provideScroll: () => {}, | |
requestScroll: () => {}, | |
}); | |
export function TelescrollProvider({ children }) { | |
const requested = useRef(null); |
This file contains 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
// Visually looks like an ellipsis, like "0x123...def", but the underlying text | |
// actually has the whole address, so when you select it to copy-paste you get | |
// the whole thing. | |
const ShortAddress = ({ address, ensAddress }) => { | |
if (ensAddress != null) return <span>{ensAddress}</span>; | |
const nibbles = 3; // to keep, at each side | |
const prefix = "0x".length; | |
const start = address.slice(0, prefix + nibbles); | |
const mid = address.slice(prefix + nibbles, -nibbles); |
This file contains 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 shlex | |
import subprocess | |
BIN = "./target/release/qql-cli" | |
SEED = "0x44266f38ea9ef4e85a77310518b1cb6d5a56349bed2514b9d9e2ffff10e2cb2f" | |
WIDTH = 2400 | |
STEPS = 8 | |
def lerp(a, b, t): |
This file contains 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
[Unit] | |
Description=Continuous audio recorder | |
After=network-online.target | |
Wants=network-online.target | |
[Service] | |
ExecStart=/home/pi/start.sh | |
WorkingDirectory=/home/pi | |
User=pi | |
Group=pi |
This file contains 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/sh | |
rustc +nightly --crate-type=staticlib forty_two.rs || exit 1 | |
gcc main.c -L. -lforty_two || exit 1 | |
./a.out | |
# prints: forty_two() = 42 |
This file contains 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 | |
# Extended from a work of Jürgen Hötzel: https://stackoverflow.com/a/2613888 | |
noise_threshold=15 # out of 99 | |
base_dir="${HOME}/recordings" | |
raw_dir="${base_dir}/tmp" | |
chunk_dir="${base_dir}/chunks" | |
seg_dir="${base_dir}/seg" | |
out_dir="${base_dir}/out" | |
sox_raw_options=( -t raw -r 48k -e signed -b 16 -c 1 ) |
This file contains 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
\version "2.20.0" | |
md = \markup \italic { m.d. } | |
mg = \markup \italic { m.g. } | |
\header { | |
title = "Prelude 1 (Recomposed)" | |
composer = "Sebastian Thomas" | |
tagline = ##f | |
} |
This file contains 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
var $t=Math.pow(2,-32),ge=32557,Le=19605,ze=62509,Jt=22609,Qt=33103,en=63335,tn=31614,nn=5125; | |
var De=class{constructor(){this._state=new Uint16Array(4),this._dv=new DataView(this._state.buffer),this._nG=null,this._hNG=!1}setSeed(t){this._hNG=!1,this._nG=null;let l=~~((t.length-2)/2),c=[];for(let b=0;b<l;b++){let k=2+2*b;c.push(parseInt(t.slice(k,k+2),16))}let e=1690382925,d=72970470,f=qe(c,e),g=qe(c,d);this._dv.setUint32(0,f),this._dv.setUint32(4,g)}rnd(){let t=this._state,l=t[0],c=t[1],e=t[2],d=t[3],f=Qt+ge*l|0,g=en+ge*c+(Le*l+(f>>>16))|0,b=tn+ge*e+Le*c+(ze*l+(g>>>16))|0,k=nn+ge*d+(Le*e+ze*c)+(Jt*l+(b>>>16));t[0]=f,t[1]=g,t[2]=b,t[3]=k;let L=(d<<21)+((d>>2^e)<<5)+((e>>2^c)>>11),B=L>>>(d>>11)|L<<(-(d>>11)&31);return $t*(B>>>0)}uniform(t=1,l=null){return l===null&&([t,l]=[0,t]),this.rnd()*(l-t)+t}gauss(t=0,l=1){if(this._hNG){this._hNG=!1;var c=this._nG;return this._nG=null,t+l*c}else{var e=0,d=0,f=0;do e=this.rnd()*2-1,d=this.rnd()*2-1,f=e*e+d*d;while(f>=1||f===0);var g=Math.sqrt(-2*Math.log(f)/f);return this |
This file contains 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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.8; | |
/// @dev | |
/// An `OptionalUint` is either absent (the default, uninitialized value) or a | |
/// `uint256` from `0` through `type(uint256).max - 1`, inclusive. Note that an | |
/// `OptionalUint` cannot represent the max value of a `uint256`. | |
type OptionalUint is uint256; | |
/// @dev |
This file contains 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/sh | |
set -eu | |
usage() { | |
cat <<'EOF' | |
difmap: diff two files after mapping them through a shell filter | |
Examples: | |
# How do the plaintexts of these encrypted files differ? |