This is an example of receiveing ethereum address from a secp256k1 private key.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage is node exec.js app.js | |
// app.js should export default function | |
import path from 'path' | |
async function execute(filename) { | |
const {default: main} = await import( | |
path.resolve(filename) | |
) | |
return main({ |
Here is the complete example of LibP2P streams write and read client and server.
This code uses some utils. Like peer generation and ESM module apps runner. You can see it in uitls gist:
https://gist.github.com/rumkin/51bc6a346b40e6a303d1e1eba1f38199
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"> | |
<text y="100" font-size="100"> | |
😎 | |
</text> | |
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function * range(start, end, step = 1) { | |
if (start < end) { | |
while (start < end) { | |
yield start | |
start += step | |
} | |
} | |
else if (start > end) { | |
while (start > end) { | |
start -= step |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- new.patch 2020-03-02 14:15:28.000000000 +0300 | |
+++ old.patch 2020-03-02 14:16:08.000000000 +0300 | |
@@ -1,17 +1,17 @@ | |
-From 00bb40d8982cd986a37a8072691060a8b72ce11d Mon Sep 17 00:00:00 2001 | |
+From 054bc49da2332948df9e015d7353a94d3c162d52 Mon Sep 17 00:00:00 2001 | |
From: Pavel Rumkin <dev@rumk.in> | |
Date: Sat, 22 Feb 2020 09:31:44 +0300 | |
Subject: [PATCH 1/2] Add initialization method to prevent race conditions | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find-to-tar() { | |
local IN=${1:-.} | |
local OUT=${2:-archive.tar.gz} | |
find $IN -type f ! \( -path '*/node_modules/*' -o -path '*/dist/*' -o -path '*/build/*' \) | tar cvfz $OUT -T - | |
} | |
# Example: | |
# $ find-to-tar . arch.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract Registry { | |
bytes[] names; | |
mapping(bytes32 => Package) packages; | |
struct Package { | |
bytes name; | |
address owner; | |
uint8[] versions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >= 0.5.0; | |
contract Log { | |
address public owner; | |
event LogMsg(bytes message); | |
constructor(address _owner) public { | |
owner = _owner; | |
} |