Skip to content

Instantly share code, notes, and snippets.

View melvincarvalho's full-sized avatar
💭
I may be slow to respond.

Melvin Carvalho melvincarvalho

💭
I may be slow to respond.
View GitHub Profile
@aidik
aidik / Nostr NIP-05 Nginx Only Configuration.md
Last active July 20, 2023 14:53
A simple way how to serve multiple NIP-05 Identifiers using only Nginx

Nostr NIP-05 specification makes it a bit harder to serve identifiers from a simple webserver without CGI to run an external program handling the name URL query parameter. I really didn't want to do all that, so instead I focused on how to handle everything just in Nginx itself.

Prerequisite

  • A server with Nginx responding to basic requests. (minimal configuration should be enough)

Config

Inside the http block insert map and map_hash_bucket_size directives:

map_hash_bucket_size 256;

map $arg_name $nostr_key {

#!/bin/bash
# Mirrors notes from one nostr relay to another.
#
# Example usage:
# nostr-mirror.sh wss://source.relay.example wss://target.relay.example
# Source relay to fetch events from (wss://...).
SOURCE=$1
# Target relay to send these events to (wss://...).
TARGET=$2
@eskema
eskema / nostr-rs-relay_no-docker.md
Last active July 18, 2023 08:42
How to install nostr-rs-relay on ubuntu without Docker

These are the steps I took to install and run a nostr relay on a new server.

First, you'll need the server, this tutorial is using the most basic server Hetzner provides (CX11 - €4.15/mo), you don't need much. If you don't know where to get your server from and decide to go with Hetzner, consider using my affiliate link: https://hetzner.cloud/?ref=4FZql6rUwaeQ

Once you have your server running, log into it via SSH. I'm on a MacOS, so I'll use Terminal as my command line tool. open a new Terminal window and paste the following commands:

[
"076161ca22da5a2ab8c74465cbf08f79f3e7e8bb31f4dc211bd94319ebade03d",
"5a462fa6044b4b8da318528a6987a45e3adf832bd1c64bd6910eacfecdf07541",
"1bbb8324577ac089607e45813bac499ebdab4621d029f8c02b2c82b4410fd3f4",
"e9e4276490374a0daf7759fd5f475deff6ffb9b0fc5fa98c902b5f4b2fe3bba2",
"887645fef0ce0c3c1218d2f5d8e6132a19304cdc57cd20281d082f38cfea0072",
"ce5061bfcc16476b9bde3f1d5b3ec7730c4361cf8c827fbd9c14eb8c7003a1de",
"22e804d26ed16b68db5259e78449e96dab5d464c8f470bda3eb1a70467f2c793",
"ff24202025283c90d05337559b8ad7e3e0b811726d1cbb400a9b698cd7a01780",
"b0635d6a9851d3aed0cd6c495b282167acf761729078d975fc341b22650b07b9",
[
"ed1d0e1f743a7d19aa2dfb0162df73bacdbc699f67cc55bb91a98c35f7deac69",
"fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
"e668a111aa647e63ef587c17fb0e2513d5c2859cd8d389563c7640ffea1fc216",
"1bbb8324577ac089607e45813bac499ebdab4621d029f8c02b2c82b4410fd3f4",
"51535ad9f0e13a810f73ea8829a79b3733bd1fffb767c4885990b02f59103a13",
"2508ed2c2ab3f6728a880fafbc0895a2afeacbb74eb69847255fb60564af0d85",
"3707f1efc7515524dce41d3bf50bfd9fdaed3494620b5f94fcf16d2766da4ec2",
"dbab9040bc1f0c436b0f92f517702498358edc1fde2c7884d0e1036c739d44f3",
"ad5aab5be883a571ea37b231cd996d37522e77d0f121cedfd6787b91d848268e",
@freeberty
freeberty / Dockerfile
Last active January 2, 2022 09:36 — forked from Dolu89/Dockerfile
Nostr relay docker (WIP)
FROM golang:1.15.5
WORKDIR /go/src/app
COPY ./relayer .
RUN go get -d -v ./...
RUN go install -v ./...
RUN cd basic && make
@RubenSomsen
RubenSomsen / BMM.md
Last active November 14, 2023 02:21
Blind Merged Mining with covenants ( sighash_anyprevout / op_ctv )

Blind Merged Mining with covenants ( sighash_anyprevout / op_ctv )

Update: the content of this gist is also explained in this Spacechains video.

This write-up was also published on bitcoin-dev.

Blind Merged Mining (BMM) is the idea of committing the hash of another blockchain into a unique location on the Bitcoin blockchain, and paying a Bitcoin fee to miners for the privilege of deciding this hash and capturing the fees inside the other blockchain. Since miners don’t have to know what the hash represents and are simply incentivized to choose the highest bidder, it requires no extra validation on their part (“blind”). This idea was originally conceived of by Paul Sztorc, but required a specific soft fork. [0]

In essence, BMM is a mechanism that allows external blockchains (altcoins, tokens) to outsource their mining to the Bitcoin blockchain. Instead of burning electricity with ASICs, th

@melvincarvalho
melvincarvalho / add bookmark
Created July 30, 2019 12:18
add bookmark
const user = 'https://melvincarvalho.com/#me';
const time = new Date().toISOString();
const title = document.title;
const recalls = location.href;
const ms = Math.floor(Math.random() * 1000);
const uri = time.substring(0,4) + time.substring(5,7) + time.substring(8,10) + time.substring(11,13) + time.substring(14,16) + time.substring (17,19) + "." + ms;
console.log(`
<> <http://purl.org/dc/terms/references> <#${uri}> .\n
\n
<#${uri}>\n
@melvincarvalho
melvincarvalho / solid-live-server.js
Created July 25, 2019 13:08
solid-live-server.js
#!/usr/bin/env node
const WebSocket = require('ws')
const WebSocketServer = require('ws').Server
const fs = require('fs')
const uuid = require('uuid')
const handler = require('serve-handler');
const https = require('https');
const INotifyWait = require('inotifywait')
const parallel = require('run-parallel')