Skip to content

Instantly share code, notes, and snippets.

View danielSanchezQ's full-sized avatar
πŸ¦€

Daniel Sanchez danielSanchezQ

πŸ¦€
View GitHub Profile
@danielSanchezQ
danielSanchezQ / operations_test.py
Created September 23, 2018 12:13
batching operations groping method
#! /user/bin/python3
from collections import defaultdict
from itertools import groupby
import operator
class Operation(object):
TAPE = []
RECORD = defaultdict(lambda: 0)
RESULTS = {}
OPERATIONS = {
@danielSanchezQ
danielSanchezQ / functor.rs
Created December 17, 2018 08:10
Functor trait and example rust
trait Functor <A, B, C, F> where F : Fn(&A) -> B {
fn fmap(&self, f: F) -> C;
}
enum List<T> {
Nil,
List(T, Box<List<T>>)
}
impl<A, B, F> Functor<A, B, List<B>, F> for List<A>
@danielSanchezQ
danielSanchezQ / MemLicker.hpp
Last active March 12, 2019 11:27
Memory tracking utility
#ifndef _MEM_LICKER_
#define _MEM_LICKER_
#include <unordered_map>
#include <iostream>
#include <string>
using namespace std;
using ptr = void*;
struct PtrData

Keybase proof

I hereby claim:

  • I am danielsanchezq on github.
  • I am netwave (https://keybase.io/netwave) on keybase.
  • I have a public key ASBVfZvvkvmyQlUIyK7jDaQsE8e9lIqAhHqjASkaZoIF2Qo

To claim this, I am signing this object:

#ifndef _MEM_LICKER_
#define _MEM_LICKER_
#include <unordered_map>
#include <iostream>
#include <string>
using namespace std;
using ptr = void*;
struct PtrData
@danielSanchezQ
danielSanchezQ / flatten_files_and_deserialize.rs
Created May 4, 2021 13:34
Stream deserialized content by appending different files stream data
use std::fs;
use std::io;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use bincode::Options;
type PersistentFragmentLog = String;
struct FileFragments {
@danielSanchezQ
danielSanchezQ / const_str_check.rs
Created January 31, 2022 12:53
Compile time str eq
use const_str;
pub trait Foo {
const ID: &'static str;
}
struct A;
struct B;
impl Foo for A {
@danielSanchezQ
danielSanchezQ / nomos-bench.py
Last active June 4, 2024 13:41
NomosDa benches
from collections import defaultdict
from math import ceil
benches_results = {
"proofs": {
128: 0.28,
256: 0.47,
512: 0.82,
1024: 1.39
},
encoder fastest β”‚ slowest β”‚ median β”‚ mean β”‚ samples β”‚ iters
╰─ encode β”‚ β”‚ β”‚ β”‚ β”‚
β”œβ”€ 32 β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”œβ”€ 128 436.8 ms β”‚ 436.8 ms β”‚ 436.8 ms β”‚ 436.8 ms β”‚ 1 β”‚ 1
β”‚ β”‚ 75.01 KB/s β”‚ 75.01 KB/s β”‚ 75.01 KB/s β”‚ 75.01 KB/s β”‚ β”‚
β”‚ β”œβ”€ 256 615 ms β”‚ 615 ms β”‚ 615 ms β”‚ 615 ms β”‚ 1 β”‚ 1
β”‚ β”‚ 53.27 KB/s β”‚ 53.27 KB/s β”‚ 53.27 KB/s β”‚ 53.27 KB/s β”‚ β”‚
β”‚ β”œβ”€ 512 1.112 s β”‚ 1.112 s β”‚ 1.112 s β”‚ 1.112 s β”‚ 1 β”‚ 1
β”‚ β”‚ 29.46 KB/s β”‚ 29.46 KB/s β”‚ 29.46 KB/s β”‚ 29.46 KB/s β”‚ β”‚
β”‚ β”œβ”€ 1024 1.853 s β”‚ 1.853 s β”‚ 1.853 s β”‚ 1.853 s β”‚ 1 β”‚ 1
verifier fastest β”‚ slowest β”‚ median β”‚ mean β”‚ samples β”‚ iters
╰─ verify β”‚ β”‚ β”‚ β”‚ β”‚
β”œβ”€ 32 β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”œβ”€ 128 36.91 ms β”‚ 36.91 ms β”‚ 36.91 ms β”‚ 36.91 ms β”‚ 1 β”‚ 30
β”‚ β”‚ 866.8 B/s β”‚ 866.8 B/s β”‚ 866.8 B/s β”‚ 866.8 B/s β”‚ β”‚
β”‚ β”œβ”€ 256 20.77 ms β”‚ 20.77 ms β”‚ 20.77 ms β”‚ 20.77 ms β”‚ 1 β”‚ 30
β”‚ β”‚ 1.54 KB/s β”‚ 1.54 KB/s β”‚ 1.54 KB/s β”‚ 1.54 KB/s β”‚ β”‚
β”‚ β”œβ”€ 512 12.56 ms β”‚ 12.56 ms β”‚ 12.56 ms β”‚ 12.56 ms β”‚ 1 β”‚ 30
β”‚ β”‚ 2.546 KB/s β”‚ 2.546 KB/s β”‚ 2.546 KB/s β”‚ 2.546 KB/s β”‚ β”‚
β”‚ β”œβ”€ 1024 8.469 ms β”‚ 8.469 ms β”‚ 8.469 ms β”‚ 8.469 ms β”‚ 1 β”‚ 30