Skip to content

Instantly share code, notes, and snippets.

@gotjoshua
gotjoshua / configuration.nix
Last active April 17, 2024 17:29 — forked from hermannolafs/configuration.nix
Nixos Gnome RDP Remote Desktop
{ pkgs, lib, ... }: {
# from https://gist.github.com/hermannolafs/c1379a090350d2dc369aeabd3c0d8de3
# minimized for clarity.
# Some of these might not be needed. After some trial and error
# I got this working with these configs.
# I do not have the patience to rn an elimination test.
services.gnome.gnome-remote-desktop.enable = true;
@gotjoshua
gotjoshua / starship.toml
Created March 25, 2023 20:59
a two line, extras on the right, paletted variation of https://starship.rs/presets/#pastel-powerline
right_format = """
[](fg:tooling_hex bg:none)\
$c\
$elixir\
$elm\
$golang\
$gradle\
$haskell\
$java\
$julia\
@gotjoshua
gotjoshua / qgis-plugin-vscode-mac.md
Last active October 31, 2022 18:18
qgis plugin dev on mac os - notes for ide setup
@gotjoshua
gotjoshua / for-of-loop-include-index.code-snippets
Created August 8, 2022 09:31
convert for of loop topline to use index
"convert for of loop topline to use index" : {
"prefix": "fc",
"body": ["${TM_SELECTED_TEXT/(for \\(const )(.*) of (.*)\\) {/$1[idx, $2] of $3.entries()) {/}"],
"description": "to use this snippet, select the top line of your for loop, type fc on top of it, choose snippet"
},
@gotjoshua
gotjoshua / moralis-sendToDiscord.js
Created June 15, 2021 11:03
moralis sendToDiscord channel hook
const sendToDiscord = async (channelHookURL, content) => {
// https://discord.com/developers/docs/resources/webhook#execute-webhook
let httpResponse; let status = 'success'
try {
httpResponse = await Moralis.Cloud.httpRequest({
method: 'POST',
url: channelHookURL,
body: {
flags: 1 << 2, // not working attempt to prevent links from embedding
content,
@gotjoshua
gotjoshua / moralis-cloud-handleSync.js
Created June 15, 2021 10:50
moralis real time sync
Moralis.Cloud.beforeConsume('Shipped', (event) => {
if (!event.confirmed) return false
delete event.address
delete event.confirmed
delete event.block_hash
log(`beforeConsume - ${event}`)
return true
})
Moralis.Cloud.afterSave('Shipped', async (request) => {
@gotjoshua
gotjoshua / syncup.sh
Created February 28, 2021 15:30
sync
#!/bin/bash
#source profile with GO path etc
. /etc/profile.d/regen.sh
x=1
limit=${1:-100}
while [ $x -le $limit ]
do
UPSTREAM_BLOCKS=$(curl -s http://161.35.51.84:26657/consensus_state | jq -r '.result.round_state."height/round/step"' | cut -d'/' -f1)
@gotjoshua
gotjoshua / txMemoCountForBlockLoop.sh
Created February 17, 2021 19:13
loop over a block range and report memo stats
#!/bin/bash
START_HEIGHT=${1:-41500}
END_HEIGHT=${2:-43200}
NODE="--node http://${3:-161.35.51.84}:26657"
LOOP_RANGE=$(eval echo {$START_HEIGHT..$END_HEIGHT})
RUNNING_MEMOS=()
for BLOCK_HEIGHT in $LOOP_RANGE; do
@gotjoshua
gotjoshua / txMemoCountForBlock.sh
Last active February 16, 2021 21:27
txMemoCountForBlock.sh
#!/bin/bash
BLOCK_HEIGHT=${1:-42672} # the block with most txs during the stress test
eachPage=1
# escaping syntax from https://pkg.go.dev/github.com/qredo/tendermint/rpc/core#TxSearch
CMD="regen query txs --events 'tx.height=${BLOCK_HEIGHT}' --limit 100 --page=${eachPage}"
echo 'First Page:'
echo "$CMD | jq ."
RESULT=$(eval $CMD)
@gotjoshua
gotjoshua / steady.sh
Created February 11, 2021 15:11
Steady batched txs
#!/bin/bash
# usage tasks.sh BATCHES MaxWalletNumber MinWalletNumber PrefixOfExistingKeys SigningKeyName ToWhatAddress
read -e -s -p "Keyring pass?" PP
BATCHES=${1:-10}
MAX_WALLET=${2:-400}
MIN_WALLET=${3:-0}