Skip to content

Instantly share code, notes, and snippets.

View markodayan's full-sized avatar
🍑

Mark Odayan markodayan

🍑
View GitHub Profile

Fun parts of developing noble-hashes and scure-base

  • Base58 is quadratic (O(n^2)). Basically you can’t encode 1MB of data with it. This has been found with our DoS tests, which we employ for scure-base and noble-hashes. See README for more details
  • Hashes are additionally tested against huge multi-gig inputs, scrypt/pbkdf2 are tested against all possible combination of options. They take 2 hours to run on a decent machine
  • Hashes are actually faster than many wasm alternatives. A single sha256 hashing of 32 bytes of data takes 888 nanoseconds on mac with M1
  • The last fact is extremely remarkable, because we do not employ loop unrolls in the code. A loop unroll is when you’re writing code which could have been executed in loop like for (let step = 0; step < 64), but instead, you’re writing every iteration step-by-step. Which incr
@markodayan
markodayan / package-sub.json
Last active December 30, 2021 15:04
TypeScript Starter script
{
"main": "index.js",
"scripts": {
"clean": "rimraf dist",
"start": "NODE_ENV=production node -r ts-node/register/transpile-only -r tsconfig-paths/register ./dist/index.js",
"build": "npm run clean && tsc",
"dev": "NODE_ENV=development ts-node-dev -r tsconfig-paths/register ./src/index.ts",
"test": "mocha -r ts-node/register \"src/test/**/*.spec.ts\"",
"pm2:dev": "npm run build && pm2 start pm2_dev.config.js",
"pm2:prod": "npm run build && pm2 start pm2_prod.config.js",
@yorickdowne
yorickdowne / GethBEHAVE.md
Last active May 23, 2024 03:03
Pruning Geth 1.10.x, 1.11.x, 1.12.x

Note: PBSS in Geth >=1.13.0 removes the need to prune manually.


Old content for reference

Overview

Geth (Go-Ethereum) as of July 2022 takes about 650 GiB of space on a fast/snap sync, and then grows by ~ 14 GiB/week with default cache, ~ 8 GiB/week with more cache.

[
{
"name": "Priority: Critical",
"description": null,
"color": "b60205"
},
{
"name": "Priority: High",
"description": null,
"color": "d93f0b"
@HichamBenjelloun
HichamBenjelloun / memoize-recursive.js
Last active January 2, 2022 21:38
Memoizing recursive functions
const memoizeFactory = hashFn => fn => {
const memoize = fn => {
const cache = {};
return (...args) => {
const key = hashFn(args);
if (key in cache) {
return cache[key];
}
@Ryanb58
Ryanb58 / install.md
Last active June 25, 2024 19:59
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@MauricioMoraes
MauricioMoraes / access_postgresql_with_docker.md
Last active June 28, 2024 16:17
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

@JPvRiel
JPvRiel / ubuntu_mirror_selection.md
Last active April 11, 2023 00:49
Ubuntu mirror selection and package downloads for South Africa using nmap and curl to manually test latency and throughput

A quick set of notes looking into Ubuntu mirror locations for South Africa from my home fiber (Vumatel). The examples should apply in general.

Debian Package Info and Downloads

There are two phases

  1. Getting lists of packages
  2. The actual package download

When testing performance of package list info downloads via upt-get update, clear previous package info downloaded. If this isn't done, cached package info could skew results.

@eyecatchup
eyecatchup / ascii-binary-converter.js
Last active November 6, 2023 20:03
JavaScript native ASCII to Binary / Binary to ASCII convert functions.
// ABC - a generic, native JS (A)scii(B)inary(C)onverter.
// (c) 2013 Stephan Schmitz <eyecatchup@gmail.com>
// License: MIT, http://eyecatchup.mit-license.org
// URL: https://gist.github.com/eyecatchup/6742657
var ABC = {
toAscii: function(bin) {
return bin.replace(/\s*[01]{8}\s*/g, function(bin) {
return String.fromCharCode(parseInt(bin, 2))
})
},