Skip to content

Instantly share code, notes, and snippets.

browse () {
prdir=/tmp/prof.`tr -dc a-z </dev/random | head -c 20`
echo >&2 Profile dir: $prdir
mkdir $prdir
cat >$prdir/user.js <<EOF
user_pref('browser.places.speculativeConnect.enabled', false);
user_pref('browser.urlbar.speculativeConnect.enabled', false);
user_pref('network.http.speculative-parallel-limit', 0);
user_pref('app.normandy.enabled', false);
set -x
homedir=$WERMSRCDIR
ht=$homedir/third_party/hterm
dt=$homedir/third_party/dtach
ws=$homedir/third_party/websocketd
. $HOME/m/werm/env
set +x
cat <<'EOF'
https://www.openmymind.net/WebSocket-Framing-Masking-Fragmentation-and-More
window.extended_macros.wermwork = [
['raD T ', 'third_party/dtach'],
['laN G D ', 'ugrep -rg ^var/ -g ^tags -g "^third_party/websocketd/" '],
['raG R C ', ' third_party/hterm/*.js index.html session.c\001grep -n '],
['raR G T ', 'rm *_test.go'],
['raW B ', '$WERMSRCDIR/build\n'],
['raR S T ', 'third_party/st/build && DISPLAY=:1.0 third_party/st/st'],
['rarsR S T ', 'third_party/st/build && DISPLAY=:0.0 third_party/st/st'],
['raG F N ', './build && ../tst/ks'],
];
var numpadremap = [
[/[0-9] /, {'!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0',
'1': '!', '2': '@', '3': '#', '4': '$', '5': '%', '6': '^', '7': '&', '8': '*', '9': '(', '0': ')',
}],
];
// test
window.extended_macros.connom = [
['laL E ', function ()
@matvore
matvore / gist:301f2cf8ba0fc7699ddf26e55274a6bc
Created October 2, 2023 13:56
putc vs buffering benchmark
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
static FILE *fin, *fout;
static void byteperbyte(void)
{
int c;
# Use to build https://github.com/matvore/nfs-ganesha on macOS
cflags="-DHAVE_STRNLEN=1 -DHAVE_STRLCPY=1 -DHAVE_STRLCAT=1 \
-Wno-deprecated-declarations"
cmake --clean-first \
-DTIRPC_EPOLL:BOOL=OFF
-DBISON_EXECUTABLE:FILEPATH=$BREW_PREFIX/opt/bison/bin/bison \
-DUSE_FSAL_VFS:BOOL=OFF \
-DUSE_FSAL_XFS:BOOL=OFF \
<!doctype html>
<html>
<head>
<title>js-keygen</title>
<script>
// adapted from https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-08#appendix-C
function base64urlEncode(arg) {
const step1 = window.btoa(arg); // Regular base64 encoder
@matvore
matvore / foo.java
Last active August 20, 2018 17:19
Demonstrate encoding with ASCII and UTF-8
import java.io.*;
public final class foo {
public static void main(String[] args) throws Exception {
byte b[] = {(byte) 0x80, (byte) 0xe3, (byte) 0x81, (byte) 0xbb};
ByteArrayInputStream is = new ByteArrayInputStream(b);
Reader r = new InputStreamReader(is, "ASCII");
System.out.println("ASCII:");
while (true) {
int c = r.read();
$ hg outgoing
comparing with https://bitbucket.org/octobus/evolve-devel
searching for changes
changeset: 2633:fc64028a3dc0
user: Pulkit Goyal <[email protected]>
date: Tue Jul 04 17:10:21 2017 +0530
summary: prev: factor out the logic to update to previous commit to a new function
changeset: 2634:0ba8ae0ced24
user: Pulkit Goyal <[email protected]>
@matvore
matvore / gist:1fe576898b7cc42aa0cf41d102d0cc99
Created October 5, 2017 17:17
hg log -G -r "branch(default)"
$ hg log -G -r "branch(default)" (first 40 lines)
@ changeset: 3359:488c9223c1ad
| tag: tip
| parent: 3349:2d42bd025754
| user: Matt DeVore <[email protected]>
| date: Tue Oct 03 11:14:29 2017 -0700
| summary: obscache: do not check of argument count of wrapped function
|
| o changeset: 3358:7def8adf53d6
| | user: Pulkit Goyal <[email protected]>