Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Graczyk mgraczyk

View GitHub Profile
View perlin2.go
func (state *NodeActor) Receive(ctx actor.Context) {
switch msg := ctx.Message().(type) {
// ... Other cases for starting, stopping
case *messages.QueryRequest:
// ...
case *messages.ApiReceiveTransaction:
// ...
}
View perlin1.go
message Node {
map<string, Transaction> queried = 1;
map<string, Transaction> transactions = 2;
map<uint64, ConflictSet> conflicts = 3;
map<string, uint64> chits = 4;
}
@mgraczyk
mgraczyk / event_loop.go
Created Jun 27, 2018
Perlin Avalanche Code Review
View event_loop.go
func (state *NodeActor) Receive(ctx actor.Context) {
switch msg := ctx.Message().(type) {
// [OT] ... Other cases for starting, stopping
case *messages.QueryRequest:
response := &messages.QueryResponse{}
if msg.Transaction != nil && msg.Transaction.Verify() {
stronglyPreferred := state.node.OnQueryTx(msg.Transaction)
response.Transaction = msg.Transaction.Id
View hashgraph_gossip.py
import numpy as np
import sys
from random import randint
from math import ceil
def run_simulation(N, sims):
threshold = int(0.5 + 2. * N / 3)
print('{} / {}'.format(threshold, N))
results = []
@mgraczyk
mgraczyk / fix_keras_model.py
Last active Aug 29, 2019
Fix input_dtype errors in pre-2.0 keras model H5FS files
View fix_keras_model.py
# Usage: fix_keras_model.py old_model.h5 new_model.h5
import h5py
import shutil
import json
import sys
input_model_path = sys.argv[1]
output_model_path = sys.argv[2]
shutil.copyfile(input_model_path, output_model_path)
You can’t perform that action at this time.