Skip to content

Instantly share code, notes, and snippets.

🦋

Eric Scrivner etscrivner

🦋
Block or report user

Report or block etscrivner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@etscrivner
etscrivner / feature_package_relay.py
Last active Oct 2, 2019
Add test that three transaction package relay fails.
View feature_package_relay.py
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test processing of two-transaction packages"""
from decimal import Decimal
from test_framework.messages import FromHex, CTransaction, msg_witness_tx
from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
View plot.gnu
set title 'Change Frequency By File'
set ylabel '# Changes'
set xlabel 'File'
plot 'output.txt' using 0:1
@etscrivner
etscrivner / cartographer_data_model.als
Created Apr 17, 2019
Alloy model of PSP data model
View cartographer_data_model.als
sig Defect {
phase : one Phase,
performance : one Performance,
type : one DefectType,
}
sig DefectType {}
fact DefectsBelongToAPhaseOfTheSameProcessAsItsPerformance {
all d : Defect | d.phase.process = d.performance.process
@etscrivner
etscrivner / peterson_multi.tla
Last active Jan 26, 2019
TLA+ implementation of Peterson's mutual exclusion algorithm. Demonstrates absence of deadlock and liveness given fair processes.
View peterson_multi.tla
--------------------------- MODULE peterson_multi ---------------------------
EXTENDS TLC, Integers, Sequences
CONSTANT ThreadCount
Threads == 1..ThreadCount
AllOtherFlagsLessThan(item, flags) ==
\A q \in Threads \ {item}: flags[q] < item
(*--algorithm peterson_multi
variables
View failure.rs
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Point<T> {
pub a : T,
pub b : T,
pub x : Option<T>,
pub y : Option<T>
}
impl<T> Point<T> {
pub fn infinity(a: T, b: T) -> Self {
@etscrivner
etscrivner / rpc_doctest.cpp
Last active Oct 5, 2018
Bitcoin RPC API documentation helper object prototype.
View rpc_doctest.cpp
#include <iostream>
#include <string>
#include <vector>
class RPCArgument {
public:
RPCArgument(const std::string& name,
const std::string& type,
const std::string& description,
bool required=false,
View benchmark.sh
#!/usr/bin/env ksh
#
# Benchmark Project Euler 1 programs by running them through same datsets
# several times and computing the average.
#
Values=(1000 10000 100000 1000000 10000000)
echo "${Values[@]}"
Programs=("./c_euler_1" "./haskell_euler_1")
@etscrivner
etscrivner / main.c
Created Apr 5, 2018
Exercise 1A. Write a program to estimate the mean and standard deviation of a sample of n real numbers. Use a linked list to hold the n numbers for the calculation.
View main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "result.h"
#include "number_list.h"
#include "population_statistics.h"
eResult read_numbers(NumberList *number_list)
@etscrivner
etscrivner / super_method_propagation.rb
Created Jun 19, 2017
Ruby propagates arguments up to super method calls for you
View super_method_propagation.rb
class Parent
def try_me(confirmed_only: true)
confirmed_only
end
end
class Child < Parent
def try_me(confirmed_only: true)
# Ruby will proxy the value of `confirmed_only` up to the super method invocation for you.
super
@etscrivner
etscrivner / base58checkencode.go
Created Jun 9, 2017
Base58Check Encoding In Go
View base58checkencode.go
package main
import (
"bytes"
"crypto/sha256"
"golang.org/x/crypto/ripemd160"
"fmt"
"math/big"
)
const Base58Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
You can’t perform that action at this time.