Skip to content

Instantly share code, notes, and snippets.

View dylanlott's full-sized avatar
🏗️
Hacking

d7t dylanlott

🏗️
Hacking
View GitHub Profile
diff --git a/persistence/state.go b/persistence/trees/trees.go
index e8252d6f..cd0d2302 100644
--- a/persistence/state.go
+++ b/persistence/trees/trees.go
@@ -1,29 +1,64 @@
-package persistence
+// package trees maintains a set of sparse merkle trees
+// each backed by the KVStore interface. It offers an atomic
+// commit and rollback mechanism for interacting with
+// that core resource map of merkle trees.
@dylanlott
dylanlott / tree-store-diff.txt
Last active June 9, 2023 18:22
Diff between state.go and trees.go after being refactored in persistence/tree-store
`git diff main:persistence/state.go persistence/tree-store:persistence/trees/trees.go > tree-store-diff.txt`
---
diff --git a/persistence/state.go b/persistence/trees/trees.go
index e8252d6f..cd0d2302 100644
--- a/persistence/state.go
+++ b/persistence/trees/trees.go
@@ -1,29 +1,64 @@
-package persistence
@dylanlott
dylanlott / dns_lookup.go
Created May 3, 2019 02:51 — forked from miguelmota/dns_lookup.go
Golang DNS lookup (ip, mx, txt, etc)
package main
import (
"fmt"
"net"
)
func main() {
ips, err := net.LookupIP("google.com")
if err != nil {
@dylanlott
dylanlott / AesUtil.js
Created March 12, 2019 20:55 — forked from AndiDittrich/AesUtil.js
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// ----------------------------------------------------------------------------------------
// the encrypted datablock is base64 encoded for easy data exchange.
// if you have the option to store data binary save consider to remove the encoding to reduce storage size
// ----------------------------------------------------------------------------------------
// format of encrypted data - used by this example. not an official format
//
// +--------------------+-----------------------+----------------+----------------+
// | SALT | Initialization Vector | Auth Tag | Payload |
// | Used to derive key | AES GCM XOR Init | Data Integrity | Encrypted Data |
@dylanlott
dylanlott / duptools.sh
Created January 21, 2019 23:30 — forked from tsileo/duptools.sh
A bash script to simplify backup management with duplicity (encrypted incremental backups on amazon S3)
#!/bin/bash
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
export PASSPHRASE=YOU_PASSHRASE
# directories, space separated
SOURCE="/home/thomas/backup /home/thomas/bin /home/thomas/documents"
BUCKET=s3+http://mybucket
LOGFILE=/home/thomas/tmp/duplicity.log
# set email to receive a backup report
@dylanlott
dylanlott / dht-walkthrough.md
Created August 8, 2018 22:28 — forked from gubatron/dht-walkthrough.md
DHT walkthrough notes

DHT Walkthrough Notes

I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.

What problem does this solve?

400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros. The number of atoms in the universe is estimated to be around 10^82. A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48

// `npm install axios lodash && node teem_interview_solutions.js`
const axios = require('axios')
const _ = require('lodash')
const collections = {
'1': [10, 25, 13],
'2': [14, 23, 47],
'3': [14, 36, 23]
}
@dylanlott
dylanlott / default.conf
Created May 17, 2017 17:54
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@dylanlott
dylanlott / docker-flightplan.md
Created April 12, 2017 18:42
Simple and quick way to achieve automated Docker builds.

Simple, Autmoated Builds with Docker and Flightplan.js

Using https://github.com/pstadler/flightplan

I was looking for a quick and easy way to do deployments with JavaScript without having to setup a full jenkins server, connect my GitHub accounts, etc...

I've written in the past on how imoprtant it is to get your side project deployed as fast as you can - almost before you do anything else - so that you have a rapid feedback cycle, and so that you have something tangible to show others and something that will make you more inclined to work on it.

@dylanlott
dylanlott / sinon-chai-expect.md
Created March 21, 2017 22:27 — forked from patocallaghan/sinon-chai-expect.md
Sinon Chai assertions in expect style.Examples from http://chaijs.com/plugins/sinon-chai #sinon #chai #javascript

Sinon JS

##Spies

//Anonymous function
var spy = sinon.spy();

//Provided Function
var spy = sinon.spy(myFunc);