Skip to content

Instantly share code, notes, and snippets.

View chadmayfield's full-sized avatar

Chad Mayfield chadmayfield

View GitHub Profile
@huytd
huytd / wordle.md
Last active May 16, 2024 20:39
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@usayamadx
usayamadx / ExportKindle.js
Last active March 23, 2024 17:53 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
// init
let xhr = new XMLHttpRequest()
let domain = 'https://read.amazon.com/'
let items = []
let csvData = ""
// function
function getItemsList(paginationToken = null) {
let url = domain + 'kindle-library/search?query=&libraryType=BOOKS' + ( paginationToken ? '&paginationToken=' + paginationToken : '' ) + '&sortType=recency&querySize=50'
xhr.open('GET', url, false)
@prologic
prologic / LearnGoIn5mins.md
Last active May 9, 2024 20:15
Learn Go in ~5mins
@AlexVanderbist
AlexVanderbist / opendb.sh
Created September 17, 2020 16:21
`opendb` command - opens the database for a Laravel app in your GUI
opendb () {
[ ! -f .env ] && { echo "No .env file found."; exit 1; }
DB_CONNECTION=$(grep DB_CONNECTION .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_HOST=$(grep DB_HOST .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PORT=$(grep DB_PORT .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_DATABASE=$(grep DB_DATABASE .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_USERNAME=$(grep DB_USERNAME .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PASSWORD=$(grep DB_PASSWORD .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
@superseb
superseb / rke2-commands.md
Last active May 16, 2024 09:13
RKE2 commands

RKE2 commands

Install

curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server
@gabrielsson
gabrielsson / minecraft-on-raspberry-pi.md
Last active May 13, 2024 19:11
Minecraft on Raspberry Pi cluster with metrics

alt

Minecraft on Raspberry Pi cluster with metrics

Ever wanted to put your Rapsberry Pi cluster to great use? Our team is working remotely, so we started to play Minecraft. I decided I would host the Minecraft server on my Raspberry Pi cluster. This gist will guide you through the steps I took to get a k3s cluster up with k3sup and later installed Minecraft as well as metrics exporter and Prometheus Operator

Why?

Quoniam Possumus - Because we can

You'll need

@gillg
gillg / rrd_to_openmetrics.py
Last active December 6, 2023 16:02
Script to convert a set of RRD files (issued from collectd for example) to Open Metrics format (prometheus)
#!/usr/bin/env python
from __future__ import print_function
'''
Usage:
./rrd_to_openmetrics.py /path/rrd_directory/ > openmetrics.txt
'''
'''
Directory structure :
#!/usr/bin/env bash
CIPHERS='ALL:eNULL'
DELAY=${2:-0.1}
SERVER=${1:?usage: $0 <host:port> [delay, default is ${DELAY}s] [ciphers, default is ${CIPHERS}]}
MAXLEN=$(openssl ciphers "$CIPHERS" | sed -e 's/:/\n/g' | awk '{ if ( length > L ) { L=length} }END{ print L}')
echo Using $(openssl version).
declare -A TLSMAP=( [tls1_1]=cipher [tls1_2]=cipher [tls1_3]=ciphersuites )
@blake
blake / k3s-helmchart-generate.py
Last active April 11, 2022 16:54
Helper script to generate HelmChart CRDs for use with the K3s Kubernetes
#!/usr/bin/env python3
# Copyright (c) 2019 Blake Covarrubias
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
"""Helper script to generate HelmChart CRDs for use with the K3s Kubernetes
This script creates HelmChart resource definitions for use on the K3s Kubernetes
distribution. The command line arguments closely resemble the behavior of
@chadmayfield
chadmayfield / network_interface_notes.md
Last active June 3, 2019 19:36
Notes on Network Interfaces in Linux/Unix systems

Network Interface Notes

Beginning in Systemd v197, network interfaces assigned by systemd/udev are "predicatble";

Names are now based on;

  • Index numbers for on-board devices (eno1)
  • PCI-ehotplug slot index numbers (ens1)
  • Physical/geographical location of hardware connector (enp2s0)
  • MAC address (enx78e7d1ea46da)
  • Classic, unpredictable kernel-native naming (eth0)