Skip to content

Instantly share code, notes, and snippets.

View wwalker's full-sized avatar

Wayne Walker wwalker

View GitHub Profile
@wwalker
wwalker / walk_method
Created August 16, 2023 17:51
traverse JSON::Any Object
def walk(prefix : Array(String))
@item = @j if prefix.size == 0
if @item.nil?
puts "walk: #{prefix.join(".")} is Nil THIS SHOULD NOT HAPPEN"
return
end
case @item.class
when Hash
@item.as_h.keys.each do |k|
puts "walk: #{prefix + [k]} ia a Hash"
@wwalker
wwalker / 0
Created February 9, 2023 00:02
[Style/RedundantBegin] Redundant `begin` block detected
Why does this say "[Style/RedundantBegin] Redundant `begin` block detected" (from vim Syntastic)
@wwalker
wwalker / i3-get-wndow-criteria
Created February 8, 2023 04:52
i3-get-window-criteria
#!/bin/sh
# i3-get-window-criteria - Get criteria for use with i3 config commands
# To use, run this script, then click on a window.
# Output is in the format: [<name>=<value> <name>=<value> ...]
# Known problem: when WM_NAME is used as fallback for the 'title="<string>"' criterion,
# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807
@wwalker
wwalker / just-the-commands
Created February 7, 2023 07:39
Build Boomer
git clone https://github.com/nim-lang/Nim.git
cd Nim
./build_all.sh
nim c koch.nim
koch boot -d:release
PATH=~/git/Nim/bin:$PATH
cd ..
git clone https://github.com/tsoding/boomer
cd boomer
nimble build
@wwalker
wwalker / a.yml
Created November 10, 2022 05:12
mysql_user
---
- name: Install Elasticsearch
hosts: all
tasks:
- name: add rancher user to consume cattle db
become: true
become_user: root
community.mysql.mysql_user:
name: rancher
@wwalker
wwalker / inventory.yml
Last active November 9, 2022 15:59
dynamic host inventory generation
---
masters:
hosts:
es-master-{{ cluster_name }}-00{1..{{ master.count }}}: {}
hot-nodes:
hosts:
es-hot-{{ cluster_name }}-00{1..{{ hot.count }}}: {}
warm-nodes:
hosts:
es-warm-{{ cluster_name }}-00{1..{{ warm.count }}}: {}
@wwalker
wwalker / 0-irb-session-excerpt
Last active June 22, 2022 00:40
Time vs ActiveSupport::TimeWithZone
irb(main):028:0> cp.last.class
=> Time
irb(main):029:0> cp.last
=> 2022-06-21 15:30:00 -0500
irb(main):030:0> c.next_run.class
=> NilClass
irb(main):031:0> c.next_run=cp.last
=> 2022-06-21 15:30:00 -0500
irb(main):032:0> c.next_run.class
=> ActiveSupport::TimeWithZone
#!/bin/bash -x
launch_and_mark(){
local window_role=$1
local startup_sleep=$2
shift 2
launch "$@"
id=
@wwalker
wwalker / 0-why-borg-prune-no-work.md
Last active May 18, 2022 03:43
borg prune doesn't appear

So I am running borg prune via borgmatic. You can see in the attached beeper.prune that borg is being called like this:

borg prune --keep-within 3H --keep-hourly 24 --keep-daily 7 --keep-weekly 52 --keep-monthly 18 --keep-yearly 1 --prefix {hostname}- --debug --show-rc --list -v --debug --stats /4T/borg/beeper

There are no backups newer than 3 hours, so, at most, after prune runs, there should be, at most 102 archives: # assuming that there are no backups being counted as two of these:

  • 24 hourlies +
  • 7 dailies +
  • 52 weeklies +
dnf download --source meson
rpm -i meson-0.59.4-1.fc35.src.rpm
cd ~/rpmbuild/SPECS
vim meson.spec
# change 0.59.4 to 0.60.0
cd ../SOURCES
wget https://github.com/mesonbuild/meson/releases/download/0.60.0/meson-0.60.0.tar.gz
cd ../SPECS
rpmbuild -ba meson.spec