Skip to content

Instantly share code, notes, and snippets.

@dskvr
dskvr / fjb.sh
Last active September 5, 2024 23:54
find bitcoin block number with a provided timestamp
#!/bin/bash
# USAGE:
# fjb.sh <timestamp>
# returns: <blocknum>
TIMESTAMP=$1
LOWER=0
UPPER=$(bitcoin-cli getblockcount)
@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"]
}
@SnowCait
SnowCait / NostrTextUploader.md
Last active April 23, 2024 13:51
Nostr テキストアップローダー

概要

画像アップローダーとほぼ同じ。

メリット

  • 削除可能
  • 編集履歴
  • NIP-98 認証 → フォローユーザーに限定することで鍵垢の実装が可能
@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"
--- 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;
@danieltorscho
danieltorscho / on-merge-deploy-to-do.md
Last active October 19, 2024 19:48
GitHub Actions deploy nodejs to DigitalOcean Droplet

Github deployment

Requirements:

  • DigitalOcean Droplet (Ubuntu 20.04+) should be created
  • Github repository

Prepare DO Droplet Server:

  • ssh root@DROPLET_IP
  • sudo vi /etc/ssh/sshd_config
  • change PasswordAuthentication from no to yes
@areknawo
areknawo / LazyHydrate.vue
Created August 13, 2021 11:18
Vue 3 lazy hydration component
<script lang="ts">
import { defineComponent, onMounted, PropType, ref, watch } from "vue";
type VoidFunction = () => void;
const isBrowser = () => {
return typeof window === "object";
};
export default defineComponent({
props: {
@BrendonKoz
BrendonKoz / leaflet-darkmode.md
Last active September 25, 2024 19:25
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]
swagger: '2.0'
info: {title: ClickUp 2.0, version: ''}
host: api.clickup.com
basePath: /api/v2
schemes: [https]
paths:
/task/{task_id}/attachment:
post:
responses:
'200':
@AlexxNB
AlexxNB / widget.md
Last active November 6, 2024 00:42
Howto make no-depends widget on Svelte and load it on the page

We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':

  1. Our widget Widget.svelte:
<script>
	export let name;
</script>

<h1>Hello {name}!</h1>