Skip to content

Instantly share code, notes, and snippets.

@kanaka
kanaka / foo.cljs
Created November 4, 2022 15:38
Example nbb script using neodoc and promesa (and shell invoke trick)
#!/bin/bash
true;exec "$(dirname $0)/node_modules/.bin/nbb" "$(which "$0")" "$@" || exit
(ns foo
(:require [clojure.string :as S]
[clojure.pprint :refer [pprint]]
[promesa.core :as P]
[cljs-bean.core :refer [->clj ->js]]
["fs/promises" :as fs]
["path" :as path]
@kanaka
kanaka / sshping.py
Created September 16, 2022 15:05
sshping - create ssh connect and measure character typing latency (send single character until it appears)
#!/usr/bin/env python
# You may use this under an MIT license
from time import time, sleep
from signal import signal, SIGINT
import subprocess
import sys
def write_read(p):
@kanaka
kanaka / Dockerfile
Last active October 7, 2021 16:46
podman non-deterministic /sys mounting behavior bug (https://github.com/containers/podman/issues/11887)
FROM ubuntu:20.04 as base
RUN apt-get -y update
RUN apt-get -y install iproute2
@kanaka
kanaka / Dockerfile
Last active October 5, 2021 14:31
Containerized systemd startup race condition reproducer (https://github.com/systemd/systemd/issues/20939)
FROM ubuntu:20.04
#FROM ubuntu:21.10
RUN apt-get -y update # 6
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
ENV container docker
RUN apt-get -y install systemd ifupdown net-tools isc-dhcp-client
RUN systemctl enable networking && \
@kanaka
kanaka / debut.out
Created August 21, 2020 17:18
mal prolog step6 debug
$ make DOCKERIZE=1 docker-shell^prolog
06274d225e7c:/mal/impls/prolog$
 06274d225e7c:/mal/impls/prolog$ swipl ../prolog/step6_file.pl ../tests/print_argv.mal aaa bb
bb ccc
EVAL: (def! not (fn* [a] (if a false true))) in *:<fn> +:<fn> -:<fn> /:<fn> <:<fn> <=:<fn> =:<fn> >:<fn> >=:<fn> apply:<fn> assoc:<fn> atom:<fn> atom?:<fn> concat:<fn> conj:<fn> cons:<fn> contains?:<fn> count:<fn> deref:<fn> dissoc:<fn> empty?:<fn> eval:<fn> false?:<fn> first:<fn> fn?:<fn> get:<fn> hash-map:<fn> keys:<fn> keyword:<fn> keyword?:<fn> list:<fn> list?:<fn> macro?:<fn> map:<fn> map?:<fn> meta:<fn> nil?:<fn> nth:<fn> number?:<fn> pr-str:<fn> println:<fn> prn:<fn> prolog-asserta:<fn> prolog-call:<fn> read-string:<fn> readline:<fn> reset!:<fn> rest:<fn> seq:<fn> sequential?:<fn> slurp:<fn> str:<fn> string?:<fn> swap!:<fn> symbol:<fn> symbol?:<fn> throw:<fn> time-ms:<fn> true?:<fn> vals:<fn> vec:<fn> vector:<fn> vector?:<fn> with-meta:<fn>
EVAL: (fn* [a] (if a false true)) in *:<fn> +:<fn> -:<fn> /:<fn> <:<fn> <=:<fn> =
@kanaka
kanaka / 00readme.txt
Last active August 15, 2019 15:41
Debugging of servo webdriver crash (https://github.com/servo/servo/issues/23905)
# Start servo in headless mode with webdriver
./mach run --release -z --webdriver=7002 --resolution=400x300
# Put test4.html, rend.css and norm.css in current directory
# Start a simple webserver
python3 -m http.server 9080
# Repeatedly load test4.html test file until servo crashes
time ./load_test4.sh
@kanaka
kanaka / output.sh
Created April 15, 2019 23:11
wasmtime wasi path_open issue
$ env RUST_LOG=wasmtime_wasi=trace wasmtime -d --dir=/ ./stepA_mal.wasm
TRACE wasmtime_wasi::syscalls > args_sizes_get(argc=0x8a4, argv_buf_size=0x8ac)
TRACE wasmtime_wasi::syscalls > | *argc=1
TRACE wasmtime_wasi::syscalls > | *argv_buf_size=15
TRACE wasmtime_wasi::syscalls > -> errno=__WASI_ESUCCESS
TRACE wasmtime_wasi::syscalls > args_get(argv=0x8b4, argv_buf=0x8b8)
TRACE wasmtime_wasi::syscalls > -> errno=__WASI_ESUCCESS
TRACE wasmtime_wasi::syscalls > fd_write(fd=1, iovs=0x834, iovs_len=1, nwritten=0x82c)
Mal [WebAssembly]
TRACE wasmtime_wasi::syscalls > | *nwritten=18
@kanaka
kanaka / nvd3_label_bug.html
Created March 27, 2019 18:16
Test case for nvd3 labels not updating correctly
<html>
<head>
<meta charset="utf-8">
<link href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.6/nv.d3.min.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.6/nv.d3.min.js"></script>
<style>
text {
font: 12px sans-serif;
@kanaka
kanaka / loccount_mal_badtype.js
Last active March 8, 2019 20:52
Filter loccount output to show misidentified mal files
#!/usr/bin/env node
const VERBOSE = process.argv.indexOf('-v') > 0
const fs = require('fs')
const re_ignore = /^$|^[^\/]+ |^docs\/|^tests\/|\.css CSS|\.h C-header|\.md Markdown/
//const re_ignore = /^$|^[^\/]+ |^docs\/|^tests\//
const re_loc = /([^\/]+)\/([^ ]+) ([^ ]+) ([0-9]+) ([0-9]+)/
const lines = fs.readFileSync(0, 'utf-8').split('\n')
// implementation directory to file type mapping
@kanaka
kanaka / example.sh
Last active December 15, 2018 19:32
Brave headless webdriver test/bug
$ grep VER /etc/*release*
/etc/os-release:VERSION="16.04.2 LTS (Xenial Xerus)"
/etc/os-release:VERSION_ID="16.04"
/etc/os-release:VERSION_CODENAME=xenial
$ uname -a
Linux kanaka 4.4.0-43-generic #63-Ubuntu SMP Wed Oct 12 13:48:03 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ python3 -m http.server 9080 &