Skip to content

Instantly share code, notes, and snippets.

@AGx10k
AGx10k / Default (OSX).sublime-keymap
Created October 18, 2020 21:57 — forked from dmitshur/Default (OSX).sublime-keymap
Sublime Text on OS X, make Cmd+F do the equivalent of Cmd+E followed by Cmd+F. Works for all selections, not just single line like "find_selected_text" setting.
[
// ... (existing content)
// Find selected text, even if it spans multiple lines (unlike "find_selected_text").
{ "keys": ["super+f"], "command": "run_multiple_commands", "args":
{ "commands":
[
// Only execute slurp if there's selected text.
{"command": "slurp_find_string", "context": "window", "condition": "selected_text"},
{"command": "show_panel", "args": {"panel": "find", "reverse": false}, "context": "window"}
#!/bin/bash
set -e
vote_account="/root/solana/vote-account-keypair.json"
identity_account="/root/solana/validator-keypair.json "
new_stake="/root/solana/validator-stake-keypair-$(printf '%(%Y-%m-%d)T').json"
min_vote_balance=100
available_for_withdraw=$(solana balance $vote_account | awk -F\. '{print $1}')
re='^[0-9]+$'
if ! [[ $available_for_withdraw =~ $re ]] ; then
#!/bin/bash
set -e
export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
TEXTFILE_COLLECTOR_DIR=/var/lib/prometheus/node-exporter
FILENAME=solana_active_stake.prom
metrics_prefix=solana_monit_mainnet
ALL=$(timeout 45 solana validators --output json | jq -r '.currentValidators[] |[.identityPubkey, .activatedStake/1000000000] | @csv' )

CELO_GENESIS_VALIDATOR_SIGNER_ADDRESS=0x173c75C8F1BE201cE89cF426Fe12c9997D709626 CELO_GENESIS_VALIDATOR_SIGNER_BLS_SIGNATURE=bb19f1e1e399faec8d291d71a31718b508e782f21111248ad2a9fe2aaccb37df33d1b8647974040649983516a9febd80 CELO_GENESIS_VALIDATOR_SIGNER_BLS_PUBLIC_KEY=9271a103e5971edd694b3c6363a2517b0676849b05660094baf240ea9677e171169a8eebed5ad6000871b4f42d4ca701b74b10f91c0de059d225ced0222e391cf7bdb5934d1677193837d5a1f17bb710f4747956d819db51c817cbba53324b81 CELO_RELEASE_GOLD_BENEFICIARY_ADDRESS_1=0x7Ff03c3216573710a62831d5249D7A7CE4D017dE CELO_RELEASE_GOLD_BENEFICIARY_ADDRESS_2=0xCbBDa4307091f287a6C4BbE641D5C84014ed70d5

@AGx10k
AGx10k / hwdata.sh
Last active June 2, 2021 07:00
Hetzner hwdata + netdata
#!/bin/bash
w
echo
echo "Hardware data:"
echo
cpu_count="$(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
cpu_cores="$(cat /proc/cpuinfo | grep "siblings" | uniq | tr -d ' ' | cut -d: -f2)"
cpu_type="$(cat /proc/cpuinfo | grep "model name" | uniq | tr -s ' ' | cut -d: -f2)"
####
# пути к ключам будут вида /solana/validator-keypair.json
# а на хосте они будут лежать в папке /root/solana_blabla. например /root/solana_agx10k
####
#######################################dockerfile####
echo "export SOLANA_NAME=<имя>" | tee -a ~/.bashrc ### например AG
source ~/.bashrc
echo "export SOLANA_DIR=/root/solana_${SOLANA_NAME}" | tee -a ~/.bashrc
#!/bin/sh
#
# Expose directory usage metrics, passed as an argument.
#
# Usage: add this to crontab:
#
# */5 * * * * prometheus directory-size.sh /var/lib/prometheus | sponge /var/lib/node_exporter/directory_size.prom
#
# sed pattern taken from https://www.robustperception.io/monitoring-directory-sizes-with-the-textfile-collector/
#

CELO_VALIDATOR_GROUP_ADDRESS=ff0559d9062650213623968d2bd4e25f8705910c CELO_VALIDATOR_ADDRESS=ea6a71634f7228798ec8ac6395525a632ec4945e CELO_GENESIS_VALIDATOR_SIGNER_ADDRESS=893c4d601ed879b4ad36fc31f0c0214d547113eb CELO_GENESIS_VALIDATOR_SIGNER_BLS_PUBLIC_KEY=3695297deb0f970e1cd8c64a852b45ad788e151734ab05a20206be63f7f42817fb5e3e035d7f9dba56917a0bc75a3f0061e767a5cc5a60469709f170f4f7d76dcf6e30f04a520745ac8f3f131d6b854ea2a899c3317cc48bf06cdb07f4514a81

#!/bin/bash
stegosout=$(echo "show balance" | /root/stegos/stegos --data-dir /data/stegos/data/)
stegosexit=$?
if [ $stegosexit -gt 0 ]; then
echo stegosout: "$stegosout"
exit $stegosexit
fi
if grep -q -i error <<< "$stegosout"; then
echo stegos returned error:
@AGx10k
AGx10k / cloud-init-10g-30g-debian.yaml
Last active April 6, 2021 16:10
cloud-init for hetzner debian with 25% / ext4 and 75% /data xfs
#cloud-config
resize_rootfs: false
disk_setup:
/dev/sda:
table_type: 'mbr'
layout:
- 25
- 75
overwrite: true