Skip to content

Instantly share code, notes, and snippets.

View bumi's full-sized avatar

Michael Bumann bumi

View GitHub Profile
@bumi
bumi / nwc-openai.mjs
Created July 14, 2023 12:55
NWC, L402, OpenAI example
View nwc-openai.mjs
import { fetchWithL402 } from "alby-tools";
import { webln } from "alby-js-sdk";
import 'websocket-polyfill';
import * as crypto from 'crypto'; // or 'node:crypto'
globalThis.crypto = crypto;
const nwcURL = process.env.NWC_URL;
async function main() {
const nwc = new webln.NWC({ nostrWalletConnectUrl: nwcURL });
@bumi
bumi / podcast-lnurl-value.js
Created May 3, 2022 17:09
podcast index with lnurl
View podcast-lnurl-value.js
<podcast:value type="lightning" method="lnurl" suggested="0.00000015000">
<podcast:valueRecipient
name="Foo"
type="lnurl"
address="foo@example.com"
/>
</podcast:value>
@bumi
bumi / lnme.html
Created July 11, 2021 10:04
ln me example
View lnme.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>LnMe</title>
</head>
<link rel="stylesheet" href="/files/assets/lnme.css" id="lnme-style">
<body>
@bumi
bumi / lnd-tor.go
Created November 2, 2020 20:27
This is an example on how to connect to the LND gRPC interface through tor
View lnd-tor.go
package main
import (
"context"
"crypto/x509"
"encoding/hex"
"fmt"
"log"
"net"
"time"
View lnd.php
<?php
// Path to autoload.php created by composer.
require dirname(__FILE__).'/../vendor/autoload.php';
error_reporting(2);
$lndIp = ''; // IP:PORT
$sslCert = '';
View gemfile-parser.rb
require 'bundler'
gemfile = Bundler::Dsl.new
gemfile.eval_gemfile(ENV['BUNDLE_GEMFILE'] || 'Gemfile')
dependencies = gemfile.dependencies
# specs = dependencies.map(&:to_spec)
dependencies.each do |d|
begin
spec = d.to_spec
@bumi
bumi / PKGBUILD
Last active May 19, 2020 08:45
PKGBUILD for screen.so
View PKGBUILD
# Maintainer: Michael Bumann <hello@michaelbumann.com>
pkgname=screen-desktop
pkgver=1.2.0
pkgrel=1
pkgdesc="Desktop client for screen.so"
arch=('x86_64')
url="https://screen.so"
license=('unknown')
depends=()
makedepends=('libarchive')
@bumi
bumi / yjs-pg-server.js
Created March 20, 2020 10:04
implementation of a websocket server storing yjs documents in a postgresql database
View yjs-pg-server.js
const WebSocket = require('ws');
const http = require('http');
const Y = require('yjs');
const wsUtils = require('./utils');
const cookie = require('cookie');
const QuillDelta = require('quill-delta');
//const QuillConverter = require('node-quill-converter');
//const MdastFromQuillDelta = require('mdast-util-from-quill-delta');
View gist:1b6de0f8b2b47a458f7a779264268521
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://ipfs.kosmos.org:5444/api/v0/id?stream-channels=true. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
=> https://github.com/INFURA/tutorials/wiki/IPFS-and-CORS#configuration-of-cors
=> https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default