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
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 / 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
@etscrivner
etscrivner / picture-language.rkt
Created May 27, 2015
Complete racket source code for playing with the SICP picture language.
View picture-language.rkt
#lang racket/gui
(require graphics/graphics)
(open-graphics)
(define vp (open-viewport "A Picture Language" 500 500))
(define draw (draw-viewport vp))
(define (clear) ((clear-viewport vp)))
(define line (draw-line vp))
(define (make-vect x y)
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,
@etscrivner
etscrivner / without_gevent.py
Created Sep 24, 2014
Querying google without gevent
View without_gevent.py
import requests
def read_google(q):
return requests.get('https://www.google.com', params={'q': q})
def bunch_of_requests():
results = []
for i in range(100):
@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)
You can’t perform that action at this time.