Skip to content

Instantly share code, notes, and snippets.

View elmariachi111's full-sized avatar
🦜
meow

Stefan Adolf elmariachi111

🦜
meow
View GitHub Profile
@elmariachi111
elmariachi111 / idx_ceramic.ts
Last active July 28, 2021 09:48
IPFS Samples
import CeramicClient from "@ceramicnetwork/http-client";
import { IDX } from "@ceramicstudio/idx";
import { Ed25519Provider } from "key-did-provider-ed25519";
import KeyResolver from "key-did-resolver";
import { DID } from "dids";
const seed = Buffer.from("c7943d32...d6edfcd","hex"); //32 random bytes
const did = new DID({
provider: new Ed25519Provider(seed),
resolver: KeyResolver.getResolver(),
@elmariachi111
elmariachi111 / CeMail.md
Created May 29, 2021 00:07
Web3Weekend idea: decentralized "email" on top of Ceramic Protocol / IPFS, ENS & maybe SMTP

CeMail

An SMTP compat "mail" client that uses Ceramic documents to sync & relay mail-like messages between identities. Roughly related to did-comm.

some fundamentals

The fundamental idea of a self sovereign identity is the "DID", a decentralized identifier, looking like did:key:zkmanycharacters. DIDs are uniquely identified by key material of an user, derived by some random seed only the user knows. DIDs can be resolved / expanded to DID documents that contain information about the public keys a user uses for communication and authentication purposes.

At its core, the Ceramic protocol uses DIDs to represent identities that are interacting with documents, atm did:3 and did:key are supported: https://developers.ceramic.network/learn/overview/#authentication. On top of Ceramic, IDX is adding a layer of well formed documents that contain additional information about the user, e.g. an user "profile".

@elmariachi111
elmariachi111 / Cargo.toml
Created May 21, 2021 21:20
Rust hyper http client sample
[package]
name = "testssl"
version = "0.1.0"
authors = ["Stefan Adolf <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = { version = "0.11.3", features = ["json"] }
const inp = 'b44861ea32a51020';
console.log(inp);
const square0 = Square.fromBytes(Buffer.from(inp, 'hex'));
Square.print(square0);
const bits = Square.toBinArray(square0);
console.log(bits);
const bytes = Square.bitsToBytes(bits);
console.log(bytes.toString("hex"));
//const square1 = Square.fromBytes(randBuffer(8));

NFTropy

NFtropy is about building new art based on composable collections of seed NFTs.

The baseline of NFTropy are 8x8 bitmap "tiles" that can be interpreted as bitmap pictures if you want so, e.g.

the binary hex string b44861ea32a51020 yields these bits:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ (index) β”‚ event β”‚ blockNumber β”‚ counter β”‚ fortytwo β”‚ to β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0 β”‚ 'Greeted' β”‚ 60 β”‚ '4' β”‚ '42' β”‚ '0x1A427eb5356ceA2434df4A0BC026978CC09f7CB4' β”‚
β”‚ 1 β”‚ 'Greeted' β”‚ 61 β”‚ '5' β”‚ '42' β”‚ '0x1A427eb5356ceA2434df4A0BC026978CC09f7CB4' β”‚
β”‚ 2 β”‚ 'Greeted' β”‚ 62 β”‚ '6' β”‚ '42' β”‚ '0x1A427eb5356ceA2434df4A0BC026978CC09f7CB4' β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ (index) β”‚ event β”‚ to β”‚ someValue β”‚ anotherValue β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
βœ… did:3:bafyreigmowwug5zyyax4yqdes3fwukp5gi6rjjlrxculnk64izea5hnrye βœ…
Create your profile today to start building social connection and trust online at https://3Box.io/
@elmariachi111
elmariachi111 / reactday.json
Created November 2, 2019 00:45
ReactDay Schema.org JSON-LD
{
"@context": "http://schema.org",
"@type": "BusinessEvent",
"startDate": "2019-12-06T08:30:00+01:00",
"endDate": "2019-12-06T22:00:00+01:00",
"name": "React Day Berlin 2019",
"url": "https://www.eventbrite.com/e/react-day-berlin-2019-tickets-61442110005",
"image": "https://img.evbuc.com/https%3A%2F%2Fcdn.evbuc.com%2Fimages%2F61772770%2F80020269147%2F1%2Foriginal.jpg?w=1000\u0026auto=compress\u0026rect=0%2C64%2C1920%2C960\u0026s=ddd233f8f2f07ec16e2b61d55bf9f0ba",
"eventStatus": "EventScheduled",
"offers": [
# -*- coding: utf-8 -*-
"""Cleaning_Feature_engineering.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1cyB8vww3lA0GhABA0mGJluHjfA0VnY5u
"""
from google.colab import drive
@elmariachi111
elmariachi111 / truncate.js
Created June 19, 2019 18:54
Javascript: truncate a text along punctuation marks
/*
assume you want to truncate a longer text to a certain amount of characters but you don't want to stop at
word boundaries. Instead lets cut the text at sentence ending punctuation marks like ! ? .
*/
function pos(str, char) {
let pos = 0
const ret = []
while ( (pos = str.indexOf(char, pos + 1)) != -1) {
ret.push(pos)