Skip to content

Instantly share code, notes, and snippets.

View hoytech's full-sized avatar

Doug Hoyte hoytech

View GitHub Profile
// https://www.reddit.com/r/ethdev/comments/7jyzlw/50_in_ether_prize_for_puzzle_in_this_tweet/
// npm i bip39 ethereumjs-wallet allcombinations shuffle-array
const bip39 = require("bip39");
const hdkey = require('ethereumjs-wallet/hdkey');
const allcombinations = require('allcombinations');
const shuffle = require('shuffle-array');
let words = 'bright summer public tenant avocado chef depend romance school reason help start';
@hoytech
hoytech / mmap-demo.pl
Created December 15, 2016 15:34
Demonstration of page table population
use strict;
use File::Map;
use Digest::MD5;
my $filename = shift || die "usage: $0 <file>";
rss("Before map");
{
@hoytech
hoytech / snswaps.pl
Created February 16, 2016 00:18
Investigate average swaps considering 0-1 versus permutation
#!/usr/bin/env perl
# https://github.com/jgamble/Algorithm-Networksort/issues/8#issuecomment-184251064
use common::sense;
use Algorithm::Networksort;
use Math::Combinatorics;
@hoytech
hoytech / sn-stabiliser.pl
Created February 12, 2016 19:19
Use a non-stable sorting network to do a stable sort
use Algorithm::Networksort qw(:all);
use strict;
my @orig_arr = (9, "2 A", 3, 0, 4, "2 B", 7, "2 C", 1, "2 D");
my @network = nw_comparators(scalar @orig_arr, algorithm => 'best');
{
my @arr = @orig_arr;
@hoytech
hoytech / ssh-race.sh
Created February 3, 2016 18:58
Race condition with ssh -tt
ssh -o ServerAliveInterval=30 -o ControlPersist=no -2MNx -S .junk_socket localhost &
MAINPID=$!
sleep 1
ssh -tt -S .junk_socket localhost -- id &
PID1=$!
sleep 1 # <-- comment out this sleep to trigger race condition
ssh -tt -S .junk_socket localhost -- id &