Skip to content

Instantly share code, notes, and snippets.

View wallentx's full-sized avatar
:shipit:
ȋ̴͎ ̶̘͝u̷̥͆s̴͖̾ē̷̠ ̶̟̉a̴͙̕ŗ̸͆č̶̬ḣ̷̭ ̴̡̄b̷̳̒ẗ̷͍ẘ̴̡

William Allen wallentx

:shipit:
ȋ̴͎ ̶̘͝u̷̥͆s̴͖̾ē̷̠ ̶̟̉a̴͙̕ŗ̸͆č̶̬ḣ̷̭ ̴̡̄b̷̳̒ẗ̷͍ẘ̴̡
View GitHub Profile
@wallentx
wallentx / fzfstr
Created December 16, 2020 21:32
fastest string finder in the west
#!/bin/bash
set -e
# Dependency check
RG_VERSION="$(rg --version | head -n1 | cut -d" " -f2)"
version_ge()
{
printf '%s\n%s\n' "$2" "$1" | sort -V -C
}
@wallentx
wallentx / ripstring
Created February 14, 2021 19:53
Find strings across all files in given directory. Print results in a sexy manner.
#!/usr/bin/env bash
set -e
if ! [[ $(command -v rg) > /dev/null ]]; then
echo "You need to install Ripgrep"
echo "https://github.com/BurntSushi/ripgrep"
exit 1
fi
while getopts "t:" OPTION; do
@wallentx
wallentx / ercot
Last active July 11, 2022 13:19
I made an ugly script to show ERCOT electric capacity/demand/availability
#!/usr/bin/env bash
display_center(){
columns="$(tput cols)"
while IFS= read -r line; do
printf "%*s\n" $(( (${#line} + columns) / 2)) "$line"
done < "$1"
}
eval $(curl -s "https://www.ercot.com/content/cdr/html/real_time_system_conditions.html" | pup 'tbody json{}' | jq -r '.[] | {CAPACITY:.children[6].children[1].text, DEMAND:.children[5].children[1].text} | to_entries|map("\(.key)=\(.value|tostring)")|.[]')
#!/bin/bash
shopt -s extglob
# generated from util-linux source: libmount/src/utils.c
declare -A pseudofs_types=([anon_inodefs]=1
[autofs]=1
[bdev]=1
[bpf]=1
[binfmt_misc]=1
@wallentx
wallentx / landBureau
Last active March 23, 2021 07:23
Watch -d dir for completed plots, then exec a mv to other path
#!/usr/bin/env bash
# uses https://github.com/z3bra/wendy
# replace below value with path of your chia '-d' value
CHIA_D="/many/t7"
# replace below value with path of HDD
FINAL="/mnt/plots"
@wallentx
wallentx / landSurvey
Last active April 13, 2021 19:45
Auto moves plots from buffer volume to available HDD. Intended to be called via inotify script
#!/usr/bin/env bash
BUFFER="/mnt/p50"
# FindMounts
MOUNT_LIST="/tmp/$(basename "$0")-mounts.$$.list"
find /mnt -type d -name 'plots*' > "$MOUNT_LIST"
# FindBusy
@wallentx
wallentx / chiastat
Created May 11, 2021 01:38
Dumping chia info to individual items to query via webserver endpoint
#!/usr/bin/env bash
source /home/your/path/to/chia-blockchain/activate
STR=$(chia farm summary | head -8)
FARM=$(chia farm summary | head -8 | sed 's/ /_/g; s/:_/=/g') #jq -Rs '{chia:split("\n")|map(split(": ")|{(.[0]):.[1]}?)}'
ACTIVE=$(pgrep -fa 'chia plots create' | wc -l)
printem() {
echo "Active_Plots=$ACTIVE"
@wallentx
wallentx / plotbench
Created May 29, 2021 06:17
Fio benchmark that somewhat reflects plot creation
#!/usr/bin/env bash
FIO=$(mktemp /tmp/fioXXXXXXXX.fio)
TARGET=$1
FIO_TMP=$(cat <<- EOF
[global]
bs=128K
iodepth=256
direct=1
#!/usr/bin/env bash
PIDARRAY=$(pgrep -fa 'chia plots create' | awk '{print $1}')
printPids() {
for CHP in $PIDARRAY; do
CH_PID=$(("$CHP" + 1))
journalctl _PID=$CH_PID --no-page --no-hostname -o cat | tac | grep -m1 -o "Starting phase .*" | cut -f1 -d/
done
}
#!/usr/bin/env bash
#set -x
PIDPROCS=$(pgrep -fa 'chia plots create')
if [[ -z ${PIDPROCS} ]]; then
PIDARRAY=""
PIDCT=0