Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
PW=$(jq -r .privatekey < ~/.config/algia/config.json | sha256sum | cut -d' ' -f1)
openssl aes256 -K $PW -iv 00000000000000000000000000000000 | base64
@ohac
ohac / bip39tonip19.go
Created October 17, 2023 15:15
get Nostr nsec from BIP-0039 Mnemonic
package main
import (
"fmt"
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip19"
"github.com/tyler-smith/go-bip32"
"github.com/tyler-smith/go-bip39"
)
@ohac
ohac / nostr_status.sh
Last active August 27, 2023 01:48
Nostr status update script
#!/bin/bash
# description: Nostr status update script
if [ -z "$3" ]; then
echo "usage: ./nostr-status.sh title artist length_ms"
exit
fi
relays="wss://relay.damus.io wss://nos.lol wss://yabu.me"
import React, { useState, useEffect } from "react"
import ReactAudioPlayer from 'react-audio-player'
export default function Monacard2(props) {
const [url, setUrl] = useState(null);
const [audiourl, setAudiourl] = useState(''); // TODO
const name = props.name;
const gateway = props.gateway || 'https://ipfs.io/';
useEffect(() => {
const api = 'https://monapa.electrum-mona.org/_api'
@ohac
ohac / voidol.sh
Created September 25, 2021 10:53
#!/bin/sh
export OP=$PATH
#export BASEPATH=$HOME/.PlayOnLinux/wine/linux-amd64/5.12 # TODO failed !
export BASEPATH=$HOME/.PlayOnLinux/wine/linux-amd64/5.7
export PATH=$BASEPATH/bin:$OP
export WINEARCH=win64
export WINEPREFIX=$HOME/wineDrives/dot.wine64.voidol
export WINE=wine64
#winecfg # to Windows 10
#winecfg # change DPI?
#!/bin/bash
API=https://card.mona.jp/api
DB=monacard_db
IMG=img
TMPD=tmp.d
BACKUPD=backup.d
mkdir -p $DB
mkdir -p $IMG
mkdir -p $TMPD
mkdir -p $BACKUPD
#!/bin/bash
tmpfile=$(tempfile)
stun -v stun.l.google.com:19302 2> $tmpfile > /dev/null
port1=$(grep Opened.port $tmpfile | head -1 | cut -d ' ' -f 3)
port2=$(grep Opened.port $tmpfile | tail -1 | cut -d ' ' -f 3)
hostport1=$(grep MappedAddre $tmpfile | head -1 | cut -d ' ' -f 3)
hostport2=$(grep MappedAddre $tmpfile | tail -1 | cut -d ' ' -f 3)
rm -f $tmpfile
globalipv4=$(echo $hostport1 | cut -d : -f 1)
globalport1=$(echo $hostport1 | cut -d : -f 2)
import React, { useEffect, useState } from "react"
const apis = [
'https://monapa.electrum-mona.org/_api',
'https://mpchain.info/api/cb',
'https://wallet.monaparty.me/_api',
];
export default function ReadBC(props) {
const [msgs, setMsgs] = useState(null);
import React, { useEffect, useState } from "react"
function useMpurse() {
const [mpurse, setMpurse] = useState(null);
const [addr, setAddr] = useState(null);
useEffect(() => {
if (mpurse === null) {
const mp = window.mpurse;
if (mp) {
setMpurse(mp);
import React, { useState } from "react"
import NodeRSA from "node-rsa"
function generateKeyPair(bits){
const key = new NodeRSA({b: bits});
const pri = key.exportKey('pkcs1-private-der');
const pub = key.exportKey('pkcs1-public-der');
return [pub, pri];
}