Skip to content

Instantly share code, notes, and snippets.

@dskvr
dskvr / nip11.types.ts
Created August 30, 2024 15:21
types generated with NIP-11
export interface Types {
contact: string;
description: string;
fees?: Fees;
icon?: any;
language_tags?: string[];
limitation?: Limitation;
name: string;
payments_url?: any;
posting_policy?: any;
@dskvr
dskvr / nip11.serializer.ts
Last active August 30, 2024 15:21
generated with the nip11 json-schema
// To parse this data:
//
// import { Convert, Nip11 } from "./file";
//
// const nip11 = Convert.toNip11(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface Nip11 {
{
"content": "{\"contact\":\"[email protected]\",\"description\":\"Damus strfry relay\",\"name\":\"damus.io \",\"pubkey\":\"32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245\",\"software\":\"git+https://github.com/hoytech/strfry.git\",\"supported_nips\":[1,2,4,9,11,20,22,28,40,70],\"version\":\"0.9.2-88-g1d206d1ce9f2\"}",
"created_at": 1723894146,
"id": "3c2a8bf4f2625ad52b0f7f318a42d6c497f110ddcc3223b376513e1c4714c2fa",
"kind": 30166,
"pubkey": "9bbbb845e5b6c831c29789900769843ab43bb5047abe697870cb50b6fc9bf923",
"sig": "e35b240ed8c3438be0ded977eb528fb4b0490a27b63da38e478034ec0d34e7d72ae8725691de2778b2c2f486bbbb2a992ca0694237a4d43bbc411c15f336113d",
"tags": [
[
"d",
@dskvr
dskvr / bambu_lab-lovelace.yaml
Created June 7, 2024 13:53
Bambu Lab P1S Lovelace Dashboard
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:mushroom-title-card
title: Bambu Lab X1C
alignment: start
- type: custom:mod-card
card:
type: custom:mushroom-chips-card
@dskvr
dskvr / myrelay.page-nginx-strfry
Last active April 19, 2024 18:29
nginx configuration tips for myrelay.page and strfry
#important!
map $http_accept $upstream {
default 127.0.0.1:8080;
application/nostr+json 127.0.0.1:7777;
}
server {
...other stuff
location / {
@dskvr
dskvr / nip-fiatjaf-aneurysm.md
Last active March 28, 2024 14:56
maybe some useful bits in here for anyone who feels like entering the battle arena.

NIP-AND-FILTERS

Enable AND within a single tag filter by using an & modifier in filters for indexable tags.

filters: {
  "kinds": [1],
  "&t": ["meme", "cat"],
  "#t": ["black", "white"]
}
@dskvr
dskvr / package.json
Last active August 15, 2024 08:34
nostr gossip/outbox protocol event generator [proof of concept] ... earlier versions of this utilized NIP-66 but for the proof of concept I simplified it to ONLY account for online relays, as opposed to the full dataset of NIP-66. replace the API getter with a NIP-66 getter & map relay characteristics so you can utilize them when applying a bias.
{
"name": "gossip.events",
"type": "module",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"fast-safe-stringify": "2.1.1",
"node-cache": "5.1.2",
"nostr": "0.2.8"
@dskvr
dskvr / squash-all-retain-coauthors.sh
Last active November 28, 2023 02:20
Script to generate co-authored-by messages and then squash all commits in a branch. Retain github collaboration data
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Variables
BRANCH_TO_SQUASH="main"
NEW_BRANCH="legacy-squash"
DRY_RUN=true # Set to false to perform actual operations
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -504,6 +504,14 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
return set_error(serror, SCRIPT_ERR_MINIMALDATA);
}
stack.push_back(vchPushValue);
+ if ((flags & SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) && opcode == OP_FALSE) {
+ auto pc_tmp = pc;
+ opcodetype next_opcode;
+ valtype dummy_data;
@dskvr
dskvr / gist:db9d13b29a3bc9db0f3ef32e0d6f1d4d
Last active August 2, 2023 17:10
Unsigned experimental "user feed" gossip event using a "minimize connections" consolidation bias. Not complete due to being generated from an incomplete dataset. Goal of such a pattern would be to improve load speeds and client implementation simplicity. Utilizes 30303 events from nostr.watch to filter out offline relays
{
"created_at": 1690938995,
"content": "",
"kind": 34567
"tags": [
[
"d",
"6df59fbe7e2de656a864669d5003597613c5a2b1eb4d4bc7d904cd5a68cac775"
],
[