Skip to content

Instantly share code, notes, and snippets.

View ericboehs's full-sized avatar

Eric Boehs ericboehs

  • Oddball
  • Enid, OK
  • 21:52 (UTC -05:00)
View GitHub Profile
@ericboehs
ericboehs / install-k3s-on-rpi.md
Last active April 13, 2022 02:21
Installing Kubernetes (k3s) on Raspberry Pi 4b 2GB+

How to set up Kubernetes on one or more Raspberry Pis (4b)

Estimated time needed: one hour. And then several more hours to have fun with it.

Set up Pi

Go through this section for all of your Raspberry Pis (master and nodes).

  1. Install Raspberry Pi OS 64-bit Lite onto an SD card using Raspberry Pi's Imager.
  • In the imager options, I configured hostname, ssh, username, but not Wi-Fi. Setting up Wi-Fi disables ethernet.
@ericboehs
ericboehs / va-pd-schedule
Last active May 2, 2022 18:22
Pull upcoming Pager Duty users for a given schedule
#! /usr/bin/env ruby
# https://gist.github.com/ericboehs/d1a88345ac526eb9851ff41155adc3bc
require 'open-uri'
require 'json'
BOLD = `tput bold`
NORMAL = `tput sgr0`
def print_all_schedules_names_and_ids
@ericboehs
ericboehs / slack-noti
Created March 25, 2022 01:42
slack-notify
#! /usr/bin/env bash
curl -s -X POST -H 'Content-type: application/json' --data "{\"text\":\"${1:-Done}\"}" $BOEHS_SLACK_NOTI_HOOK
@ericboehs
ericboehs / rpi
Last active April 1, 2022 23:10
Raspberry Pi Locator
#! /usr/bin/env ruby
require 'rss'
require 'open-uri'
SLEEP = 30
url = 'https://rpilocator.com/feed.rss'
db = nil
# Print cpu/memory usage in bytes when receiving SIGINFO
@ericboehs
ericboehs / yt
Last active November 13, 2023 18:49
Offline YouTube
#! /usr/bin/env ruby
# Eric's Offline YouTube (Download YT videos via Downie with JSON metadata and image previews and then run this script)
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'json'
@ericboehs
ericboehs / Gemfile
Created January 12, 2022 15:23
Capybara running with Minitest
source 'https://rubygems.org'
ruby '~> 3.1.0'
gem 'capybara'
gem 'pry'
gem 'webdrivers'
@ericboehs
ericboehs / config.h
Created December 15, 2021 05:12
Let's Split QMK Keymap for Gemini/TX Bolt Stenography
#pragma once
// place overrides here
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
SONG(COLEMAK_SOUND), \
SONG(DVORAK_SOUND) \
}
/* Use I2C or Serial, not both */
#define USE_SERIAL
@ericboehs
ericboehs / rubo_parser.rb
Last active December 3, 2021 23:08
RuboCop Todo File Parser
require 'csv'
require 'yaml'
class RuboParser
attr_reader :file_name
# Parses the comment before the offense.
def self.parse_offense_meta(offense_lines)
count = offense_lines.grep(/Offense count/).first.split(': ').last
auto_correct = offense_lines.grep(/Cop supports/).any?
@ericboehs
ericboehs / ghb
Last active October 8, 2021 20:22
GitHub Branch - Enhances `gh` cli for the current branch
#! /usr/bin/env ruby
# Interface with workflows using `gh` CLI for the current branch
class GitHubBranch
WORKFLOW = ENV.fetch 'GHB_WORKFLOW', 'Code Checks'
# List the latest runs for the current branch.
def list
system %{
gh api "repos/{owner}/{repo}/actions/runs?branch=#{branch_name}&per_page=75" |
@ericboehs
ericboehs / flatten_json.rb
Created August 19, 2021 18:46
Flatten a JSON object (for Slack)
require 'json'
def flatten_hash(hash)
hash.each_with_object({}) do |(k, v), h|
if v.is_a? Hash
flatten_hash(v).map { |h_k, h_v| h["#{k}.#{h_k}".to_sym] = h_v }
else
h[k] = v
end
end