Skip to content

Instantly share code, notes, and snippets.

@leesalminen
leesalminen / Dockerfile
Last active January 12, 2023 21:55
torrent http proxy
FROM node:18
WORKDIR /workspace
COPY package.json /workspace
COPY index.js /workspace
RUN npm install
EXPOSE 8080
map $sent_http_access_control_allow_origin $cors {
default "";
"" "*";
}
location ~* /proxy/(?<pschema>https?):/(?<phost>[\w.]+)(?<puri>\/.*) {
set $adr $pschema://$phost;
rewrite .* $puri break;
resolver 8.8.8.8;
proxy_pass $adr;
@leesalminen
leesalminen / gist:801e50a2d6034b05fa39da982c8f0c40
Last active February 11, 2023 03:22
How to Set Up Your Own nostr-rs-relay

Domain Name

First, ensure you have access to modify the DNS settings for a domain name you want to use.

VM

Next, ensure you get a virtual machine from your favorite provider. For a private-ish, friends/family relay, get something with 2GB RAM. YMMV. Make sure you choose Ubuntu Server 20.04 or 22.04.

Map DNS A record to IP of VM machine

server {
// you should have something like this already in your config, don't use mine. keep yours.
location / {
proxy_pass http://127.0.0.1:23000;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Vue.component("LNURLWithdrawContactless", {
data: function () {
return {
supported: ('NDEFReader' in window && window.self === window.top),
scanning: false,
submitting: false,
readerAbortController: null,
}
},
methods: {
@leesalminen
leesalminen / lnurlwnfc.js
Created August 23, 2022 16:25
improve btcpayserver lnurlwnfc.js
Vue.component("LNURLWithdrawContactless", {
data: function () {
return {
supported: 'NDEFReader' in window,
scanning: false,
submitting: false,
readerAbortController: null,
}
},
methods: {
@leesalminen
leesalminen / boltcards.php
Created August 20, 2022 21:28
first draft
<?php
define("DOMAIN_NAME", "ENTER_LNBITS_URL_HERE");
function main($card_uid) {
$card_uid = strtoupper(trim($card_uid));
$card_uid_bin = hex2bin($card_uid);
if(!$card_uid_bin) {
const firstNumber = 0
const lastNumber = 9999
const email = "lee@jungleacademy.com"
const tryToLogIn = async (email, passwordToTry) => {
console.log(`[ATTEMPT] trying to log in with password ${passwordToTry}`)
const response = await fetch(
'/login.php',
{
@leesalminen
leesalminen / install_mc.sh
Last active July 22, 2022 14:51
install Minecraft pi on raspberry pi os
wget -O minecraft-pi.AppImage https://tinyurl.com/jamcpi
chmod +x minecraft-pi.AppImage
pip3 install mcpi minecraftstuff
touch minecraft-bot.py
echo "from mcpi import minecraft" >> minecraft-bot.py
echo "from minecraftstuff import MinecraftTurtle" >> minecraft-bot.py

Keybase proof

I hereby claim:

  • I am leesalminen on github.
  • I am leesalminen (https://keybase.io/leesalminen) on keybase.
  • I have a public key whose fingerprint is 14BD 349A 38C1 2B88 38B1 5AE2 41D5 4625 970A 36A9

To claim this, I am signing this object: