This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let data: &mut [u8] = &mut [0, 0, 0, 0]; // your byte slice | |
let index: usize = 2; // the position where you want to write the byte | |
let byte: u8 = 42; // the byte you want to write; 42 => | |
// Write the byte to the specified position in the byte slice | |
data[index] = byte; | |
print_byte(&byte); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Using different scripts from the gist | |
# bintodec.sh | |
# - https://discord.com/channels/@me/1017776053873287258/1247924569319149649 | |
# arraybyindex.sh | |
# - https://gist.github.com/ochaloup/4d6ca93a6826a65c3f1f781d5af59d4b | |
# tobase58.py | |
# - https://discord.com/channels/@me/1017776053873287258/1247924569319149649 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$1" == "-h" ] || [ $# -eq 0 ] || [ $# -gt 1 ]; then | |
echo "Expecting one parameter, a path to binary file, e.g. 'solana -um account -o /tmp/data.bin'" | |
echo "$0 /tmp/data.bin" | |
exit 0 | |
fi | |
FILE="$1" | |
decimal_array=($(od -v -An -t u1 < "$FILE")) | |
echo -n '['$(echo -n ${decimal_array[@]} | sed 's/ /,/g')']' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agents: | |
queue: "snapshots" | |
steps: | |
- label: ":mega: Notification setup" | |
commands: | |
- 'notification_color="8388863"' | |
- 'buildkite-agent meta-data set notification_color "$$notification_color"' | |
- | | |
epoch=333 | |
echo "$$DISCORD_WEBHOOK_VALIDATOR_BONDS" -H "Content-Type: application/json" -d '{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changing name: | |
https://stackoverflow.com/questions/19896900/how-to-change-the-name-of-a-gist-in-github/62398008#62398008 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
is_valid_directory() { | |
if [ -d "$1" ]; then | |
echo "$1 is a valid directory." | |
return 0 | |
else | |
echo "$1 is not a valid directory." | |
return 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "test" | |
version = "0.1.0" | |
description = "Created with Anchor" | |
edition = "2021" | |
[lib] | |
crate-type = ["cdylib", "lib"] | |
name = "test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# solana account -um vbMaRfmTCg92HWGzmd53APkMNpPnGVGZTUHwUJQkXAU --output json -o fixtures/solana-accounts/vbMaRfmTCg92HWGzmd53APkMNpPnGVGZTUHwUJQkXAU.json | |
function to_bash_arr() { | |
ARR="$@" | |
echo $ARR | sed 's/[,]/ /g' | sed 's/\[\|\]/ /g' | |
} | |
EXPECTED_LEN=260 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- Working with etl snapshot DB --- | |
# speed up queries with index creation | |
create index token_account_mint on token_account(mint); | |
create index token_account_owner on token_account(owner); | |
# loading token accounts without system account from sqlite DB | |
SELECT sum(token_account.amount) FROM token_account | |
LEFT JOIN account ON token_account.owner = account.pubkey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BINDIR=./target/debug | |
TESTDIR=./gen-ledger | |
FAUCET_KEYPAIR="$TESTDIR"/bootstrap/faucet-keypair.json | |
CONFIG="$TESTDIR"/config.yml | |
VALIDATOR_CNT=4 | |
BOOTSTRAP_RPC="http://127.0.0.1:8899" | |
BOOTSTRAP_GOSSIP="127.0.0.1:8000" | |
WARMUP_SLOT=20 |
NewerOlder