Skip to content

Instantly share code, notes, and snippets.

View nothingmuch's full-sized avatar
🤔

Yuval Kogman nothingmuch

🤔
  • spiral
View GitHub Profile

Notes on foundational modules of Dat code:

Hypercore

Feeds

totally ordered sets of blocks encoded as merkle trees

static: pure merkle trees, created by merkle-tree-stream

node types are leaf, node & root
flat-tree numbers all nodes in tree for given tree size
tree root = hash of all roots (unless $|blocks| log 2 ∈ \mathbb{N}$)
stream is not written in flat-tree order, but a breadth first upwards walk of flat tree (0, 2, 1, 4, 6, 5, 3…)
#!/bin/bash
#https://wiki.archlinux.org/index.php/Core_utilities#Colored_output_when_reading_from_stdin
t=$(tempfile)
trap "rm '$t'" EXIT
script -q -c "$*" "$t" > /dev/null
stty sane
From 2acd388b62d527fd2e845aa58cc3784142ac1a7f Mon Sep 17 00:00:00 2001
From: Yuval Kogman <nothingmuch@woobling.org>
Date: Sun, 23 Sep 2012 23:09:25 +0200
Subject: [PATCH] Push PAD futzing to setup_frame
- during parse method all SvFAKEs which correspond to slots have their offsets
saved in a ptable
- the frame setup code will alias these slots to the pad
- pad ops are now back to normal behavior
@nothingmuch
nothingmuch / gist:2992133
Created June 25, 2012 23:41
root@dell:~# btrfs fi balance start -dconvert=single / Segmentation fault
[ 326.259124] ------------[ cut here ]------------
[ 326.259172] kernel BUG at /home/apw/COD/linux/fs/btrfs/volumes.c:2788!
[ 326.259220] invalid opcode: 0000 [#1] SMP
[ 326.259257] Modules linked in: zram(C) rfcomm bnep bluetooth snd_hda_codec_analog binfmt_misc snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi i915 snd_rawmidi psmouse snd_seq_midi_event snd_seq drm_kms_helper drm snd_timer i2c_algo_bit snd_seq_device snd dcdbas coretemp ppdev soundcore snd_page_alloc microcode serio_raw parport_pc video mei(C) mac_hid lp parport ses enclosure usbhid hid uas usb_storage e1000e btrfs zlib_deflate libcrc32c
[ 326.259663]
[ 326.259678] Pid: 3266, comm: btrfs Tainted: G C 3.4.4-030404-generic #201206221555 Dell Inc. OptiPlex 755 /0GM819
[ 326.259777] EIP: 0060:[<f873fc7a>] EFLAGS: 00010246 CPU: 0
[ 326.259840] EIP is at btrfs_balance+0x55a/0x560 [btrfs]
[ 326.259878] EAX: ffffff00 EBX: ffffffef ECX: 00000052 EDX: f714645c
[ 326.259923] ESI: dbdd7a00 EDI: 00000000 EB
var ajaxify_forms = function() {
$('form.validate').validate({
debug: true,
submitHandler: function (form) {
var before_submit = $(form).attr('beforeSubmit');
if ( before_submit.length ) {
var f;
eval("f = function () {" + before_submit + "}");
f.apply(form, []);
_update_prompt () {
if [ -z "$_dumb_prompt" ]; then
# if $_dumb_prompt isn't set, do something potentially expensive, e.g.:
git status --porcelain | perl -ne 'exit(1) if /^ /; exit(2) if /^[?]/'
case "$?" in
# handle all the normal cases
...
# but also add a case for exit due to SIGINT
#!/bin/bash
#
# PS1 magic
#
# Mostly copied from YUVAL KOGMAN version, added my own __git_ps1 stuff
# Original: http://gist.github.com/621452
#
# See video demo of this at http://vimeo.com/15789794
#
# To enable save as .bash_prompt in $HOME and add to .bashrc:
#!/bin/bash
_set_prompt () {
local exit=$?
#local black="30";
#local grey="31";
local red="31";
local green="32";
# <file system> <mount point> <type> <options> <dump> <pass>
some_dir /home/nothingmuch/some_dir vboxsf uid=nothingmuch,gid=nothingmuch 0 0
#!/bin/bash
VM="$( basename "$0" )"
if [ -n "$1" ]; then
# explicit control of the VM, e.g. `blah stop`
# useful commands are 'pause', 'resume', 'stop', etc
case "$1" in
status) VBoxManage showvminfo "$VM" | grep -i state ;;
*) VBoxManage controlvm "$VM" ${1/stop/acpipowerbutton} ;; # much easier to type