Skip to content

Instantly share code, notes, and snippets.

@assafmo
assafmo / couchimport-jq-json-zip.sh
Last active March 16, 2022 23:42
Import an archive full of JSONs into CouchDB
#!/bin/bash
#json per line (same result, but for example can use jq to set _id)
7z x -so $1 | jq -c . | couchimport --db mydb --type jsonl
@assafmo
assafmo / Showcase_of_Secret_Network_for_LinkNow_by_Blocklike.pdf
Last active July 14, 2021 17:09
Showcase of Secret Network for LinkNow by Blocklike
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@assafmo
assafmo / Showcase of Secret Network for Privacy in Cosmos.pdf
Last active June 30, 2021 14:11
Showcase of Secret Network for Privacy in Cosmos
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@assafmo
assafmo / secretcli.sh
Last active June 9, 2021 14:11
{secret,terra}cli setup for testnet
sudo wget -O /bin/secretcli https://github.com/enigmampc/SecretNetwork/releases/download/v1.0.4/secretcli-linux-amd64
sudo chmod +x /bin/secretcli
mkdir -p ~/.secretcli/config
echo 'chain-id = "holodeck-2"
indent = true
keyring-backend = "test"
node = "https://chainofsecrets.secrettestnet.io:26667"
output = "json"
@assafmo
assafmo / gist:e7b67c14934e1bbf9f3bfc6406d32264
Created December 20, 2020 09:20
Google sheets HTTP GET into a single cell
ARRAYFORMULA(JOIN(CHAR(10),SPLIT(IMPORTDATA("https://google.com")&CHAR(10),CHAR(10))))
@assafmo
assafmo / add_ssh_auth_keys.sh
Created September 28, 2020 12:46
Add my SSH keys to a new machine
curl -sSL github.com/assafmo.keys >> ~/.ssh/authorized_keys
@assafmo
assafmo / export_peers.sh
Last active September 23, 2020 21:29
Export a list of peers from your Enigma blockchain node
#!/bin/bash
curl -s http://bootstrap.mainnet.enigma.co:26657/net_info |
jq -cr '.result.peers[] | [.node_info.id,.remote_ip,.node_info.listen_addr] | @csv' |
tr -d \" |
tr , @ |
perl -pe 's#\@tcp://.+?:#:#g' |
sort > /tmp/peers.txt
echo "# Generated at $(date -u --rfc-3339=seconds) by https://gist.github.com/assafmo/a39fdb535f74ce2d6493a1a3f695e4ca" > /home/ubuntu/peers/peers.txt
@assafmo
assafmo / node_sync_eta.sh
Last active September 23, 2020 21:26
Node sync progress bar + ETA
#!/bin/bash
NETWORK_BLOCK_NUMBER=$(
curl -s http://client.secretnodes.org:26657/status | jq '.result.sync_info.latest_block_height | tonumber'
)
LOCAL_BLOCK_NUMBER=$(secretcli status | jq '.sync_info.latest_block_height | tonumber')
BLOCKS_LEFT_TO_SYNC=$(jq -n "${NETWORK_BLOCK_NUMBER} - ${LOCAL_BLOCK_NUMBER}")
sudo journalctl -u secret-node -f |
grep -Po 'height=\d+ txs=' |
@assafmo
assafmo / convert_secret-1_export_to_secret-2_genesis.jq
Last active September 8, 2020 13:13
Convert secret-1 export to secret-2 genesis.json
#!/usr/bin/env jq
.chain_id = "secret-2" |
.genesis_time = (now | todate) |
.consensus_params.block.max_gas = "10000000" |
# Initialize x/register
.app_state.register = {
@assafmo
assafmo / uptime.sh
Last active August 26, 2020 09:01
Calculate validators uptime in the Secret Network
seq 2 250000 |
parallel --bar 'secretcli q block {} | jq -r ".block.last_commit.signatures[].validator_address | [{}-1,.] | @csv"'