Skip to content

Instantly share code, notes, and snippets.

View robert-clayton's full-sized avatar
😴
Sleepy

Robert Clayton robert-clayton

😴
Sleepy
View GitHub Profile
@robert-clayton
robert-clayton / parse_yaml.sh
Created September 30, 2021 10:18 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@robert-clayton
robert-clayton / runner-setup.md
Last active January 19, 2021 22:44
Github Self-Hosted Runner Setup

Linux (Needs updating)

#!/bin/bash
# Set up a new ec2 instance with self-hosted github runner
###################
PAT=
GITHUB_USER=
GITHUB_REPO=
###################
sudo yum update -y
@robert-clayton
robert-clayton / standard_ebooks_opds_downloader.py
Last active September 2, 2019 18:15 — forked from Ultrabenosaurus/standard_ebooks_opds_downloader.py
Download all ebooks from the Standard eBooks OPDS catalogue, organised into subfolders by author and book title.
####
#
# Download all of the Standard eBooks catalogue from their OPDS feed.
#
# https://standardebooks.org/
#
# Modified to download all files for each book except the SVG cover and to
# organise the files in subfolders by Author > Book Title.
# The original script downloads only the EPUB file for each book into the
# working directory with no subfolders.