Skip to content

Instantly share code, notes, and snippets.

View dpaez's full-sized avatar
🥃
Check out SHER: https://sher.app 🎙️

Diego dpaez

🥃
Check out SHER: https://sher.app 🎙️
View GitHub Profile

Hyperswarm DHT setup

Checking your network for P2Pness

Running a node

Running a dht node is as simple as installing the DHT cli.

npm i -g @hyperswarm/cli
$ node stream-heap.js
Readable 358.53592 134
Writable 623.37824 258
Transform 709.05584 1310
$ node pull-heap.js
values 155.2692 70
map 84.50328 7
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

Can we create a smart contract VM on nodejs using Dat?

Ethereum is a trustless network of VMs which run smart contracts submitted by users. It uses proof-of-work to synchronize state across the network, and has every node execute the contracts in order to verify the state's validity. Each transaction is stored in the blockchain for replayability. Read more about it here.

Ethereum's "trustless network" model has some disadvantages:

  • Transaction processing is slow - it maxes at roughly 25tx/s right now for all contracts combined.
  • Every transaction costs money to execute.
  • The entire blockchain state must be shared across the computing network.
  • No private transactions.

Using Dat with a github.io domain

https://i.imgur.com/akOrIOq.png

My personl site is hosted at hashbase.io (link) so that you can access it via dat and https. My canonical dat url is dat://pfrazee.hashbase.io.

Before I used hashbase I used Github Pages, and today it dawned on me that I can have dat://pfrazee.github.io work too. It's pretty simple if you know the dat dns spec.

All I had to do was add /.well-known/dat to my site (click to view). I put the raw dat URL of my site in that file, along with a TTL.

@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 15, 2024 09:41
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@tinchoz49
tinchoz49 / index.js
Last active March 10, 2017 21:24
subpatching with snabbdom and flyd
const flyd = require('flyd');
const snabbdom = require('snabbdom');
const htmldomapi = require('snabbdom/htmldomapi').default;
htmldomapi.removeChild = (node, child) => {
if (node && child) {
node.removeChild(child);
}
};
const patch = snabbdom.init([], htmldomapi);
const h = require('snabbdom/h').default;
@Fi5t
Fi5t / install_tmux_osx_no_brew
Last active July 24, 2019 07:33 — forked from shrayasr/OLD_OLD_OLD_install_tmux_osx_no_brew.html
Install tmux on OSX WITHOUT brew
# Create a directory
mkdir ~/tmux-install
cd ~/tmux-install
# Get the files
curl -OL https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
curl -OL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
# Extract them
tar xzf tmux-2.3.tar.gz
@tinchoz49
tinchoz49 / .vimrc
Last active December 31, 2016 21:19
my vimrc
set shell=/bin/bash
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'vim-syntastic/syntastic', { 'do': 'npm install -g resolve-eslint' }
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'terryma/vim-multiple-cursors'
"Plug 'Raimondi/delimitMate'