Skip to content

Instantly share code, notes, and snippets.

View chtzvt's full-sized avatar
🌻
‍To create a little flower is the labor of ages.

Charlton Trezevant chtzvt

🌻
‍To create a little flower is the labor of ages.
View GitHub Profile
package main
import (
"sync"
"net/http"
"net/url"
"strings"
"time"
"fmt"
"io/ioutil"
@chtzvt
chtzvt / webpgen.sh
Created April 4, 2022 13:39
Generate corresponding .webp versions of images hosted on cdn.ctis.me
#!/usr/bin/env bash
for f in `find . -type f | grep -v "webp"`
do
fname=`basename $f | rev | cut -d . -f2 | rev`
fext=`basename $f | rev | cut -d . -f1 | rev`
fdir=`dirname $f`
target="$fdir/$fname.webp"
# Skip if target already exists
#!/usr/bin/env ruby
bloatlist = <<-APPS
com.samsung.android.app.galaxyfinder
com.samsung.android.smartswitchassistant
com.google.android.youtube
com.samsung.android.themestore
com.sec.android.app.chromecustomizations
com.google.android.googlequicksearchbox
com.osp.app.signin
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
# Depends on rubyzip
require 'zip'
Dir['./*'].each do |f|
match = /(Volume. )([0-9]+[.0-9]*)( Chapter. )([0-9]+[.0-9]*)/.match(f)
@chtzvt
chtzvt / nc_fetcher.rb
Last active January 25, 2022 19:58
Nextcloud Backer-Upper for Calendar/Contacts/Todo lists, with a dash of Git
#!/usr/bin/env ruby
# frozen_string_literal: true
# NextCloud Backer-Upper
# Charlton Trezevant, 2021
# This script is provided as-is, under the MIT license.
#
# The purpose of this script is to automatically fetch backup exports of my contacts,
# calendars, and todo lists from Nextcloud.
#
@chtzvt
chtzvt / problem-v01i01.md
Last active December 29, 2021 02:29
Esoteric Programming Challenge #1: "A to Z" :: Vol. 1, Issue #1 in the "Daniel Fucking Nerd-Sniped Me" Series
@chtzvt
chtzvt / 03-ntp.conf
Created November 1, 2021 16:05
Tools I built to manage & support captive NTP internally
# NTP Server Overrides
# https://gist.github.com/mutin-sa/eea1c396b1e610a2da1e5550d94b0453
addn-hosts=/etc/ntp_upstream.hosts
cname=time.google.com,time.nhq
cname=time1.google.com,time.nhq
cname=time2.google.com,time.nhq
cname=time3.google.com,time.nhq
cname=time4.google.com,time.nhq
@chtzvt
chtzvt / cloudflare_ddns.sh
Created November 1, 2021 16:02
CloudFlare API Dynamic DNS Updater
api_key="your_api_key"
zone_id="some_string"
record_id="some_string"
zone_name="example.com"
record_name="dynamic-record.example.com"
record_content=`curl -s http://whatismyip.akamai.com/`
curl_result=$(curl "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$record_id" \
-X PUT -H 'NOPE Dynamic DNS Client/1.0' \
@chtzvt
chtzvt / qemu_boot_tiger.sh
Created November 1, 2021 16:00
Boot Mac OS X Tiger in QEMU with full networking support
HDD="/path/to/MacOS_Tiger_HDD.qcow2"
CDROM="/path/to/Mac_OS_X_10.4_Tiger_Installer.iso"
IFACE="your-parent-nic-name-here"
IFACEMAC="FC:FC:48:c0:ff:ee"
TAP="tap0"
NETBKND="tigernet0"
NICMODEL="rtl8139"
@chtzvt
chtzvt / wireguard_healthcheck.sh
Created November 1, 2021 15:58
WireGuard un-borker
#!/bin/bash
STATUS_FILE='/tmp/.wg_fixer_state_unhealthy'
REBOOT_MINIMUM_UPTIME='300' # 5 minutes
SYSTEM_UPTIME=`cat /proc/uptime | cut -d ' ' -f1 | cut -d '.' -f1`
systemctl status wg-quick@wg0 2>&1 >/dev/null
WG_QUICK_STATUS=$?
WG_PEERS=`wg | wc -l`