rustinmyeye's avatar
rustinmyeye
rustinmyeye@rogue.earth
npub1ylqx...9exa
.
rustinmyeye's avatar
rustinmyeye 19 mins ago
Setting up a couple #reticulum #rnode s to play with...
#asknostr I wanted to build a thing to check an npubs first note, kinda like to see how long I've been using nostr, but it doesn't work for everyone I try. What's the right way to do this? Running it here: https://notecheck.bspr.UK Code made by a robot: ❯ cat server.js 10:16:39const express = require("express"); const { nip19 } = require("nostr-tools"); const { SimplePool, useWebSocketImplementation } = require("nostr-tools/pool"); const WebSocket = require("ws"); useWebSocketImplementation(WebSocket); const app = express(); const PORT = 4747; app.use(express.urlencoded({ extended: true })); // Convert npub to hex function npubToHex(npub) { const { type, data } = nip19.decode(npub); if (type !== "npub") throw new Error("Invalid npub"); return data; } // Expanded default relay list const defaultRelays = [ "wss://relay.damus.io", "wss://nos.lol", "wss://nostr.wine", "wss://relay.nostr.band", "wss://nostr.bitcoiner.social", "wss://nostr.oxtr.dev", "wss://soloco.nl", "wss://nostr.einundzwanzig.space", "wss://relay.nostr.net", "wss://offchain.pub", "wss://relay.snort.social", "wss://eden.nostr.land", "wss://nostr.mom", "wss://relay.nostrview.com", "wss://nostr.plebchain.org", "wss://nostr.21sats.net" ]; // Get oldest kind 1 (note) timestamp from multiple relays async function getFirstNoteTimestamp(pubkeyHex, extraRelays = []) { const relays = [...defaultRelays, ...extraRelays]; const pool = new SimplePool(); let oldestTimestamp = Infinity; const promises = relays.map(url => { return new Promise((resolve) => { const sub = pool.subscribe( [url], { kinds: [1], authors: [pubkeyHex] }, { onevent(event) { if (event.created_at < oldestTimestamp) { oldestTimestamp = event.created_at; } }, oneose() { resolve(); } } ); // Safety timeout per relay setTimeout(() => { sub?.close(); resolve(); }, 12000); }); }); await Promise.all(promises); pool.close(relays); return oldestTimestamp === Infinity ? null : oldestTimestamp; } // Home page app.get("/", (req, res) => { res.send(renderPage()); }); // Handle form submission app.post("/", async (req, res) => { const npub = req.body.npub; const extraRelays = req.body.extraRelays ? req.body.extraRelays.split(/\s+/).filter(Boolean) : []; let message; try { const pubkeyHex = npubToHex(npub); const ts = await getFirstNoteTimestamp(pubkeyHex, extraRelays); if (ts) { const timestampStr = new Date(ts * 1000).toUTCString(); message = `First Note: ${timestampStr}`; } else { message = "No notes found for this npub."; } } catch (err) { message = `Error: ${err.message}`; } res.send(renderPage(npub, message, extraRelays)); }); // Render HTML page function renderPage(npub = "", message = "", extraRelays = []) { return ` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Nostr First Note Finder</title> <style> body { background-color: #000; color: #ffb700; font-family: 'Courier New', monospace; display: flex; flex-direction: column; align-items: center; padding: 2rem; min-height: 100vh; } h1 { margin-bottom: 1.5rem; } input, textarea, button { background: #111; color: #ffb700; border: 1px solid #ffb700; padding: 0.5rem 1rem; font-family: monospace; font-size: 1rem; margin: 0.5rem 0; } textarea { width: 100%; max-width: 500px; height: 3rem; display: ${extraRelays.length ? "block" : "none"}; } button:hover { background: #222; cursor: pointer; } .output { margin-top: 1.5rem; background: #111; padding: 1rem; border: 1px solid #ffb700; width: 100%; max-width: 500px; text-align: center; word-break: break-word; } </style> </head> <body> <h1>Nostr First Note Finder</h1> <form method="POST" action="/"> <input name="npub" placeholder="Enter npub" required value="${npub}" /> <button type="button" onclick="document.getElementById('extraRelays').style.display='block'; this.style.display='none';">Add Relay</button> <textarea id="extraRelays" name="extraRelays" placeholder="Optional: extra relays, space-separated">${extraRelays.join(" ")}</textarea> <button type="submit">Find First Note</button> </form> ${message ? `<div class="output">${message}</div>` : ""} </body> </html> `; } app.listen(PORT, () => { console.log(`Server running at http://localhost:${PORT}`); });
rustinmyeye's avatar
rustinmyeye 2 days ago
Testing battery life of these things. Using recycled batteries from things I find. One Heltec v4 running #Meshtastic and one Heltec v3 on #Meshcore Setting up #reticulum #rnode soon... I'm very excited to try it. image
rustinmyeye's avatar
rustinmyeye 3 days ago
#Meshtastic node stuffed inside a flashlight. I was looking around for a waterproof case, and I had this thing, which is waterproof, has a decent battery, and its own charge controller. The heltec v3 fits perfect and there was room for the antenna internally as well.
rustinmyeye's avatar
rustinmyeye 5 days ago
Caution, made in China Real sticker on an 18650 inside a Canadian Tire flashlight I just opened. image
rustinmyeye's avatar
rustinmyeye 5 days ago
Had a nice walk this morning. My son fell asleep in the wagon as usual haha.
rustinmyeye's avatar
rustinmyeye 6 days ago
and a nice one from kathleen edwards i heard on the radio today. stuck in my head. she had a coffee shop called quitters near me, in stittsville, but quit to focus on music again.
rustinmyeye's avatar
rustinmyeye 1 week ago
Growing some herbs. Basil, parsley, rosemary, chives, and for some reason I wantes to try sprouting wheat (thats the grass lookin stuff) image
rustinmyeye's avatar
rustinmyeye 1 week ago
Nerdy activity for myself and the kids today: trying to receive transmissions from the ISS lol. Got some voices and a bunch of static once!
rustinmyeye's avatar
rustinmyeye 1 week ago
Rebuilt my snowblower engine in the kitchen with my kids. Something had gone through the cylinder and gouged the wall pretty deep, so bad that it was way down on compression. Anyway, just did the first oil change after and found a gear tooth umder the oil drain, so I was concerned something broke internally, but afyer looking at it closely, it seems to be a ring gear tooth... no idea why it was laying there. Made me nervous for a second haha
rustinmyeye's avatar
rustinmyeye 1 week ago
Anyone here using #Meshcore or have an opinion on it? In Ottawa, everyone has switched over to it from #Meshtastic I flashed a couple Heltec v3's with Meshcore to try it out and its pretty cool! I was able to connect with people over 40 km away, via hops, and from a frozen beach in the open. Unfortunately the lora range seems worse than Meshtastic, so I cant reach areas I normally could in my area. So far Im thinking it is really cool, and I will run both... would be cool to setup a meshcore - meshtastic bridge for myself and local mesh.
rustinmyeye's avatar
rustinmyeye 3 months ago
Trying to figure out this injector driver module from my truck... It died about a year ago, and I just replaced it at the time, but now I want to repair this one for fun. When it failed, one injector bank quit firing the high voltage. The high side control was open. The only obvious damage was a few burnt resistors and transistors. I replaced all the burned parts and plugged it in, but as soon as it started, everything popped again. Next, I pulled the MOSFETs that control the high side voltage, replaced everything again, and plugged it in… this time nothing burned with the MOSFETs removed. One of the MOSFETs (the bad side) shows about 50 V on the gate when it’s supposed to be low. The good one only has around 1.5 V. When the good side fires, its gate jumps to around 98 V then drops back to ~1.5 V. The bad one just sits at 50 V and drops to ground only when the good one fires. So it seems like something is shorting power to the gate of that MOSFET. I’ll have to replace all the resistors and caps again (I shorted something while testing), but once that’s done I want to track down why the gate’s stuck at 50 V. Maybe another shorted transistor or something... Another weird thing with this, is that the MOSFETs are N channel, so they need higher voltage at the gate than the source to fire, but the voktage seems to be lower… I may just be misunderstanding something there, or they need to be installed for the correct voltages to show up.