Skip to content

Instantly share code, notes, and snippets.

View monacard_backup.sh
#!/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
View stun.sh
#!/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)
View readbc.js
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);
View broadcast.js
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);
View rsatool.js
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];
}
View secretsharing.js
import React, { useState } from "react"
import sss from "sss-wasm"
export default function UpImage(props) {
const [msg, setMsg] = useState('');
const [shares, setShares] = useState('');
const [amount, setAmount] = useState(5);
const [threshold, setThreshold] = useState(4);
function msgChanged(ev) {
View upimage.js
import React, { useState } from "react"
const writeableNodes = [
//'http://127.0.0.1:8080/ipfs/',
'https://ipfs.eternum.io/ipfs/',
'https://jacl.tech/ipfs/',
];
const publicNodes = [
//'http://127.0.0.1:8080/ipfs/',
View uploader.js
import React, { useState } from "react"
const writeableNodes = [
'https://ipfs.eternum.io/ipfs/',
'https://jacl.tech/ipfs/',
'/ipfs/',
'http://127.0.0.1:8080/ipfs/',
];
const publicNodes = [
@ohac
ohac / monaparty.js
Created Dec 21, 2020
Monaparty asset image React component
View monaparty.js
import React from "react"
class Monaparty extends React.Component {
constructor(props) {
super(props)
this.state = {
url: null
}
}
@ohac
ohac / monacard.js
Created Dec 20, 2020
React component for Monacard API
View monacard.js
import React from "react"
class Monacard extends React.Component {
constructor(props) {
super(props)
this.state = {
url: null
}
}