Skip to content

Instantly share code, notes, and snippets.

View mikedotexe's full-sized avatar
🤙
hakuna matata

Mike Purvis mikedotexe

🤙
hakuna matata
View GitHub Profile
@mikedotexe
mikedotexe / index.html
Created May 10, 2025 19:30
npx serve .
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NEAR Validator Balances</title>
<style>
:root {
--bg-gradient: linear-gradient(135deg, #131f37 0%, #1c2942 100%);
--text: #ffffff;
@encody
encody / lib.rs
Created February 10, 2024 05:44
NEAR Spinner
use near_sdk::{
borsh::{self, BorshDeserialize, BorshSerialize},
env,
json_types::U64,
log, near_bindgen, Promise,
};
#[derive(BorshSerialize, BorshDeserialize, Default, Debug)]
#[near_bindgen]
struct Contract {}
@ElijahLynn
ElijahLynn / monitor-number-tcp-connection-states.sh
Last active January 20, 2024 22:49
Monitor the number of all TCP connection states
watch -n 1 "netstat -an | awk '/^tcp/ { ++S[\$NF] } END { for(a in S) print a, S[a] }'"
# Every 1.0s: netstat -an | awk '/^tcp/ { ++S[$NF] } END { for(a in S) print a, S[a] }'
# LISTEN 7
# FIN_WAIT_2 1
# CLOSE_WAIT 1
# CLOSED 33
# TIME_WAIT 1
# ESTABLISHED 63
#!/bin/bash
# Some helper functions for working with cosmos-sdk txs from the command line or
# in bash scripts.
#
# Example: say, if you want to send coins to multiple recipients. We need to:
#
# - compose a tx containing multiple "send" messages
# - set an appropriate gas limit and fee amount
# - sign it
@CyberHoward
CyberHoward / optimize.sh
Created June 20, 2023 16:39
Arch agnostic optimize command
#!/usr/bin/env bash
if [[ $(arch) == "arm64" ]]; then
image="cosmwasm/workspace-optimizer-arm64"
else
image="cosmwasm/workspace-optimizer"
fi
# Optimized builds
docker run --rm -v "$(pwd)":/code \
@JakeHartnell
JakeHartnell / README.md
Last active February 3, 2025 16:36
Include README.md files in rust documentation generation

Include README.md in documentation generation and tests

Recentely, I was trying to make sure our README.md files for DAO DAO were included in the documentation generated by cargo doc or rustdoc. Moreover, I wanted code examples in our README.md files to be tested.

Here's a quick gist...

There is of course the doc attribute, and the rust book contains the following example which you are meant to include in your lib.rs or main.rs:

@webmaster128
webmaster128 / config.toml
Last active February 28, 2023 09:39
Nois blocktime settings
# How long we wait for a proposal block before prevoting nil
timeout_propose = "2000ms"
# How much timeout_propose increases with each round
timeout_propose_delta = "500ms"
# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil)
timeout_prevote = "1s"
# How much the timeout_prevote increases with each round
timeout_prevote_delta = "500ms"
# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil)
timeout_precommit = "1s"
/*
* Wraps a cw721 contract with helpers.
* Adapted from https://github.com/CosmWasm/cw-plus/blob/main/contracts/cw721-base/helpers.ts.
*/
import {
CosmWasmClient,
SigningCosmWasmClient,
} from '@cosmjs/cosmwasm-stargate';
import { coins } from '@cosmjs/stargate';
@microchipgnu
microchipgnu / diff.md
Last active September 15, 2021 16:05
Metadata diff

NEAR_ENV=mainnet near view pluminite.near nft_tokens "{\"from_index\":\"0\",\"limit\":\"10\"}"

NEAR_ENV=mainnet near view x.paras.near nft_tokens "{\"from_index\":\"0\",\"limit\":10}"

NEAR_ENV=mainnet near view uhhmnft.near nft_tokens "{\"from_index\":\"0\",\"limit\":10}"

Pluminite

@mfornet
mfornet / near-borsh-io.md
Last active November 18, 2021 04:30
Borsh I/O in NEAR Smart Contracts

Borsh I/O in NEAR Smart Contracts

Manual encoding single parameter

pub fn set_status_borsh(&mut self, #[serializer(borsh)] message: Vec<u8>) {}

To call this function you need to pass arguments borsh serialized, and those bytes encoded as base64