From c910da7ce4a458572e9e8e862d180d80a897061c Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Fri, 3 Jan 2025 16:29:55 -0500 Subject: [PATCH 01/78] drop vm, cleaner readme --- README.md | 11 +-- vm/.gitignore | 11 --- vm/Makefile | 21 ---- vm/README.md | 5 - vm/dot.vmx.src | 61 ------------ vm/meta-data | 0 vm/network-config | 14 --- vm/original/build | 239 ---------------------------------------------- vm/user-data | 17 ---- 9 files changed, 1 insertion(+), 378 deletions(-) delete mode 100644 vm/.gitignore delete mode 100644 vm/Makefile delete mode 100644 vm/README.md delete mode 100644 vm/dot.vmx.src delete mode 100644 vm/meta-data delete mode 100644 vm/network-config delete mode 100644 vm/original/build delete mode 100644 vm/user-data diff --git a/README.md b/README.md index d7ef5ec..c5011d3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,3 @@ # Dotfiles, scripts, and stuff -*You probably want [`dot-template`](https://github.com/rwxrob/dot-template) instead.* - -Pilfer at your own peril. I'd love it if you mentioned me if you do, but yeah. [Stop by and chat sometime.](https://linktr.ee/rwxrob) - -## Legal - -Copyright 2024 Robert S. Muhlestein () -SPDX-License-Identifier: Apache-2.0 - -This license makes you safe to use anything in here pretty much anywhereβ€”including at work. But you do it at your own peril. +Pilfer at your own peril. diff --git a/vm/.gitignore b/vm/.gitignore deleted file mode 100644 index 08a332b..0000000 --- a/vm/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -cloudinit.iso -dot.vmdk -dot.vmxf -dot.vmx -dot.qcow2 -dot.vmsd -dot.nvram -storage.vmdk -vmware*.log -vm*.scoreboard -mksSandbox*.log diff --git a/vm/Makefile b/vm/Makefile deleted file mode 100644 index 2933737..0000000 --- a/vm/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -vmdk = https://cloud-images.ubuntu.com/daily/server/focal/current/focal-server-cloudimg-amd64.vmdk - -all: dot.vmdk cloudinit.iso storage.vmdk dot.vmx - -dot.vmx: dot.vmx.src - cp $? $@ - -dot.vmdk: - curl -L "$(vmdk)" -o dot.vmdk - -cloudinit.iso: meta-data network-config user-data - mkisofs -output cloudinit.iso -volid cidata -joliet -rock meta-data user-data network-config - -storage.vmdk: - vmware-vdiskmanager.exe -c -s 100MB -a lsilogic -t 0 "storage.vmdk" - -start: all - vmrun.exe start dot.vmx - -clean: - rm dot.vmdk cloudinit.iso vmware*.log vm*.scoreboard mksSandbox*.log dot.vmxf dot.vmsd dot.vmx dot.nvram storage.vmdk diff --git a/vm/README.md b/vm/README.md deleted file mode 100644 index deb6e6c..0000000 --- a/vm/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Workspace Virtual Machine - -1. Find whatever cloud-init enabled image you want -1. Update Makefile to point to it -1. Run `make` diff --git a/vm/dot.vmx.src b/vm/dot.vmx.src deleted file mode 100644 index 548fc30..0000000 --- a/vm/dot.vmx.src +++ /dev/null @@ -1,61 +0,0 @@ -.encoding = "UTF-8" -config.version = "8" -virtualHW.version = "18" -mks.enable3d = "TRUE" -pciBridge0.present = "TRUE" -pciBridge4.present = "TRUE" -pciBridge4.virtualDev = "pcieRootPort" -pciBridge4.functions = "8" -pciBridge5.present = "TRUE" -pciBridge5.virtualDev = "pcieRootPort" -pciBridge5.functions = "8" -pciBridge6.present = "TRUE" -pciBridge6.virtualDev = "pcieRootPort" -pciBridge6.functions = "8" -pciBridge7.present = "TRUE" -pciBridge7.virtualDev = "pcieRootPort" -pciBridge7.functions = "8" -vmci0.present = "TRUE" -hpet0.present = "TRUE" -nvram = "dot.nvram" -virtualHW.productCompatibility = "hosted" -powerType.powerOff = "soft" -powerType.powerOn = "soft" -powerType.suspend = "soft" -powerType.reset = "soft" -displayName = "dot" -usb.vbluetooth.startConnected = "TRUE" -guestOS = "ubuntu-64" -tools.syncTime = "TRUE" -tools.upgrade.policy = "upgradeAtPowerCycle" -sound.autoDetect = "TRUE" -sound.fileName = "-1" -numvcpus = "2" -vcpu.hotadd = "TRUE" -memsize = "4096" -mem.hotadd = "TRUE" -sata0.present = "TRUE" -nvme0.present = "TRUE" -nvme0:0.fileName = "focal-server-cloudimg-amd64.vmdk" -nvme0:0.present = "TRUE" -sata0:1.autodetect = "TRUE" -sata0:1.deviceType = "cdrom-image" -sata0:1.fileName = "cloudinit.iso" -sata0:1.startConnected = "TRUE" -sata0:1.present = "TRUE" -svga.graphicsMemoryKB = "8388608" -ethernet0.connectionType = "nat" -ethernet0.addressType = "generated" -ethernet0.virtualDev = "vmxnet3" -ethernet0.linkStatePropagation.enable = "TRUE" -serial0.fileType = "thinprint" -serial0.fileName = "thinprint" -ethernet0.present = "TRUE" -extendedConfigFile = "dot.vmxf" -floppy0.present = "FALSE" -ehci:0.parent = "-1" -ehci:0.port = "0" -ehci:0.deviceType = "video" -ehci:0.present = "TRUE" -nvme0:1.fileName="storage.vmdk" -nvme0:1.present="TRUE" diff --git a/vm/meta-data b/vm/meta-data deleted file mode 100644 index e69de29..0000000 diff --git a/vm/network-config b/vm/network-config deleted file mode 100644 index 511eefb..0000000 --- a/vm/network-config +++ /dev/null @@ -1,14 +0,0 @@ -version: 1 -config: - - type: physical - name: eth0 - subnets: - - type: static - address: 192.168.136.10 - netmask: 255.255.255.0 - gateway: 192.168.136.1 - dns_nameservers: - - 1.1.1.1 - - 8.8.8.8 - dns_search: - - localdomain diff --git a/vm/original/build b/vm/original/build deleted file mode 100644 index 60d15d9..0000000 --- a/vm/original/build +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/env bash -# shellcheck disable=SC2016,SC2119,SC2120,SC2230,SC2034 -shellcheck "$0" -set -euo pipefail - -declare -A D # contains VM configuartion data - -# ---------------------- executable dependencies --------------------- - -# NOTE: following must be found in path -declare vdiskmanager=vmware-vdiskmanager -declare vmrun=vmrun - -# adapt for WSL2 (Windows) variation -if [[ $(uname -r) =~ [Mm]icrosoft ]]; then - vdiskmanager=vmware-vdiskmanager.exe - vmrun=vmrun.exe -fi - -which "$vmrun" &>/dev/null || (echo "vmrun not found" && exit 1) -which "$vdiskmanager" &>/dev/null || (echo "vmrun not found" && exit 1) -which "curl" &>/dev/null || (echo "curl not found" && exit 1) -which "qemu-img" &>/dev/null || (echo "qemu-img not found" && exit 1) -which "mkisofs" &>/dev/null || (echo "mkisofs not found" && exit 1) - -# --------------------------- vmx template --------------------------- - -# This is a copy from a .vmx file originally created from the VMware GUI -# but with much of the post start extra stuff removed. This includes the -# expectation of a storage.vmdk extra drive. - -declare VMX_TEMPLATE=' -.encoding = "UTF-8" -config.version = "8" -virtualHW.version = "18" -mks.enable3d = "TRUE" -pciBridge0.present = "TRUE" -pciBridge4.present = "TRUE" -pciBridge4.virtualDev = "pcieRootPort" -pciBridge4.functions = "8" -pciBridge5.present = "TRUE" -pciBridge5.virtualDev = "pcieRootPort" -pciBridge5.functions = "8" -pciBridge6.present = "TRUE" -pciBridge6.virtualDev = "pcieRootPort" -pciBridge6.functions = "8" -pciBridge7.present = "TRUE" -pciBridge7.virtualDev = "pcieRootPort" -pciBridge7.functions = "8" -vmci0.present = "TRUE" -hpet0.present = "TRUE" -nvram = "{{name}}.nvram" -virtualHW.productCompatibility = "hosted" -powerType.powerOff = "soft" -powerType.powerOn = "soft" -powerType.suspend = "soft" -powerType.reset = "soft" -displayName = "{{name}}" -usb.vbluetooth.startConnected = "TRUE" -guestOS = "{{guest_os}}" -tools.syncTime = "TRUE" -tools.upgrade.policy = "upgradeAtPowerCycle" -sound.autoDetect = "TRUE" -sound.fileName = "-1" -numvcpus = "{{cores}}" -vcpu.hotadd = "TRUE" -memsize = "{{memory}}" -mem.hotadd = "TRUE" -sata0.present = "TRUE" -nvme0.present = "TRUE" -nvme0:0.fileName = "{{vmdk}}" -nvme0:0.present = "TRUE" -sata0:1.autodetect = "TRUE" -sata0:1.deviceType = "cdrom-image" -sata0:1.fileName = "cloudinit.iso" -sata0:1.startConnected = "TRUE" -sata0:1.present = "TRUE" -svga.graphicsMemoryKB = "8388608" -ethernet0.connectionType = "nat" -ethernet0.addressType = "generated" -ethernet0.virtualDev = "vmxnet3" -ethernet0.linkStatePropagation.enable = "TRUE" -serial0.fileType = "thinprint" -serial0.fileName = "thinprint" -ethernet0.present = "TRUE" -extendedConfigFile = "{{name}}.vmxf" -floppy0.present = "FALSE" -ehci:0.parent = "-1" -ehci:0.port = "0" -ehci:0.deviceType = "video" -ehci:0.present = "TRUE" -nvme0:1.fileName="storage.vmdk" -nvme0:1.present="TRUE" -' - -# ------------------------ user-data template ------------------------ - -declare USER_DATA_TEMPLATE=' -#cloud-config -users: - - name: {{user}} - ssh_authorized_keys: - - {{sshkey}} - sudo: - - ALL=(ALL) NOPASSWD:ALL - shell: /bin/bash - lock_passwd: false - passwd: "{{passwd}}" -fqdn: {{name}}.{{domain}} -hostname: {{name}} -manage_etc_hosts: true -runcmd: - - mkfs.xfs /dev/nvme0n2 - - mkdir /s - - echo "/dev/nvme0n2 /s xfs defaults 0 0" >>/etc/fstab - - mount -a -' - -# ---------------------- network-config template --------------------- - -declare NETWORK_CONFIG_TEMPLATE=' -version: 1 -config: - - type: physical - name: {{interface}} - subnets: - - type: static - address: {{ip}} - netmask: 255.255.255.0 - gateway: {{gateway}} - dns_nameservers: - - 1.1.1.1 - - 8.8.8.8 - dns_search: - - {{domain}} -' - -# ------------------------------- fill ------------------------------- - -# Fills any template using {{foo}} notation with values from passed -# associative array. Requires that the D associate array be declared and -# assigned before being called (within local function scope or -# globally). - -function fill { - local buf="$1" val - for i in "${!D[@]}"; do # D from caller scope - val=${D[$i]} - buf=${buf//\{\{$i\}\}/$val} - done - echo "$buf" -} - -# ------------------------------- fetch ------------------------------ - -function fetch { - local url="$1" out="$2" - [[ -e "$out" ]] && return 0 - curl -L "$url" -o "$out" -} - -# ------------------------ create vm functions ----------------------- - -# name # name of the VM to create, also hostname -# url # url to the qcow2 image to download -# qcow2 # name of QEMU image to save to disk -# vmdk # name of the vmdk image to create from the qcow2 -# vmdir # full path to the directory of VMs -# imgdir # full path to directory to cache image downloads -# user # username for VM -# passwd # mkpassd -s --method=SHA-512 encrypted password -# sshkey # ssh pub key for authorized_keys file -# domain # usually just localdomain -# interface # usually eth0 -# ip # check vmnetcfg.exe or vmnet-cfgcli for network -# gateway # probably best to end in .2 -# cores # CPU cores -# memory # in megabytes -# guest_os # the VMware thing for optimizations - -# ------------------------------ create ------------------------------ - -# Expects that a global D associative array has been set to pass the -# variables. - -function create { - # create the vmware virtual machine (skip if already exists) - local dir="${D[vmdir]}/${D[name]}.vmwarevm" - [[ -e "$dir" ]] && echo "Already exists: \"$dir\"" && return 0 - mkdir -p "$dir" - cd "$dir" - "$vdiskmanager" -c -s 100MB -a lsilogic -t 0 "storage.vmdk" - fill "$VMX_TEMPLATE" > "${D[name]}.vmx" - - # fetch the cloud-init enabled disk image and convert to vmware - if [[ ! -d "${D[imgdir]}/${D[qcow2]}" ]]; then - fetch "${D[url]}" "${D[imgdir]}/${D[qcow2]}" - qemu-img convert -O vmdk \ - "${D[imgdir]}/${D[qcow2]}" "${D[imgdir]}/${D[vmdk]}" - cp "${D[imgdir]}/${D[vmdk]}" "$dir" - fi - - # create the cloud-init configuration files - touch "meta-data" - fill "$USER_DATA_TEMPLATE" > "user-data" - fill "$NETWORK_CONFIG_TEMPLATE" > "network-config" - mkisofs -output "cloudinit.iso" -volid cidata -joliet \ - -rock {meta-data,user-data,network-config} - cd - -} - -# --------------- configure and create virtual machines -------------- - -D[name]=control -D[qcow2]="AlmaLinux-8-GenericCloud-8.5-20211119.x86_64.qcow2" -D[vmdk]="${D[qcow2]//qcow2/vmdk}" -D[url]="https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/${D[qcow2]}" -D[vmdir]="/mnt/c/Users/rob/Documents/Virtual Machines" -D[imgdir]="/mnt/c/Users/rob/Documents/DiskImages" -D[user]=rwxrob -D[passwd]='$6$rEibXMefJRd9q5L$F2y84STmrOJ30cTcjEEhQZGZ.bQV7VHJQ2Ek5com25Ywl7rgdLoRvT/Uw1z0r8ycYrZ3QoC2qcLQvsJ94ikEP0' -D[sshkey]='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIXETTuUIx75wsuPWvMH+mcdPQCXmixYzz6dNxzildM/ rwxrob@tv' -D[domain]="localdomain" -D[interface]="eth0" -D[ip]="192.168.136.10" -D[gateway]="192.168.136.2" -D[cores]="2" -D[memory]="2048" -D[guest_os]="rhel8-64" -create - -D[cores]="1" -D[memory]="2048" - -for i in {1..6}; do - D[name]=node$i - D[ip]="192.168.136.1$i" - create -done diff --git a/vm/user-data b/vm/user-data deleted file mode 100644 index 176a742..0000000 --- a/vm/user-data +++ /dev/null @@ -1,17 +0,0 @@ - - name: rwxrob - ssh_authorized_keys: - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIXETTuUIx75wsuPWvMH+mcdPQCXmixYzz6dNxzildM/ rwxrob@tv - sudo: - - ALL=(ALL) NOPASSWD:ALL - shell: /bin/bash - lock_passwd: false - #passwd: "{{passwd}}" -fqdn: dot.local -hostname: dot -manage_etc_hosts: true -runcmd: - - mkfs.xfs /dev/nvme0n2 - - mkdir /s - - echo "/dev/nvme0n2 /s xfs defaults 0 0" >>/etc/fstab - - mount -a -' From 18d2d89d792b60304bc020d555b7707beb83f8ad Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Fri, 3 Jan 2025 17:07:07 -0500 Subject: [PATCH 02/78] add changelog --- CHANGELOG.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..20f870f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- [x] CHANGELOG.md + +### Changed + +- [ ] `bash/.bashrc` changed to `config/shellrc` + +### Deprecated + +### Removed + +- [x] VM related stuff + +### Fixed + +### Security + +[Unreleased]: https://github.com/rwxrob/dot/compare/v0.1.0...HEAD From 595a3c2b7e956af994a732fac619d94998314c4f Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Fri, 3 Jan 2025 17:56:51 -0500 Subject: [PATCH 03/78] add blog command --- scripts/blog | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/blog diff --git a/scripts/blog b/scripts/blog new file mode 100755 index 0000000..fc6e4f3 --- /dev/null +++ b/scripts/blog @@ -0,0 +1,19 @@ +#!/bin/sh + +# TODO optimize rather than brute force +mark='// NEW POST HERE' + +markfound=$(grep "$mark" docs/index.adoc) +if [ -z "$markfound" ]; then + echo "no docs/index.adoc with '$mark' found" + exit 1 +fi + +file="$(slug "$*").adoc" + +hasfile=$(grep 'include::./'"$file"'\[\]' docs/index.adoc) +if [ -z "$hasfile" ]; then + perl -p -i -e "s,$mark,$mark\n\ninclude::./$file\[\]," docs/index.adoc +fi + +exec "$EDITOR" "docs/$file" From 9bd6334aa54af5bd32072d87e625de2758547a22 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Fri, 3 Jan 2025 18:05:22 -0500 Subject: [PATCH 04/78] add heading to new blog post --- scripts/blog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/blog b/scripts/blog index fc6e4f3..7f7c318 100755 --- a/scripts/blog +++ b/scripts/blog @@ -16,4 +16,8 @@ if [ -z "$hasfile" ]; then perl -p -i -e "s,$mark,$mark\n\ninclude::./$file\[\]," docs/index.adoc fi +if [ ! -e docs/"$file" ]; then + printf "= %s\n\n" "$*" >"docs/$file" +fi + exec "$EDITOR" "docs/$file" From f09d27a7b113fc1257804e0dfb8dadeeba3676a1 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 06:52:22 -0500 Subject: [PATCH 05/78] add tstamp to blog --- scripts/blog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/blog b/scripts/blog index 7f7c318..463f27e 100755 --- a/scripts/blog +++ b/scripts/blog @@ -17,7 +17,7 @@ if [ -z "$hasfile" ]; then fi if [ ! -e docs/"$file" ]; then - printf "= %s\n\n" "$*" >"docs/$file" + printf "= %s\n\n%s\n\n\n" "$*" "$(inow)" >"docs/$file" fi exec "$EDITOR" "docs/$file" From dba4f39db97377a8042dc9e6d0195e9289783a2f Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 07:41:14 -0500 Subject: [PATCH 06/78] save --- CHANGELOG.md | 25 ------------------------- DCO | 36 ------------------------------------ README.md | 4 +++- go.mod | 22 ---------------------- go.sum | 26 -------------------------- go.work | 3 --- go.work.sum | 12 ------------ scripts/buildadoc | 12 ++++++++++++ scripts/newx | 2 +- scripts/pr | 2 ++ scripts/save | 1 + 11 files changed, 19 insertions(+), 126 deletions(-) delete mode 100644 CHANGELOG.md delete mode 100644 DCO delete mode 100644 go.mod delete mode 100644 go.sum delete mode 100644 go.work delete mode 100644 go.work.sum create mode 100755 scripts/pr diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 20f870f..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,25 +0,0 @@ -# Changelog - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -- [x] CHANGELOG.md - -### Changed - -- [ ] `bash/.bashrc` changed to `config/shellrc` - -### Deprecated - -### Removed - -- [x] VM related stuff - -### Fixed - -### Security - -[Unreleased]: https://github.com/rwxrob/dot/compare/v0.1.0...HEAD diff --git a/DCO b/DCO deleted file mode 100644 index 36fe7b6..0000000 --- a/DCO +++ /dev/null @@ -1,36 +0,0 @@ -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -1 Letterman Drive -Suite D4700 -San Francisco, CA, 94129 - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. diff --git a/README.md b/README.md index c5011d3..3eb26ee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # Dotfiles, scripts, and stuff -Pilfer at your own peril. +Pilfer at your own peril. Unlike other projects, I regularly just commit to main with short commit messages (see [`scripts/savedot`](scripts/savedot)), sometimes several times per day. You have been warned. + +I've designed this repo to be something I can quickly clone to any system and just run [setup](setup) to get immediately up and running. I prefer this over trying to keep a workspace container constantly current and updated. In fact, it is so fast to just `git pull` that I consider all the other clones read-only and only pull from changes made to this central repo. That way I never have a merge conflict and can use these dotfiles without fear that committing from a system that isn't one I own could give a company full ownership of the entire repo per IP policies (go watch season one of Silicon Valley). diff --git a/go.mod b/go.mod deleted file mode 100644 index 41420d0..0000000 --- a/go.mod +++ /dev/null @@ -1,22 +0,0 @@ -module github.com/rwxrob/dot - -go 1.18 - -require ( - github.com/rwxrob/bonzai v0.20.10 - github.com/rwxrob/choose v0.2.1 - github.com/rwxrob/fs v0.20.2 -) - -require ( - github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rwxrob/compcmd v0.3.0 // indirect - github.com/rwxrob/fn v0.4.0 // indirect - github.com/rwxrob/pegn v0.2.1 // indirect - github.com/rwxrob/structs v0.6.0 // indirect - github.com/rwxrob/term v0.2.9 // indirect - github.com/rwxrob/to v0.12.1 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/term v0.10.0 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index 6ac79ab..0000000 --- a/go.sum +++ /dev/null @@ -1,26 +0,0 @@ -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rwxrob/bonzai v0.20.10 h1:MC77uTOENkQA2Zt/r98teSgP/bHuGw04s5k1ECAKgq0= -github.com/rwxrob/bonzai v0.20.10/go.mod h1:QmLf6NXoVtTf3pY7eYR4+k9daz2bdRiiq5ArFckAW3E= -github.com/rwxrob/choose v0.2.1 h1:iuN6NkiOwER6QpSzEVTTp+ZOb33PGFIC3Y1OK6D6Quc= -github.com/rwxrob/choose v0.2.1/go.mod h1:mhuV7pY/62p1sZCvCGVET5GuF+Z126hKxqnzSUOO0EU= -github.com/rwxrob/compcmd v0.3.0 h1:AlJNItb7+Yk17qmH5E7TJFyBXhna/rS3NeQAgjqbFls= -github.com/rwxrob/compcmd v0.3.0/go.mod h1:XOHl6bS2Uen6Wx2mxtbtUhT8Sbz1IhnaE55xPkhTBD4= -github.com/rwxrob/fn v0.4.0 h1:lUZEkELSFAlPhzrkNhgB/xoTkz9tv5op4g0QfggSZFg= -github.com/rwxrob/fn v0.4.0/go.mod h1:omPqOqEB+dDna09z5pi5YFxq4IZqDvv3wFPUCES5LvY= -github.com/rwxrob/fs v0.20.2 h1:TYUgr7wZYhyMgCINygQOa4Cf1zJahZ8qmZX1KsIJyH4= -github.com/rwxrob/fs v0.20.2/go.mod h1:iSQeNjy6YY1UCfL0LBwzKH6qZLRnVG9InZYvMnJX8wA= -github.com/rwxrob/pegn v0.2.1 h1:roE+SkNl66SLJkeEHowuds+0lUOjSlTHE8IDJuZZUNs= -github.com/rwxrob/pegn v0.2.1/go.mod h1:TyD3XS8ddVucs2gwMr1VhB2HbHiruzj6Ub67RZGTfMA= -github.com/rwxrob/structs v0.6.0 h1:t8JVd/Pee1OGaXgT6QYmGed470C9vOw6scdH8Cr5LPg= -github.com/rwxrob/structs v0.6.0/go.mod h1:txMfzPfEiIDNM5bwhzUqxr/1QQ3ekOuj3KLT8Nt1fA0= -github.com/rwxrob/term v0.2.9 h1:lXcrmKMbMQ5Etfm+tjAbHsx2v2yHnZSvzOfS/LGDBXc= -github.com/rwxrob/term v0.2.9/go.mod h1:ptzymk+QUaT54SiRzh6ITMW65qGsJDAdSZIysq17iO8= -github.com/rwxrob/to v0.12.1 h1:2x1SgNK2ixE7FhbDFK2fzlx3Y3qPIBcSFm/jivUzOQM= -github.com/rwxrob/to v0.12.1/go.mod h1:8+uSoxMWfTSY/KU57db87hWGZGsiVW0uSDZd7NAgInI= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= diff --git a/go.work b/go.work deleted file mode 100644 index 4567d9d..0000000 --- a/go.work +++ /dev/null @@ -1,3 +0,0 @@ -go 1.18 - -use . diff --git a/go.work.sum b/go.work.sum deleted file mode 100644 index 8c85bc7..0000000 --- a/go.work.sum +++ /dev/null @@ -1,12 +0,0 @@ -github.com/rwxrob/json v0.7.0 h1:zj9/Wh2QgCfc8YqMzk8i1pC3CY3CH87zC3JlxYBf5QY= -github.com/rwxrob/json v0.7.0/go.mod h1:BYaPIp+4cI64f7jdqkaVAjqU/HSIiwkqPNDr9tTUvRQ= -github.com/rwxrob/scan v0.11.0 h1:VCl8/mxpLDvYl6g4BgCBoz4Lq00Yri6OkuEMIrwAnVw= -github.com/rwxrob/scan v0.11.0/go.mod h1:sDIllL5+Ppk33AHkhhdrkPLP0EheWQPoNotKMhUfCIg= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/scripts/buildadoc b/scripts/buildadoc index 08c2a68..15eec01 100755 --- a/scripts/buildadoc +++ b/scripts/buildadoc @@ -28,6 +28,18 @@ qx{ asciidoctor \\ ./docs/index.adoc }; +qx{ asciidoctor \\ + -D docs \\ + -a date="$date" \\ + -a toc! \\ + -a hours_mentor="$hours_mentor" \\ + -a hours_self="$hours_self" \\ + -a hours_total="$hours_total" \\ + -a hours_week="$hours_week" \\ + -o notoc.html \\ + ./docs/index.adoc +}; + my $pwd = `pwd`; $pwd =~ s/\R$//; # chomp no longer works in modern perl my ( $parent, $name ) = $pwd =~ m,/([^/]+)/([^/]+)$,m; diff --git a/scripts/newx b/scripts/newx index 6882acc..bfc392b 100755 --- a/scripts/newx +++ b/scripts/newx @@ -13,6 +13,6 @@ if test -e "${path}"; then exit 0 fi -printf "#!/usr/bin/env bash\n\n" > "${path}" +printf "#!/bin/sh\n\n" > "${path}" chmod +x "${path}" exec "$EDITOR" +2 "${path}" diff --git a/scripts/pr b/scripts/pr new file mode 100755 index 0000000..7b89d24 --- /dev/null +++ b/scripts/pr @@ -0,0 +1,2 @@ +#!/bin/sh +exec gh pr edit --body "$@" diff --git a/scripts/save b/scripts/save index a2ee0a9..5f6a08c 100755 --- a/scripts/save +++ b/scripts/save @@ -14,6 +14,7 @@ gitsave() { git pull git add -A . local message="$*" + message=${message,,} if test -n "$message"; then git commit -a -m "$message" elif test -e /tmp/commitmsg; then From 6c34ae5583ecf18b88eed41928325ab4c68e6518 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 08:57:09 -0500 Subject: [PATCH 07/78] move _old to deprecated --- scripts/1to10 | 2 - scripts/255color | 7 +- scripts/_old/compexample | 632 -------------------------------- scripts/_old/gh | 42 --- scripts/_old/log | 33 -- scripts/_old/sunrise | 26 -- scripts/buildadoc | 4 + scripts/{_old => deprecated}/kn | 0 scripts/f | 3 +- 9 files changed, 9 insertions(+), 740 deletions(-) delete mode 100755 scripts/1to10 delete mode 100755 scripts/_old/compexample delete mode 100755 scripts/_old/gh delete mode 100755 scripts/_old/log delete mode 100755 scripts/_old/sunrise rename scripts/{_old => deprecated}/kn (100%) diff --git a/scripts/1to10 b/scripts/1to10 deleted file mode 100755 index 6a44cd1..0000000 --- a/scripts/1to10 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -for i in {1..10}; do echo $i. thing; done diff --git a/scripts/255color b/scripts/255color index 0ed2f43..c651572 100755 --- a/scripts/255color +++ b/scripts/255color @@ -1,4 +1,5 @@ -#!/usr/bin/env bash -for i in {0..255}; do - printf "\e[38;5;${i}m$i " +#!/bin/sh +for i in $(seq 0 255); do + printf "\e[38;5;%sm%s " "$i" "$i" done +echo diff --git a/scripts/_old/compexample b/scripts/_old/compexample deleted file mode 100755 index c039ccf..0000000 --- a/scripts/_old/compexample +++ /dev/null @@ -1,632 +0,0 @@ -#!/bin/bash -# -# Knowledge Management Utility -# -# Please maintain the style as described in Google's Shell Style Guide -# -# Copyright Β© 2020 Robert Sterling Muhlestein. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -####################################### -# Assumes modern terminal with RGB. - -declare NOCOLOR= -[[ -t 1 ]] || NOCOLOR=y -declare GOLD=$'\033[38;2;184;138;0m' -declare RED=$'\033[38;2;255;0;0m' -declare GREY=$'\033[38;2;100;100;100m' -declare CYAN=$'\033[38;2;0;255;255m' -declare GREEN=$'\033[38;2;0;255;0m' -declare RESET=$'\033[0m' - -if [[ -n "$NOCOLOR" ]] ; then - GOLD= - RED= - GREY= - CYAN= - GREEN= - RESET= -fi - -####################################### -# Validate that a current knowledge node has been declared as KN -# environment variable. - -if [[ -z "${KN}" ]]; then - echo "${RED}Please set \$KN to current knowledge node path." - exit 1 -fi - -####################################### -# Each command must have an accompanying function that begins with an -# underscore to which the main command will delgate. - -readonly -a COMMANDS=( - usage render build preview previewstop mkmanifest checkone audit find - title rss logdir logpath datepath logroot recdir -) - -####################################### -# Print the first argument as a colored message and exit with -# error status. -# -# Globals: -# RED -# Arguments: -# Message to print -# Outputs: -# Red message text -# Returns: -# Always returns 1 - -_fail () { - echo "${RED}$1${RESET}" >&2 - exit 1 -} - -####################################### -# Returns true if first argument is the name of a command in the PATH. -# -# Arguments: -# Message to print. - -_have () { - which "$1" &>/dev/null -} - -####################################### -# Returns true if process is currently running. -# -# Arguments: -# Process ID number. - -_proc () { - kill -0 "$1" 2>/dev/null -} - -####################################### -# Skip through a timestamped MANIFEST file to the first matching line -# and continue to output the name/IDs of the lines beginning with that -# line until the end of the file. Will look for a file in -# current directory named MANIFEST if one is not passed as the second -# argument. The format of the file is a float that is seconds since -# epoch (potentially with nanoseconds) followed by whitespace and then -# the name/ID of a knowledge node (directory): -# -# 1591796821.3353818530 boosts/logistics -# -# Arguments: -# Exact string to match a line in the file. -# Path to the file to skip through. - -_skipto () { - local there - local match="$1" - local file="${2:-MANIFEST}" - if [[ -z "${match}" ]]; then - read -r changed line <<< $(head -1 ${file}) - echo ${line} - return - fi - while read -r changed line; do - [[ "${match}" == "${line}" ]] && there=y - [[ "${there}" != y ]] && continue - echo "${line}" - done < "${file}" -} - -####################################### -# Allows the reading of all combined arguments into a string buffer that -# is then echoed, or if no arguments are detected reads fully from -# standard input until there is none left and echoes that. This is -# notable because it allows the usage of heredoc input instead of -# arguments making for much cleaner blocks of text. [Ex: declare -# id=$(_argsorin $*)] -# -# Arguments: -# All are combined into string. - -_argsorin () { - local buf="$*" line IFS - if [[ -n "${buf}" ]]; then - echo "${buf}" - return - fi - read line - buf="${line}" - while IFS= read line; do - buf="${buf}\n${line}" - done - echo "${buf}" -} - -####################################### -# Create a MANIFEST file in the root of the knowledge base that contains -# the knowledge node identifiers (relative paths) and the last modified -# time in seconds since Unix epoch (first). Anything beginning with -# underscore (_) will be ignored. The MANIFEST file is the only file -# required by subscribers to identify if anything has changed in the -# knowledge base since the last time it was the subscriber cached it -# locally. The root node of the knowledge base is a single dot. -# -# Arguments: -# Path to the manifest file. MANIFEST by default. - -_mkmanifest () { - declare line IFS file="${1:-MANIFEST}" - while IFS= read -r line; do - line=${line#/} - line=${line/.\//} - [[ -z "${line}" ]] && continue - echo "${line}" - done <<< $( - find . ! -path '*/_*' -a \ - -name 'README.md' \ - -printf "%T@ %h\n" \ - | sort -d) > "${file}" -} - -####################################### -# Output the full path to the current log file for the current day (by -# default). Normal `date` command adjustments can be added as extra -# arguments as they are passed directly to `date -d`. - -_logpath () { - local dir=$(_logdir "$*") - echo "${dir}/README.md" -} - -####################################### -# Output the full path to the current log dir for the current day (by -# default). Normal `date` command adjustments can be added as extra -# arguments as they are passed directly to `date -d`. - -_logdir () { - local relpath=$(_datepath "$*") - echo "${KN}/log/${relpath}" -} - -####################################### -# Output the full path to the current log rec dir for the current day -# (by default). This is where video and audio recordings YAML documents -# should normally be kept (but not where the actual audio and -# video files should be saved due to size). Normal `date` command -# adjustments can be added as extra arguments as they are passed -# directly to `date -d`. - -_recdir () { - local dir=$(_logdir "$*") - echo "${dir}/rec" -} - -####################################### -# Outputs the full path to the root log directory for the current -# knowledge node. - -_logroot () { - echo "${KN}/log" -} - -####################################### -# Output the current date as a path for use when creating content within -# a directory file structure that models chronological data. Accepts -# anything that can be passed to `date -d`. - -_datepath () { - date +%4Y/%m/%d "-d $@" -} - -####################################### -# Call the pandoc command to render a single node passed as the -# first and only argument. The HTML index.html output is created in the -# same knowledge node subdirectory. A single dot (.) can be passed to -# render the root node of the knowledge base. -# -# Globals: -# README -# RED -# CYAN -# RESET -# Arguments: -# Node ID -# Outputs: -# Prints colored error output from Pandoc -# -# TODO allow more pandoc arguments to be passed from configuration - -_render () { - local error style - local node="${1%/README.md}" - local template='--template=main' - local in="${node}/README.md" - local hi='--no-highlight' - local out="--output=${node}/index.html" - local ddir="${README}/assets" - [[ ! -e "${in}" ]] && _fail "Could not find ${CYAN} '${in}'" - [[ -e "${README}/global.yml" ]] && gdata="global.yml" - [[ -e "${node}/styles.css" ]] && style="--metadata=xstyles:styles.css" - [[ -e "${node}/template.html" ]] && template="--template=${node}/template.html" - error=$(pandoc -s -M title=_ ${nosyn} --data-dir=${ddir} ${hi} ${out} \ - ${template} ${style} ${gdata} ${in} 2>&1) - [[ -n "${error}" ]] && echo ${CYAN}${node}:${RED} ${error}${RESET} >&2 -} - -####################################### -# Makes the manifest again and renders all the nodes of the knowledge -# base asyncronously. No effort is made to stagger the rendering of nodes -# into any sort of workgroup since rendering a single node is very fast -# and most operating systems can easily handle concurrent rendering of -# every existing node. -# -# Globals: -# GREY -# RESET -# Arguments: -# None -# Outputs: -# Prints colored summary of number of nodes rendered and speed. - -_build () { - local begin end - local -a pids - local -i count - begin=$(date +%s) - _mkmanifest - _render '.' - while read -r change node; do - _render "${node}" & - count+=1 - done < ./MANIFEST - wait - end=$(date +%s) - _rss - echo "${GRAY}Rendered ${count} nodes in $((end-begin)) seconds.${RESET}" -} - -####################################### -# Checks a single node for broken links and such. Depends on `muffet` -# being installed. -# -# Globals: -# GREEN -# RESET -# Arguments: -# Node name/ID -# Outputs: -# Prints colored 'No broken URLs detected.' if passing -# Prints any error output from muffet if failing -# TODO: -# Read target node as second argument or from config - -_checkone () { - _have muffet || _fail 'Install https://github.com/raviqqe/muffet' - [[ -e .previewpid ]] || _fail "Doesn't look like preview is running (no .previewpid)." - declare node="http://localhost:3001/$1" - muffet \ - --one-page-only "${node}" \ - --exclude 'https://duck.com' \ - --exclude 'https://duckduckgo.com' \ - --exclude 'https://www.lifewire' \ - --exclude 'http://linuxcommand' \ - --exclude 'https://vimgenius.com' - if [[ $? != 0 ]]; then - return 1 - fi - echo " ${GREEN}No Broken URLs detected.${RESET}" -} - -####################################### -# Slowly checks one node at a time from the MANIFEST keeping track of -# each as it goes. This is useful for interactively correcting -# potentially dozens of broken links. To reset to the beginning simple -# remove the .lastchecked file. -# -# Globals: -# GREY -# RESET -# Arguments: -# None -# Outputs: -# Prints 'Checking ' and the output of checknode for each - -_audit () { - # see _checkone for dependency validations - local last node - if [[ ! -e .lastchecked ]]; then - local line=$(head -1 MANIFEST) - node=${line#* } - echo $node > .lastchecked - return - fi - read -r last < .lastchecked - while read -r node; do - echo "${GREY}Checking ${node}${RESET}" - _checkone "${node}" - local rval=$? - echo "${node}" >| .lastchecked - if [[ ${rval} != 0 ]]; then - return 1 - fi - done <<< $(_skipto "${last}") -} - -####################################### -# Runs the amazing browser-sync live site previewing utility -# putting it into the background and writing the PID to .previewpid. -# The preview can later be disabled with previewstop. Preview has to -# be running for the check* COMMANDS to work. -# -# Globals: -# GREY -# GREEN -# CYAN -# RESET -# Arguments: -# None -# Outputs: -# Error output if not browser-sync -# Returns: -# Fails if no browser-sync detected on the system -# Success if browser-sync started - -_preview () { - _have browser-sync || _fail 'Need to install browser-sync.' - declare pid=$(head -1 .previewpid 2>/dev/null) - if [[ -n "${pid}" ]]; then - if _proc "${pid}"; then - _fail "Already previewing." - else - rm .previewid 2>/dev/null - fi - fi - browser-sync start \ - --no-notify --no-ui \ - --ignore '**/.*' \ - -sw &>/dev/null & - pid=$! - echo "${pid}" >| .previewpid - echo "${GREEN}Previewing with ${CYAN}browser-sync ${GREY}(${pid})${RESET}" -} - -####################################### -# Stops the pid contained .previewpid if found. -# -# Globals: -# GREY -# GREEN -# RESET -# Arguments: -# None -# Outputs: -# Error messages on failure -# "Previewing stopped ..." on success -# Returns: -# Failure (1) if nothing being previewed -# Success (0) if preview running and stopped. - -_previewstop () { - declare pid=$(head -1 .previewpid 2>/dev/null) - [[ -z "${pid}" ]] && _fail "Don't appear to be previewing (no preview PID found)." - kill "${pid}" && rm .previewpid - echo "${GREEN}Previewing stopped ${GREY}(killed ${pid} and removed .previewpid)${RESET}" -} - -####################################### -# Searches the MANIFEST for a matching substring passed as the first and -# only parameter and prints the resulting full node identifiers with the -# substring highlighted in green. Also searches the _redirects list -# for possible shortcuts and other former identifiers -# -# Globals: -# GREY -# GREEN -# RESET -# Arguments: -# Substring to look for. -# Outputs: -# Prints the node names/IDs of matches. -# Prints errors if nothing to find. -# Returns: -# Failure (1) if nothing to find. -# Success (0) if either something found or not found. -# TODO: -# Replace with other find that matches based on header and tag -# hits with priority and puts the top 20 in a select list - -_find () { - declare substr="$1" - [[ -z "$1" ]] && _fail 'Nothing to find.' - while read -r changed name; do - [[ -z "${name}" ]] && continue - echo "${GREY}$(_url)/${name%%${substr}*}${GREEN}${substr}${GREY}${name##*${substr}}" - done <<< $(grep "${substr}" MANIFEST) - while read -r redirect; do - [[ -z "${name}" ]] && continue - echo "${GREY}$(_url)/${redirect%%${substr}*}${GREEN}${substr}${GREY}${redirect##*${substr}}" - done <<< $(grep "${substr}" _redirects) -} - -####################################### -# Returns the URL YAML field from the main README.md file. - -_url () { - local line=$(grep ^URL: README.md) - echo ${line#URL:} -} - -####################################### -# Returns the Short YAML field from the main README.md file. - -_short () { - local line=$(grep ^Short: README.md) - echo ${line#Short:} -} - -####################################### -# Returns the Description YAML field from the main README.md file. - -_description () { - local line=$(grep ^Description: README.md) - echo ${line#Description:} -} - -####################################### -# Returns the copyright YAML field from the main README.md file. - -_copyright () { - local line=$(grep ^Copyright: README.md) - echo ${line#Copyright:} -} - -####################################### -# Parses out the Title from the specified node and prints it. -# -# Globals: -# GREEN -# RESET -# Arguments: -# Node name/ID -# Outputs: -# Prints the title of the given node in color. - -_title () { - declare -a nodes - if [[ -n "$1" ]]; then - nodes="$@" - else - while IFS= read -r line; do - nodes+=(${line}) - done - fi - for node in ${nodes[@]}; do - while read -r line; do - if [[ "$line" =~ ^Title:\ ]]; then - echo "${GREEN}${line:7}${RESET}" - fi - done < "${node}/README.md" 2>/dev/null - done -} - -####################################### -# Creates an RSS feed if the node is a log. - -_rss () { - declare dir=${1:-.} - declare file="${dir}"/README.md - egrep '^## +(Mon|Tue|Wed|Thu|Fri|Sat|Sun)' "${file}" &>/dev/null - if [[ $? == 0 ]]; then - - # TODO make all of this only add if detected - echo ' - - - -'$(_short)' -'$(_url)' -'$(_description)' -'$(_copyright)'' > "${dir}"/rss.xml - -declare -i item=0 -buf="" -while read line; do - if [[ "${line}" =~ ^##\ +(Mon|Tue|Wed|Thu|Fri|Sat|Sun) ]]; then - if [[ $item > 0 ]]; then - echo "${buf}" |perl -pe 's,\[(.+)\](.*),\1,;s,(<|>),,g;s,&,&,g' >> "${dir}"/rss.xml - echo '' >> "${dir}"/rss.xml - buf="" - fi - item=$((item+1)) - echo '' >> "${dir}"/rss.xml - #guid=${line#\#\# *} - #guid=${guid// } - #TODO user relative link creator for URI - echo ''${line#\#\# *}'' >> "${dir}"/rss.xml - #echo ''$guid'' >> "${dir}"/rss.xml - echo '' >> "${dir}"/rss.xml - continue - fi - if [[ "${line}" == "" ]]; then - continue - fi - buf="$buf $line" -done < <(egrep '^## +(Mon|Tue|Wed|Thu|Fri|Sat|Sun)' -A 5 "${file}") - - echo "${buf}" |perl -pe 's,\[(.+)\](.*),\1,;s,(<|>),,g;s,&,&,g' >> "${dir}"/rss.xml - echo '' >> "${dir}"/rss.xml -echo '' >> "${dir}"/rss.xml - - return 0 - else - echo ${RED}Not a log file.${RESET} - return 1 - fi -} - -####################################### -# Prints each of the command names and exits. - -_usage () { - echo "${GREY}usage: ${GOLD}kn ${CYAN}${RESET}" - for i in ${COMMANDS[@]}; do echo " ${CYAN}$i"; done -} - -####################################### -# Checks if command is being used in tab completion context (`complete -C -# kn kn` and COMP_LINE set). If so handle completion and exit. -# Otherwise, assume execution context. Detect the README working -# directory since more than one README knowledge base may exist on -# a single system. Look for full COMMAND matches for the first argument. -# Then accept the first matching substring as the command to use. Then -# delegate. - -main () { - local c cmd="${1-usage}" - shift 2>/dev/null - - # knowledge base detection - #[[ -d .git && -e README.md ]] && export README="${PWD}" - [[ -e README.md ]] && export README="${PWD}" - [[ -z "${README}" ]] && _fail "Need to set README environment variable" - cd "${README}" || _fail "Could not change into README directory: ${README}" - - # tab completion - if [[ -n "$COMP_LINE" ]]; then - for c in ${COMMANDS[@]}; do - [[ "${c:0:${#1}}" == "$1" ]] && echo "${c}" - done - exit 0 - fi - - # full command match - for c in ${COMMANDS[@]}; do - if [[ "${c}" == "${cmd}" ]]; then - "_${c}" "$@" - exit 0 - fi - done - - # partial command match - for c in ${COMMANDS[@]}; do - if [[ "${c}" =~ ^${cmd} ]]; then - "_${c}" "$@" - exit 0 - fi - done -} - -# NORUN allows this file to be sourced while checking for syntax errors -# and unit testing specific functions. - -[[ -z "${NORUN}" ]] && main "$@" diff --git a/scripts/_old/gh b/scripts/_old/gh deleted file mode 100755 index fc91e5f..0000000 --- a/scripts/_old/gh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -declare subcommand="$1"; shift -declare -r gold=$'\033[38;2;250;130;10m' -declare -r cyan=$'\033[38;2;0;255;255m' -declare -r reset=$'\033[0m' - -ziplink () { - if [[ -z "$1" ]]; then - echo "usage: gh ziplink /" - fi - curl -s "https://api.github.com/repos/$1/releases/latest" |jq -r .zipball_url -} - -zipball () { - if [[ -z "$1" ]]; then - echo "usage: gh zipball /" - fi - declare link=$(ziplink "$1") - declare file=${1##*/}.${link##*/}.zip - echo "${gold}Downloading ${cyan}$link$reset -> ${cyan}$file$reset" - curl -s -L "$link" -o "$file" -} - -declare -a commands=(ziplink zipball) - -for i in ${commands[@]}; do - if [[ $i == "$subcommand" ]]; then - "$subcommand" $* - exit 0 - fi -done - -######################### Tab Completion Context ######################## - -# remember COMP_LINE is changed by shift -if [ -n "$COMP_LINE" ]; then - for cmd in ${commands[@]}; do - [[ "${cmd:0:${#1}}" == "$1" ]] && echo $cmd - done - exit 0 -fi diff --git a/scripts/_old/log b/scripts/_old/log deleted file mode 100755 index 3215cb1..0000000 --- a/scripts/_old/log +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# Opens the default log file with vim. Accepts the -# standard `date` offset. Prompts to commit. - -relpath=$(datepath "$*") -dir="${KN}/log/$relpath" -file="$dir/README.md" -mkdir -p "${dir}" - -# prepend a timestamped heading - -tmpfile=$(mktemp) -hnow "$*" >"${tmpfile}" -echo -e "\n\n" >>"${tmpfile}" -if [ -e "${file}" ]; then - cat "${file}" >>"${tmpfile}" -fi -mv "${tmpfile}" "${file}" - -echo "${file}" -vim +3 "${file}" - -read -p 'Do you want to commit? ' commit - -if [[ ! $commit =~ ^[Yy] ]]; then - exit -fi - -cd "${dir}" -git add "${file}" -git commit -#git push diff --git a/scripts/_old/sunrise b/scripts/_old/sunrise deleted file mode 100755 index 0e5264b..0000000 --- a/scripts/_old/sunrise +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -p=3.14 -i=0 - -reset () { - /usr/bin/reset - printf "\033[H\033[2J\033[0m" - exit -} - -trap "setterm --cursor on; stty echo; echo ${clear}; exit; trap -- - SIGINT SIGTERM" SIGTERM SIGINT -trap reset EXIT -trap reset SIGINT - -stty -echo -setterm --cursor off - -while true; do - i=$(bc -l <<< "$i+0.04") - r=$(bc -l <<< "128+127*s($i)") - g=$(bc -l <<< "128+127*s($i+$p*(1/3))") - b=$(bc -l <<< "128+127*s($i+$p*(2/3))") - printf "\033[48;2;${r%%.*};${g%%.*};${b%%.*}m\n" - sleep .01 -done diff --git a/scripts/buildadoc b/scripts/buildadoc index 15eec01..9b26b09 100755 --- a/scripts/buildadoc +++ b/scripts/buildadoc @@ -20,6 +20,7 @@ my $date = sprintf "%04d-%02d-%02d %02d:%02d:%02d", qx{ asciidoctor \\ -D docs \\ -a date="$date" \\ + -a allow-uri-read \\ -a hours_mentor="$hours_mentor" \\ -a hours_self="$hours_self" \\ -a hours_total="$hours_total" \\ @@ -32,6 +33,7 @@ qx{ asciidoctor \\ -D docs \\ -a date="$date" \\ -a toc! \\ + -a allow-uri-read \\ -a hours_mentor="$hours_mentor" \\ -a hours_self="$hours_self" \\ -a hours_total="$hours_total" \\ @@ -48,6 +50,7 @@ my ( $parent, $name ) = $pwd =~ m,/([^/]+)/([^/]+)$,m; qx{ asciidoctor-pdf \\ -D docs \\ -a date="$date" \\ + -a allow-uri-read \\ -a hours_mentor="$hours_mentor" \\ -a hours_self="$hours_self" \\ -a hours_total="$hours_total" \\ @@ -60,6 +63,7 @@ qx{ asciidoctor-pdf \\ qx{ asciidoctor-epub3 \\ -D docs \\ -a date="$date" \\ + -a allow-uri-read \\ -a hours_mentor="$hours_mentor" \\ -a hours_self="$hours_self" \\ -a hours_total="$hours_total" \\ diff --git a/scripts/_old/kn b/scripts/deprecated/kn similarity index 100% rename from scripts/_old/kn rename to scripts/deprecated/kn diff --git a/scripts/f b/scripts/f index 958cf1b..d8bc701 100755 --- a/scripts/f +++ b/scripts/f @@ -1,6 +1,5 @@ #!/usr/bin/env perl -use strict; -use warnings; +use v5.36; my $input = shift; my $delim = shift || '\s+'; From 77e612b16c0817dd4e855d9490deb8f7e91155d3 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 10:49:22 -0500 Subject: [PATCH 08/78] save --- README.md | 30 ++++++++++++++++++++++++++++-- scripts/ageof | 20 +++++++++----------- scripts/allfigl | 4 ++-- scripts/buildadoc | 9 ++++++--- scripts/preview | 19 ++++++++++++------- 5 files changed, 57 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 3eb26ee..1e7a9a4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,31 @@ # Dotfiles, scripts, and stuff -Pilfer at your own peril. Unlike other projects, I regularly just commit to main with short commit messages (see [`scripts/savedot`](scripts/savedot)), sometimes several times per day. You have been warned. +Pilfer at your own peril. Follow if you like. Sponsor if you're an angel. + +Unlike other projects, I regularly just commit to main with short commit messages (see [`scripts/savedot`](scripts/savedot)). I regularly commit multiple times per day. You have been warned. + +## Working style + +I'm an old SysAdmin, a Software Developer Engineer, an SRE, a hacker, a writer, and educator. This means that while I do have a favorite, cozy dev environment on my 14" Macbook Pro, I still want my dotfiles to work anywhere. + +I've designed this repo to be something I can quickly clone to any system and just run [setup](setup) plus a few `install` scripts for the stuff I need to get immediately up and running. This process is so fast that I consider all the other Git clones read-only and only pull from changes made to this central repo. That way I never have a merge conflict and can use these dotfiles without fear that committing from a system that isn't one I own could give a company full ownership of the entire repo per IP policies (go watch season one of Silicon Valley). + +To keep `git clone` operations fast I regularly rebase this Git repo. + +I've tried workspace containers in the past and it is just too much hassle to keep the up to date even with CI/CD. Who knows, maybe I'll try again some time. Probably not, however, because I don't always need all the stuff that I install on my cozy workstation. Hence all the `install` scripts. + +## Interactive shell + +I use `zsh`, `bash`, and `ksh` for my interactive shells. My `config/shell` has an `rc` file that can be used for `~/.bashrc` or `~/.zshrc`. The `config-shell` command senses the current shell and does the right thing. + +## Dependencies + +Check out my [FAQ](https://github.com/rwxrob/faq) for answers about my preferences for dependencies. + +- POSIX shell (`/bin/sh`) +- Vim or NeoVim (hence the `~/.vimrc` AND `init.lua`) +- WezTerm (no I do not like Ghostty, no dynamic config) +- Perl v5.36 (`/usr/bin/env perl`) + +For other dependencies see the scripts that begin with `install` and `config`. -I've designed this repo to be something I can quickly clone to any system and just run [setup](setup) to get immediately up and running. I prefer this over trying to keep a workspace container constantly current and updated. In fact, it is so fast to just `git pull` that I consider all the other clones read-only and only pull from changes made to this central repo. That way I never have a merge conflict and can use these dotfiles without fear that committing from a system that isn't one I own could give a company full ownership of the entire repo per IP policies (go watch season one of Silicon Valley). diff --git a/scripts/ageof b/scripts/ageof index a0e2913..6c5a7dd 100755 --- a/scripts/ageof +++ b/scripts/ageof @@ -1,15 +1,13 @@ -#!/usr/bin/env bash +#!/bin/sh # Outputs the seconds since the thing identified by the first argument # was last modified (not created). -ageof() { - local path="$1" - if [[ -z "$path" ]]; then - echo 'usage: ageof ' - return 1 - fi - echo $(( $(date +%s) - $(date -r "$path" +%s) )) -} - -ageof "$@" +path="$1" +if ! test -e "$path"; then + echo 'usage: ageof ' + exit 1 +fi +current=$(date +%s) +ofpath=$(date -r "$path" +%s) +echo $((current - ofpath)) diff --git a/scripts/allfigl b/scripts/allfigl index 8506f93..cf1a687 100755 --- a/scripts/allfigl +++ b/scripts/allfigl @@ -1,6 +1,6 @@ #!/bin/sh fontsd="$REPOS/github.com/rwxrob/fonts/figlet" for font in "$fontsd"/*.flf; do - echo "FONT: $font" - figlet -d "$fontsd" -f "${font}" hello + echo "FONT: $font" + figlet -d "$fontsd" -f "${font}" hello done diff --git a/scripts/buildadoc b/scripts/buildadoc index 9b26b09..970b001 100755 --- a/scripts/buildadoc +++ b/scripts/buildadoc @@ -1,9 +1,11 @@ -#!/usr/bin/perl +#!/usr/bin/env perl +use v5.36; # total the hours from the main index.adoc page open my $fh, '<', './docs/index.adoc' or die "Could not open file: $!"; local $/; -my $buf = <$fh>; +my $buf = <$fh>; +my $hours_mentor = 0; map { $hours_mentor += $_ } $buf =~ /hours="(\d+)"/g; my $hours_self = $hours_mentor * 2; my $hours_total = $hours_self + $hours_mentor; @@ -33,6 +35,7 @@ qx{ asciidoctor \\ -D docs \\ -a date="$date" \\ -a toc! \\ + -a notoc=true \\ -a allow-uri-read \\ -a hours_mentor="$hours_mentor" \\ -a hours_self="$hours_self" \\ @@ -43,7 +46,7 @@ qx{ asciidoctor \\ }; my $pwd = `pwd`; -$pwd =~ s/\R$//; # chomp no longer works in modern perl +$pwd =~ s/\R$//; my ( $parent, $name ) = $pwd =~ m,/([^/]+)/([^/]+)$,m; # PDF diff --git a/scripts/preview b/scripts/preview index 4277544..ec6149c 100755 --- a/scripts/preview +++ b/scripts/preview @@ -1,13 +1,18 @@ #!/bin/sh if ! type browser-sync >/dev/null 2>&1; then - echo 'Need to install browser-sync.' - exit 1 + echo 'Need to install browser-sync.' + exit 1 fi -browser-sync start \ - --no-notify --no-ui \ - --ignore '**/.*' \ - -sw - +if test -d docs; then + cd docs || exit +fi +browser-sync start \ + --server \ + --baseDir ./ \ + --no-notify --no-ui \ + --no-open \ + --port 4000 \ + --ignore '**/.*' From 17eb8387f25d332deb353398b32f77d7faa3671d Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 12:58:45 -0500 Subject: [PATCH 09/78] add universal termcolors --- README.md | 2 +- scripts/aln | 59 --------------------------------- scripts/andthen | 3 -- scripts/anton | 2 -- scripts/ar | 2 -- scripts/asciisampler | 10 ------ scripts/back | 7 ++-- scripts/bannerfish | 45 ++++++++++++++++++++++---- scripts/bannerlights | 8 ----- scripts/bannerneo | 11 ++++--- scripts/chat | 15 --------- scripts/doris | 2 ++ scripts/md | 11 +++++-- scripts/termcolors | 77 ++++++++++++++++++-------------------------- 14 files changed, 91 insertions(+), 163 deletions(-) delete mode 100755 scripts/aln delete mode 100755 scripts/andthen delete mode 100755 scripts/anton delete mode 100755 scripts/ar delete mode 100755 scripts/asciisampler delete mode 100755 scripts/bannerlights delete mode 100755 scripts/chat create mode 100755 scripts/doris diff --git a/README.md b/README.md index 1e7a9a4..9cc0f7c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Unlike other projects, I regularly just commit to main with short commit message ## Working style -I'm an old SysAdmin, a Software Developer Engineer, an SRE, a hacker, a writer, and educator. This means that while I do have a favorite, cozy dev environment on my 14" Macbook Pro, I still want my dotfiles to work anywhere. +I'm an old SysAdmin, SysDE, SRE, black-hat, writer, and educator. This means that while I do have a favorite, cozy dev environment on my 14" Unix system with custom GUI desktop manager, I still want my dotfiles to work anywhere. It's also the reason I have my multicall binary monolith (think BusyBox) here as well. I've designed this repo to be something I can quickly clone to any system and just run [setup](setup) plus a few `install` scripts for the stuff I need to get immediately up and running. This process is so fast that I consider all the other Git clones read-only and only pull from changes made to this central repo. That way I never have a merge conflict and can use these dotfiles without fear that committing from a system that isn't one I own could give a company full ownership of the entire repo per IP policies (go watch season one of Silicon Valley). diff --git a/scripts/aln b/scripts/aln deleted file mode 100755 index 84e1455..0000000 --- a/scripts/aln +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/bash -shopt -s extglob - -# (ripped from deyloop) - -# Aligns input lines so that the occurrence of given character(s) matches up -# among the lines -# -# example: -# -# get this_variable = whatever -# get whatever= this_thing -# get this_other_thing = whatever this is -# -# becomes -# -# get this_variable = whatever -# get whatever = this_thing -# get this_other_thing = whatever this is -# -# if the alignment point is the '=' - -# ------------------------------------------------------------------------ - -_aln() { - local char i max_len - local -A lines_pre lines_post - char="$1" - max_len=0 - i=0 - - while IFS= read -r line; do - # characters preceding the alignment point - lines_pre["$i"]="${line%%$char*}" - - # Trim trailing white space - lines_pre["$i"]="${lines_pre[$i]%%*( )}" - - pre_len="${#lines_pre["$i"]}" - - if [[ $max_len < $pre_len ]]; then - max_len="$pre_len" - fi - - # characters proceeding the alignment point - lines_post["$i"]="${line#*$char}" - - i=$(( i + 1 )) - done - - max_len=$(( max_len + 1 )) - - for (( j=0; j < i; j++ )); do - printf "%-*s%s%s\n" "$max_len" "${lines_pre[$j]}" "$char" "${lines_post[$j]}" - done - -} - -_aln "$@" diff --git a/scripts/andthen b/scripts/andthen deleted file mode 100755 index 88378da..0000000 --- a/scripts/andthen +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec clip andthen diff --git a/scripts/anton b/scripts/anton deleted file mode 100755 index 32312bb..0000000 --- a/scripts/anton +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec VBoxManage.exe startvm --type headless anton diff --git a/scripts/ar b/scripts/ar deleted file mode 100755 index 9f20e0f..0000000 --- a/scripts/ar +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -exec chat "!ar $1 $2" diff --git a/scripts/asciisampler b/scripts/asciisampler deleted file mode 100755 index bddb149..0000000 --- a/scripts/asciisampler +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -exec tmux \ - splitw -h \;\ - send fishies ENTER \;\ - selectp -t 1 \;\ - splitw \;\ - send tmatrix ENTER \;\ - selectp -t 1 \;\ - send watchcow ENTER \;\ - resizep -t 2 -y 5 -x 44 diff --git a/scripts/back b/scripts/back index 771a5f9..597c2cd 100755 --- a/scripts/back +++ b/scripts/back @@ -1,10 +1,7 @@ -#!/usr/bin/env bash +#!/bin/sh what="$*" -if [[ -z "${what}" ]]; then +if test -z "$what"; then what="in a bit" -elif [[ $what =~ ^([0-9]+) ]]; then - what="at $(date -d "${BASH_REMATCH[1]} minutes" +%H:%M)" fi echo "$what" >~/.break exec bannerfish "back $what" -#exec bannerlights "back $what" diff --git a/scripts/bannerfish b/scripts/bannerfish index bfc9b9d..08915b5 100755 --- a/scripts/bannerfish +++ b/scripts/bannerfish @@ -1,9 +1,42 @@ -#!/usr/bin/env bash -what="$*" -if [ -z "${what}" ]; then - read -r -p "Text: " what +#!/usr/bin/env perl + +__END__ +WHAT="$*" +if test -z "$WHAT"; then + echo "Text: " + read -r WHAT fi -cols=$(tput lines) -tmux split-window \; resize-pane -y $((cols-6)) \; send -t 1 "banner \"$what\"" Enter + +# requires WHAT +banner() { + clear="\033[2J" + curoff="\033[?25h" + curon="\033[?25h" + top="\033[H" + + trap 'printf "$curon$clear"; exit; trap -- - SIGINT SIGTERM' TERM INT + + printf "%s" "$clear" + + while true; do + printf "%s" "$top" + echo "$WHAT" | figl | lolcat + printf "%s" "$curoff" + sleep 2 + done + +} + +script=$(basename "$0") +case "$script" in +banner) banner "$@" ;; +esac + +exit + +lines=$(tput lines) +tmux split-window +tmux resize-pane -y $((lines - 6)) +tmux send -t 1 "banner \"$what\"" Enter sleep 1 tmux send -t 2 "fishies" Enter diff --git a/scripts/bannerlights b/scripts/bannerlights deleted file mode 100755 index a425f74..0000000 --- a/scripts/bannerlights +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -what="$*" -if [ -z "${what}" ]; then - read -p "Text: " what -fi -cols=$(tput lines) -pomo stop -tmux split-window \; resize-pane -y $((cols-6)) \; send -t 1 "banner \"$what\"" Enter \; send -t 2 "pylights" Enter diff --git a/scripts/bannerneo b/scripts/bannerneo index 18cdbea..1dc798a 100755 --- a/scripts/bannerneo +++ b/scripts/bannerneo @@ -1,8 +1,11 @@ -#!/usr/bin/env bash +#!/bin/sh what="$*" if [ -z "${what}" ]; then - read -p "Text: " what + echo "Text: " + read -r what fi lines=$(tput lines) -pomo stop -tmux split-window \; resize-pane -y $((lines-6)) \; send -t 1 "banner \"$what\"" Enter \; send -t 2 "neo" Enter +if type pomo 2>/dev/null; then + pomo stop +fi +tmux split-window \; resize-pane -y $((lines - 6)) \; send -t 1 "banner \"$what\"" Enter \; sleep 1 \; send -t 2 "neo" Enter diff --git a/scripts/chat b/scripts/chat deleted file mode 100755 index 960a3e2..0000000 --- a/scripts/chat +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -buf="$*" - -if test -n "$buf"; then - #echo "*$buf" >$WEECHAT_FIFO - tmux -L live send -t 2 "$buf" Enter - exit -fi - -IFS= -while read -r line; do - #echo "*$line" >$WEECHAT_FIFO - tmux -L live send -t 2 "$line" Enter -done diff --git a/scripts/doris b/scripts/doris new file mode 100755 index 0000000..393687f --- /dev/null +++ b/scripts/doris @@ -0,0 +1,2 @@ +#!/bin/sh +exec wee <<< '!doris' diff --git a/scripts/md b/scripts/md index 8fb02d7..c8a8c9e 100755 --- a/scripts/md +++ b/scripts/md @@ -1,4 +1,9 @@ #!/bin/sh - -test -z "$@" && test -f ./README.md && exec glow -p ./README.md -exec glow -p "$@" +test -z "$@" && test -f ./README.md && file=./README.md +if ! type pandoc >/dev/null; then + echo "pandoc required" + exit 1 +fi +tmpfile=$(mktemp).html +pandoc "$file" >"$tmpfile" +exec lynx "$tmpfile" diff --git a/scripts/termcolors b/scripts/termcolors index 8dde36c..05354b0 100755 --- a/scripts/termcolors +++ b/scripts/termcolors @@ -9,49 +9,36 @@ # instead and don't forget to wrap them within ${}. Omits (and overrides # any inherited) colors when not interactive/piped. -black="" -red="" -green="" -yellow="" -blue="" -magenta="" -cyan="" -white="" -blink="" -reset="" +case "$1" in -if test -t 1; then - black="\e[30m" - red="\e[31m" - green="\e[32m" - yellow="\e[33m" - blue="\e[34m" - magenta="\e[35m" - cyan="\e[36m" - white="\e[37m" - blink="\e[5m" - reset="\e[0m" -fi -echo POSIX -printf "${black}black=\"\\\e[30m\" -${red}red=\"\\\e[31m\" -${green}green=\"\\\e[32m\" -${yellow}yellow=\"\\\e[33m\" -${blue}blue=\"\\\e[34m\" -${magenta}magenta=\"\\\e[35m\" -${cyan}cyan=\"\\\e[36m\" -${white}white=\"\\\e[37m\" -reset=\"\\\e[0m\" -" -echo -echo BASH: -printf "${black}black=$'\\\e[30m' -${red}red=$'\\\e[31m' -${green}green=$'\\\e[32m' -${yellow}yellow=$'\\\e[33m' -${blue}blue=$'\\\e[34m' -${magenta}magenta=$'\\\e[35m' -${cyan}cyan=$'\\\e[36m' -${white}white=$'\\\e[37m' -reset=$'\\\e[0m' -" +shell) + cat < Date: Sat, 4 Jan 2025 13:08:45 -0500 Subject: [PATCH 10/78] add other terminal stuff to termcolors --- scripts/bannerfish | 29 ++++++++++++++++++++--------- scripts/termcolors | 30 +++++++++++++++++++----------- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/scripts/bannerfish b/scripts/bannerfish index 08915b5..3ae9b10 100755 --- a/scripts/bannerfish +++ b/scripts/bannerfish @@ -1,18 +1,29 @@ #!/usr/bin/env perl +use v5.36; + +my $black = ""; +my $red = ""; +my $green = ""; +my $yellow = ""; +my $blue = ""; +my $magenta = ""; +my $cyan = ""; +my $white = ""; +my $blink = ""; +my $reset = ""; + +my $what = join ' ', @ARGV; + +if ( not $what ) { + print "Text: "; + $what = ; + chomp $what; +} __END__ -WHAT="$*" -if test -z "$WHAT"; then - echo "Text: " - read -r WHAT -fi # requires WHAT banner() { - clear="\033[2J" - curoff="\033[?25h" - curon="\033[?25h" - top="\033[H" trap 'printf "$curon$clear"; exit; trap -- - SIGINT SIGTERM' TERM INT diff --git a/scripts/termcolors b/scripts/termcolors index 05354b0..06ec0c2 100755 --- a/scripts/termcolors +++ b/scripts/termcolors @@ -23,21 +23,29 @@ cyan="" white="" blink="" reset="" +clear="" +curoff="[?25h" +curon="[?25h" +top="" EOM ;; perl) - cat < Date: Sat, 4 Jan 2025 13:20:44 -0500 Subject: [PATCH 11/78] fix what to be posix --- scripts/bannerfish | 4 ++++ scripts/what | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/bannerfish b/scripts/bannerfish index 3ae9b10..2b3f7d9 100755 --- a/scripts/bannerfish +++ b/scripts/bannerfish @@ -11,6 +11,10 @@ my $cyan = ""; my $white = ""; my $blink = ""; my $reset = ""; +my $clear = ""; +my $curoff = "[?25h"; +my $curon = "[?25h"; +my $top = ""; my $what = join ' ', @ARGV; diff --git a/scripts/what b/scripts/what index 32f56c0..854b6e6 100755 --- a/scripts/what +++ b/scripts/what @@ -1,2 +1,2 @@ -#!/bin/bash -wee < <(head -1 ~/.currently) +#!/bin/sh +head -1 ~/.currently | wee From df285cb47aa04223a2fd5c5fb832ed5f4d4c1072 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 13:39:53 -0500 Subject: [PATCH 12/78] add faq command --- scripts/bannerfish | 51 ++++++++++++++++------------------------------ scripts/faq | 2 ++ 2 files changed, 20 insertions(+), 33 deletions(-) create mode 100755 scripts/faq diff --git a/scripts/bannerfish b/scripts/bannerfish index 2b3f7d9..dc9f660 100755 --- a/scripts/bannerfish +++ b/scripts/bannerfish @@ -1,20 +1,12 @@ #!/usr/bin/env perl use v5.36; -my $black = ""; -my $red = ""; -my $green = ""; -my $yellow = ""; -my $blue = ""; -my $magenta = ""; -my $cyan = ""; -my $white = ""; -my $blink = ""; -my $reset = ""; -my $clear = ""; -my $curoff = "[?25h"; -my $curon = "[?25h"; -my $top = ""; +# TODO check for figl and lolcat deps + +my $clear = ""; +my $curoff = "[?25h"; +my $curon = "[?25h"; +my $top = ""; my $what = join ' ', @ARGV; @@ -24,30 +16,23 @@ if ( not $what ) { chomp $what; } -__END__ - -# requires WHAT -banner() { - - trap 'printf "$curon$clear"; exit; trap -- - SIGINT SIGTERM' TERM INT - - printf "%s" "$clear" +sub cleanup { + print "$curon$clear"; + exit 0; +} - while true; do - printf "%s" "$top" - echo "$WHAT" | figl | lolcat - printf "%s" "$curoff" - sleep 2 - done +$SIG{'INT'} = \&cleanup; +$SIG{'TERM'} = \&cleanup; +print $clear; +while (1) { + print $top.$curoff; + print `echo "BLAH" | figl | lolcat -f`; + sleep 2; } -script=$(basename "$0") -case "$script" in -banner) banner "$@" ;; -esac +__END__ -exit lines=$(tput lines) tmux split-window diff --git a/scripts/faq b/scripts/faq new file mode 100755 index 0000000..f90bc9e --- /dev/null +++ b/scripts/faq @@ -0,0 +1,2 @@ +#!/bin/sh +echo '!faq' | wee From bb31f22d74a7ad97650508dafdc71780ed3eee71 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 13:51:10 -0500 Subject: [PATCH 13/78] fix curoff in termcolors --- scripts/bannerfish | 7 +++---- scripts/termcolors | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/bannerfish b/scripts/bannerfish index dc9f660..241686c 100755 --- a/scripts/bannerfish +++ b/scripts/bannerfish @@ -4,7 +4,7 @@ use v5.36; # TODO check for figl and lolcat deps my $clear = ""; -my $curoff = "[?25h"; +my $curoff = "[?25l"; my $curon = "[?25h"; my $top = ""; @@ -24,10 +24,9 @@ sub cleanup { $SIG{'INT'} = \&cleanup; $SIG{'TERM'} = \&cleanup; -print $clear; +print $clear. $curoff; while (1) { - print $top.$curoff; - print `echo "BLAH" | figl | lolcat -f`; + print $top. `echo "BLAH" | figl | lolcat -f`; sleep 2; } diff --git a/scripts/termcolors b/scripts/termcolors index 06ec0c2..3b7b3b8 100755 --- a/scripts/termcolors +++ b/scripts/termcolors @@ -43,7 +43,7 @@ my $white=""; my $blink=""; my $reset=""; my $clear=""; -my $curoff="[?25h"; +my $curoff="[?25l"; my $curon="[?25h"; my $top=""; EOM From e5c09f8f63586396c82fc2ab463d01b1dfcd23f3 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 15:58:58 -0500 Subject: [PATCH 14/78] describe underlying posix shell dep in my perl code --- README.md | 3 +++ config/gla | 1 + config/glam | 1 + scripts/bannerfish | 20 ++++++++------------ scripts/bannerneo | 3 +++ 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 config/gla create mode 100644 config/glam diff --git a/README.md b/README.md index 9cc0f7c..228e4b0 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,6 @@ Check out my [FAQ](https://github.com/rwxrob/faq) for answers about my preferenc For other dependencies see the scripts that begin with `install` and `config`. +## Perl shell dependency + +The Perl scripts assume a POSIX Unix shell underneath and regularly use backtick pipelines and commands and shell builtins such as `which`, `type`, and `command`. Perl is just far better than Bash for everything that requires more than POSIX shellβ€”especially when it involves text processing or math in any way. diff --git a/config/gla b/config/gla new file mode 100644 index 0000000..16f4102 --- /dev/null +++ b/config/gla @@ -0,0 +1 @@ +:0 diff --git a/config/glam b/config/glam new file mode 100644 index 0000000..16f4102 --- /dev/null +++ b/config/glam @@ -0,0 +1 @@ +:0 diff --git a/scripts/bannerfish b/scripts/bannerfish index 241686c..8a6ad7f 100755 --- a/scripts/bannerfish +++ b/scripts/bannerfish @@ -1,12 +1,18 @@ #!/usr/bin/env perl use v5.36; +use File::Basename; # TODO check for figl and lolcat deps +not `command -v figl` and say 'figl not found' and exit 1; + +__END__ + my $clear = ""; my $curoff = "[?25l"; my $curon = "[?25h"; my $top = ""; +my $lines = `tput lines` - 6; my $what = join ' ', @ARGV; @@ -26,16 +32,6 @@ $SIG{'TERM'} = \&cleanup; print $clear. $curoff; while (1) { - print $top. `echo "BLAH" | figl | lolcat -f`; - sleep 2; + print $top. `echo "$what" | figl | lolcat -f`; + sleep 1; } - -__END__ - - -lines=$(tput lines) -tmux split-window -tmux resize-pane -y $((lines - 6)) -tmux send -t 1 "banner \"$what\"" Enter -sleep 1 -tmux send -t 2 "fishies" Enter diff --git a/scripts/bannerneo b/scripts/bannerneo index 1dc798a..a9102d3 100755 --- a/scripts/bannerneo +++ b/scripts/bannerneo @@ -1,4 +1,7 @@ #!/bin/sh +#my $script = basename($0); +#my ($proggy) = $script =~ /^banner(\S+)/; + what="$*" if [ -z "${what}" ]; then echo "Text: " From 76d062aa161235ad355a93a49bd00aa529ddde86 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 17:57:36 -0500 Subject: [PATCH 15/78] lights ported to perl with fork --- scripts/back | 2 +- scripts/banner | 46 +++++++++++++++++++++++++++++----------------- scripts/bannerfish | 37 ------------------------------------- scripts/bannerneo | 9 +++++---- scripts/hidecursor | 5 ----- scripts/lights | 29 +++++++++++++++++++++++++++++ scripts/pylights | 5 ----- 7 files changed, 64 insertions(+), 69 deletions(-) delete mode 100755 scripts/bannerfish delete mode 100755 scripts/hidecursor create mode 100755 scripts/lights delete mode 100755 scripts/pylights diff --git a/scripts/back b/scripts/back index 597c2cd..13be5aa 100755 --- a/scripts/back +++ b/scripts/back @@ -4,4 +4,4 @@ if test -z "$what"; then what="in a bit" fi echo "$what" >~/.break -exec bannerfish "back $what" +exec bannerneo "back $what" diff --git a/scripts/banner b/scripts/banner index 8837e18..a281d0a 100755 --- a/scripts/banner +++ b/scripts/banner @@ -1,21 +1,33 @@ -#!/usr/bin/env bash +#!/usr/bin/env perl +use v5.36; +use File::Basename; -clear=$'\033[2J' -curoff=$'\033[?25h' -curon=$'\033[?25h' -top=$'\033[H' +not `command -v figl` and say 'figl not found' and exit 1; +not `command -v lolcat` and say 'lolcat not found' and exit 1; -trap 'echo "${curon}"; echo "${clear}"; exit; trap -- - SIGINT SIGTERM' SIGTERM SIGINT +my $clear = ""; +my $curoff = "[?25l"; +my $curon = "[?25h"; +my $top = ""; +my $lines = `tput lines` - 6; -what="$*" -if [ -z "${what}" ]; then - read -rp "Text: " what -fi +my $what = join ' ', @ARGV; -echo "${clear}" -while true; do - echo "${top}" - figl <<<"$what" | lolcat - echo "${curoff}" - sleep 2 -done +if ( not $what ) { + print "Text: "; + $what = ; + chomp $what; +} + +sub cleanup { + print "$curon$clear"; + exit 0; +} +$SIG{'INT'} = \&cleanup; +$SIG{'TERM'} = \&cleanup; + +print $clear. $curoff; +while (1) { + print $top. `echo "$what" | figl | lolcat -f`; + sleep 1; +} diff --git a/scripts/bannerfish b/scripts/bannerfish deleted file mode 100755 index 8a6ad7f..0000000 --- a/scripts/bannerfish +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env perl -use v5.36; -use File::Basename; - -# TODO check for figl and lolcat deps - -not `command -v figl` and say 'figl not found' and exit 1; - -__END__ - -my $clear = ""; -my $curoff = "[?25l"; -my $curon = "[?25h"; -my $top = ""; -my $lines = `tput lines` - 6; - -my $what = join ' ', @ARGV; - -if ( not $what ) { - print "Text: "; - $what = ; - chomp $what; -} - -sub cleanup { - print "$curon$clear"; - exit 0; -} - -$SIG{'INT'} = \&cleanup; -$SIG{'TERM'} = \&cleanup; - -print $clear. $curoff; -while (1) { - print $top. `echo "$what" | figl | lolcat -f`; - sleep 1; -} diff --git a/scripts/bannerneo b/scripts/bannerneo index a9102d3..68ec593 100755 --- a/scripts/bannerneo +++ b/scripts/bannerneo @@ -8,7 +8,8 @@ if [ -z "${what}" ]; then read -r what fi lines=$(tput lines) -if type pomo 2>/dev/null; then - pomo stop -fi -tmux split-window \; resize-pane -y $((lines - 6)) \; send -t 1 "banner \"$what\"" Enter \; sleep 1 \; send -t 2 "neo" Enter +tmux split-window +tmux resize-pane -y $((lines - 6)) +tmux send -t 1 "banner \"$what\"" Enter +sleep 1 +tmux send -t 2 "neo" Enter diff --git a/scripts/hidecursor b/scripts/hidecursor deleted file mode 100755 index 847b43c..0000000 --- a/scripts/hidecursor +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -if type setterm >/dev/null 2>&1; then - exec setterm --cursor off -fi diff --git a/scripts/lights b/scripts/lights new file mode 100755 index 0000000..c161597 --- /dev/null +++ b/scripts/lights @@ -0,0 +1,29 @@ +#!/usr/bin/env perl + +my $clear = ""; +my $curoff = "[?25l"; +my $curon = "[?25h"; + +sub cleanup { + print "$curon$clear"; + exit 0; +} +$SIG{'INT'} = \&cleanup; +$SIG{'TERM'} = \&cleanup; + +print $curoff; + +my $pid = fork(); +if ( !defined $pid ) { + die "Failed to fork: $!"; +} + +if ( $pid == 0 ) { + exec 'python3', "$ENV{REPOS}/github.com/skilstak/pyfun/lib/pylights.py" + or die "Failed to exec pylights"; +} +else { + waitpid( $pid, 0 ); + print $curon; +} + diff --git a/scripts/pylights b/scripts/pylights deleted file mode 100755 index 3171fb6..0000000 --- a/scripts/pylights +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -hidecursor -trap "setterm --cursor on; clear; exit; trap -- - SIGINT SIGTERM" SIGTERM SIGINT -python3 "$REPOS"/github.com/skilstak/pyfun/lib/pylights.py - From d734c0825e30b81828e1e68ed4ef50a540aca7d5 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 19:36:52 -0500 Subject: [PATCH 16/78] take out some lines --- scripts/allfigl | 2 ++ scripts/liveicon | 8 ++------ scripts/muted | 2 +- scripts/pre | 3 +-- scripts/recording | 2 +- scripts/wee | 12 +++--------- scripts/what | 2 +- 7 files changed, 11 insertions(+), 20 deletions(-) diff --git a/scripts/allfigl b/scripts/allfigl index cf1a687..8f7f076 100755 --- a/scripts/allfigl +++ b/scripts/allfigl @@ -1,6 +1,8 @@ #!/bin/sh +# shellcheck disable=SC2059 fontsd="$REPOS/github.com/rwxrob/fonts/figlet" for font in "$fontsd"/*.flf; do echo "FONT: $font" + printf "$(rand-color)" figlet -d "$fontsd" -f "${font}" hello done diff --git a/scripts/liveicon b/scripts/liveicon index b8ad547..0d0f977 100755 --- a/scripts/liveicon +++ b/scripts/liveicon @@ -1,11 +1,7 @@ #!/bin/sh - sec=$(date +%s) - -test -e ~/.state/muted && echo "πŸ”‡" && exit - -! test -e ~/.state/recording && exit - +test -e "$HOME/.state/muted" && echo "πŸ”‡" && exit +! test -e "$HOME/.state/recording" && exit if [ $((sec % 2)) -eq 0 ]; then echo πŸŸ₯ else diff --git a/scripts/muted b/scripts/muted index a242f48..6843464 100755 --- a/scripts/muted +++ b/scripts/muted @@ -1,5 +1,5 @@ #!/bin/sh -file=~/.state/muted +file="$HOME/.state/muted" if test -e "$file"; then rm "$file" else diff --git a/scripts/pre b/scripts/pre index 48889ba..c835e30 100755 --- a/scripts/pre +++ b/scripts/pre @@ -1,5 +1,4 @@ -#!/usr/bin/env bash - +#!/bin/sh while IFS= read -r line; do echo "${1:-#} $line" done diff --git a/scripts/recording b/scripts/recording index 5d4b399..f84efb0 100755 --- a/scripts/recording +++ b/scripts/recording @@ -1,5 +1,5 @@ #!/bin/sh -file=~/.state/recording +file="$HOME/.state/recording" if test -e "$file"; then rm "$file" else diff --git a/scripts/wee b/scripts/wee index 02e35d9..914b3db 100755 --- a/scripts/wee +++ b/scripts/wee @@ -1,15 +1,9 @@ #!/bin/sh - buf="$*" - if test -n "$buf"; then - echo "*$buf" | toemoji >~/.weechat/fifo - #tmux -L live send -t 2 "$buf" Enter + echo "*$buf" | toemoji >"$HOME/.weechat/fifo" exit fi - -IFS= -while read -r line; do - echo "*$line" | toemoji >~/.weechat/fifo - #tmux -L live send -t 2 "$line" Enter +while IFS= read -r line; do + echo "*$line" | toemoji >"$HOME/.weechat/fifo" done diff --git a/scripts/what b/scripts/what index 854b6e6..3844cd6 100755 --- a/scripts/what +++ b/scripts/what @@ -1,2 +1,2 @@ #!/bin/sh -head -1 ~/.currently | wee +head -1 "$HOME/.currently" | wee From 9b573f2f8ea6a7c9050391c1f2719089d7867a38 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sat, 4 Jan 2025 21:02:27 -0500 Subject: [PATCH 17/78] convert allfigl to perl --- .bashrc | 15 +++++++++++++++ scripts/allfigl | 36 ++++++++++++++++++++++++++++-------- scripts/randcol | 4 ++++ 3 files changed, 47 insertions(+), 8 deletions(-) create mode 100755 scripts/randcol diff --git a/.bashrc b/.bashrc index 2538022..d2a97c4 100644 --- a/.bashrc +++ b/.bashrc @@ -6,6 +6,21 @@ case $- in *) return ;; esac +export black="" +export red="" +export green="" +export yellow="" +export blue="" +export magenta="" +export cyan="" +export white="" +export blink="" +export reset="" +export clear="" +export curoff="[?25h" +export curon="[?25h" +export top="" + # ---------------------- local utility functions --------------------- _have() { type "$1" &>/dev/null; } diff --git a/scripts/allfigl b/scripts/allfigl index 8f7f076..8038bfa 100755 --- a/scripts/allfigl +++ b/scripts/allfigl @@ -1,8 +1,28 @@ -#!/bin/sh -# shellcheck disable=SC2059 -fontsd="$REPOS/github.com/rwxrob/fonts/figlet" -for font in "$fontsd"/*.flf; do - echo "FONT: $font" - printf "$(rand-color)" - figlet -d "$fontsd" -f "${font}" hello -done +#!/usr/bin/env perl +use v5.12; +use File::Basename; +use Time::HiRes qw(sleep); + +my $reset = ""; +my $clear = ""; +my $curon = "[?25h"; +my $curoff = "[?25l"; +my $top = ""; +my $fontsd = "$ENV{REPOS}/github.com/rwxrob/fonts/figlet"; +my $delay = $ARGV[0] || 1; + +sub cleanup { + print "$curon$clear$top"; + exit 0; +} +$SIG{'INT'} = \&cleanup; +$SIG{'TERM'} = \&cleanup; + +print $curoff; + +for my $font ( glob("$fontsd/*.flf") ) { + print "$clear$top" . `randcol`; + my ($name) = $font =~ m,([^/]+)\.[^.]+$,; + say "$name\n\n" . `figlet -d "$fontsd" -f "$font" "hello"`; + sleep $delay; +} diff --git a/scripts/randcol b/scripts/randcol new file mode 100755 index 0000000..65fedd2 --- /dev/null +++ b/scripts/randcol @@ -0,0 +1,4 @@ +#!/usr/bin/env perl +my @colors = qw{         }; +print $colors[ int( rand(8) ) ]; + From 346b52f9b0790fe35ee09c986320e02d7cc8ce2b Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sun, 5 Jan 2025 18:10:36 -0500 Subject: [PATCH 18/78] migrate bannerneo to perl --- .bashrc | 3 ++- .wezterm.lua | 6 +++--- scripts/banner | 2 -- scripts/bannerneo | 38 +++++++++++++++++++++++--------------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.bashrc b/.bashrc index d2a97c4..f5dbdf9 100644 --- a/.bashrc +++ b/.bashrc @@ -62,6 +62,7 @@ export CGO_ENABLED=0 export PYTHONDONTWRITEBYTECODE=2 export LC_COLLATE=C export CFLAGS="-Wall -Wextra -Werror -O0 -g -fsanitize=address -fno-omit-frame-pointer -finstrument-functions" +export BAT_THEME=gruvbox-dark # gruvbox-material export LS_COLORS="di=38;5;245:fi=38;5;223:ln=38;5;179:ex=38;5;108:*.txt=38;5;223" @@ -271,7 +272,7 @@ alias clear='printf "\e[H\e[2J"' alias c='printf "\e[H\e[2J"' alias env='env -u LESS_TERMCAP_mb -u LESS_TERMCAP_md -u LESS_TERMCAP_me -u LESS_TERMCAP_so -u LESS_TERMCAP_se -u LESS_TERMCAP_us -u LESS_TERMCAP_ue' alias neo="neo -D -c gold" -alias more="less" +alias more="less -R" alias gitl="git log -n 5 --graph --decorate --oneline" alias gp="git push" alias gptags="git push origin --tags" diff --git a/.wezterm.lua b/.wezterm.lua index 6207988..2f73a16 100644 --- a/.wezterm.lua +++ b/.wezterm.lua @@ -4,7 +4,7 @@ return { default_prog = {'/opt/homebrew/bin/bash','--login'}, color_scheme = 'Gruvbox Material (Gogh)', font = wezterm.font('UbuntuMono Nerd Font'), - font_size = 34, + font_size = 28, colors = { cursor_bg = '#928374', cursor_border = '#928374', @@ -13,9 +13,9 @@ return { window_decorations = "RESIZE", hide_tab_bar_if_only_one_tab = true, window_padding = { - left = 40, + left = 10, right = 0, - top = 50, + top = 20, bottom = 0, }, } diff --git a/scripts/banner b/scripts/banner index a281d0a..fafe693 100755 --- a/scripts/banner +++ b/scripts/banner @@ -9,10 +9,8 @@ my $clear = ""; my $curoff = "[?25l"; my $curon = "[?25h"; my $top = ""; -my $lines = `tput lines` - 6; my $what = join ' ', @ARGV; - if ( not $what ) { print "Text: "; $what = ; diff --git a/scripts/bannerneo b/scripts/bannerneo index 68ec593..0307a35 100755 --- a/scripts/bannerneo +++ b/scripts/bannerneo @@ -1,15 +1,23 @@ -#!/bin/sh -#my $script = basename($0); -#my ($proggy) = $script =~ /^banner(\S+)/; - -what="$*" -if [ -z "${what}" ]; then - echo "Text: " - read -r what -fi -lines=$(tput lines) -tmux split-window -tmux resize-pane -y $((lines - 6)) -tmux send -t 1 "banner \"$what\"" Enter -sleep 1 -tmux send -t 2 "neo" Enter +#!/usr/bin/env perl +use v5.36; +use File::Basename; + +my $script = basename($0); +my ($proggy) = $script =~ /^banner(\S+)/; +my $lines = `tput lines` - 6; + +not `command -v $proggy` and say "$proggy not found" and exit 1; +not `command -v lolcat` and say 'lolcat not found' and exit 1; + +my $what = join ' ', @ARGV; +if ( not $what ) { + print "Text: "; + $what = ; + chomp $what; +} + +`tmux split-window`; +`tmux resize-pane -y $lines`; +`tmux send -t 1 "banner \"$what\"" Enter`; +sleep 1; +`tmux send -t 2 "$proggy" Enter` From 72a2474a5345615a57f73c04015995f97946fd2e Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sun, 5 Jan 2025 20:01:39 -0500 Subject: [PATCH 19/78] add emoji eyes to my cow --- config/cowsay/default.cow | 7 ++++++ config/gla | 1 - config/glam | 1 - scripts/allcow | 43 ++++++++++++++++++++++++++++++++++ scripts/bannerfishies | 1 + scripts/bannerlights | 1 + scripts/bannerneo | 2 +- scripts/bannerwatchcow | 1 + scripts/indent | 5 ++++ scripts/watchcow | 49 +++++++++++++++++++++++++++++++-------- 10 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 config/cowsay/default.cow delete mode 100644 config/gla delete mode 100644 config/glam create mode 100755 scripts/allcow create mode 120000 scripts/bannerfishies create mode 120000 scripts/bannerlights create mode 120000 scripts/bannerwatchcow create mode 100755 scripts/indent diff --git a/config/cowsay/default.cow b/config/cowsay/default.cow new file mode 100644 index 0000000..ad66076 --- /dev/null +++ b/config/cowsay/default.cow @@ -0,0 +1,7 @@ +$the_cow = <<"EOC"; + $thoughts ^__^ + $thoughts πŸ‘οΈπŸ‘οΈ\\_______ + (__)\\ )\\/\\ + $tongue ||----w | + || || +EOC diff --git a/config/gla b/config/gla deleted file mode 100644 index 16f4102..0000000 --- a/config/gla +++ /dev/null @@ -1 +0,0 @@ -:0 diff --git a/config/glam b/config/glam deleted file mode 100644 index 16f4102..0000000 --- a/config/glam +++ /dev/null @@ -1 +0,0 @@ -:0 diff --git a/scripts/allcow b/scripts/allcow new file mode 100755 index 0000000..a8df27d --- /dev/null +++ b/scripts/allcow @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +use v5.12; +use File::Basename; +use Time::HiRes qw(sleep); + +my $reset = ""; +my $clear = ""; +my $curon = "[?25h"; +my $curoff = "[?25l"; +my $top = ""; +my $fontsd = "$ENV{REPOS}/github.com/rwxrob/fonts/figlet"; +my $cowdir = "/opt/homebrew/Cellar/cowsay/3.8.4/share/cowsay/cows"; + +my $delay = $ARGV[0] || 1; + +sub cleanup { + print "$curon$clear$top"; + exit 0; +} +$SIG{'INT'} = \&cleanup; +$SIG{'TERM'} = \&cleanup; + +print $curoff; + +for my $cow ( glob("$cowdir/*.cow") ) { + print "$clear$top"; + my ($name) = $cow =~ m,([^/]+)\.[^.]+$,; + my $pid = fork(); + if ( !defined $pid ) { + die "Failed to fork: $!"; + } + if ( $pid == 0 ) { + exec "cowsay -f $cow hello | lolcat" + or die "Failed to exec cowsay"; + } + else { + waitpid( $pid, 0 ); + say `randcol`."\n$name"; + print $curon; + } + sleep $delay; +} + diff --git a/scripts/bannerfishies b/scripts/bannerfishies new file mode 120000 index 0000000..ee1f35a --- /dev/null +++ b/scripts/bannerfishies @@ -0,0 +1 @@ +bannerneo \ No newline at end of file diff --git a/scripts/bannerlights b/scripts/bannerlights new file mode 120000 index 0000000..ee1f35a --- /dev/null +++ b/scripts/bannerlights @@ -0,0 +1 @@ +bannerneo \ No newline at end of file diff --git a/scripts/bannerneo b/scripts/bannerneo index 0307a35..1c1800b 100755 --- a/scripts/bannerneo +++ b/scripts/bannerneo @@ -18,6 +18,6 @@ if ( not $what ) { `tmux split-window`; `tmux resize-pane -y $lines`; -`tmux send -t 1 "banner \"$what\"" Enter`; +`tmux send -t 1 "banner $what" Enter`; sleep 1; `tmux send -t 2 "$proggy" Enter` diff --git a/scripts/bannerwatchcow b/scripts/bannerwatchcow new file mode 120000 index 0000000..ee1f35a --- /dev/null +++ b/scripts/bannerwatchcow @@ -0,0 +1 @@ +bannerneo \ No newline at end of file diff --git a/scripts/indent b/scripts/indent new file mode 100755 index 0000000..f69d1e7 --- /dev/null +++ b/scripts/indent @@ -0,0 +1,5 @@ +#!/bin/sh +while IFS= read -r line; do + printf "%*s" "$1" "" + echo "$line" +done diff --git a/scripts/watchcow b/scripts/watchcow index 9df1df2..8f13d6e 100755 --- a/scripts/watchcow +++ b/scripts/watchcow @@ -1,10 +1,39 @@ -#!/bin/sh - -hidecursor -while true; do - clear - echo - #fortune -s | cowsay -f dragon |lolcat - fortune -s | cowsay |lolcat - sleep 10 -done +#!/usr/bin/env perl +use v5.36; +use File::Basename; + +not `command -v cowsay` and say 'cowsay not found' and exit 1; +not `command -v lolcat` and say 'lolcat not found' and exit 1; +not `command -v fortune` and say 'fortune not found' and exit 1; + +my $clear = ""; +my $curoff = "[?25l"; +my $curon = "[?25h"; +my $top = ""; + +sub cleanup { + print "$curon$clear"; + exit 0; +} +$SIG{'INT'} = \&cleanup; +$SIG{'TERM'} = \&cleanup; + +print $clear . $curoff; + +while (1) { + my $pid = fork(); + if ( !defined $pid ) { + die "Failed to fork: $!"; + } + if ( $pid == 0 ) { + print $curoff. $clear . $top; + exec +"fortune -s | cowsay -W 50 -f '$ENV{REPOS}/github.com/rwxrob/dot/config/cowsay/default.cow' | indent 15 | lolcat -ft | cat" + or die "Failed to exec cowsay"; + } + else { + waitpid( $pid, 0 ); + sleep 10; + } +} + From 7ad838721f2affa2e06a62de508d5e0a3bf8058c Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sun, 5 Jan 2025 20:19:57 -0500 Subject: [PATCH 20/78] truncate weechat names to 10 characters --- scripts/ban | 16 ---------- scripts/bashentrtest | 2 -- scripts/bashmatrix | 70 -------------------------------------------- scripts/battery | 6 ++-- weechat/setup | 1 + 5 files changed, 5 insertions(+), 90 deletions(-) delete mode 100755 scripts/ban delete mode 100755 scripts/bashentrtest delete mode 100755 scripts/bashmatrix diff --git a/scripts/ban b/scripts/ban deleted file mode 100755 index 2b4a6c7..0000000 --- a/scripts/ban +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Uses Weechat to ban a target on Twitch. - -if [ -z "$TWITCH_USER" ]; then - echo '$TWITCH_USER environment variable not set.' - exit 1 -fi - -if [ -z "$1" -o -z "$2" ]; then - echo 'usage: ban ' - exit 1 -fi - -wee "/msg $TWITCH_USER /ban $1 $2" - diff --git a/scripts/bashentrtest b/scripts/bashentrtest deleted file mode 100755 index 2c40295..0000000 --- a/scripts/bashentrtest +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -entr bash -c "clear; shellcheck $1" <<< "$1" diff --git a/scripts/bashmatrix b/scripts/bashmatrix deleted file mode 100755 index 9f3a271..0000000 --- a/scripts/bashmatrix +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash - -# Courtesy of @bvierra and company (long ago, pre-cPanel) - -### Customization: -blue="\033[0;34m" -brightblue="\033[1;34m" -cyan="\033[0;36m" -brightcyan="\033[1;36m" -green="\033[0;32m" -brightgreen="\033[1;32m" -red="\033[0;31m" -brightred="\033[1;31m" -white="\033[1;37m" -black="\033[0;30m" -grey="\033[0;37m" -darkgrey="\033[1;30m" -# Choose the colors that will be used from the above list -# space-separated list -# e.g. `colors=($green $brightgreen $darkgrey $white)` -colors=($green $brightgreen) -### End customization - -### Do not edit below this line -spacing=${1:-100} # the likelihood of a character being left in place -scroll=${2:-0} # 0 for static, positive integer determines scroll speed -screenlines=$(expr `tput lines` - 1 + $scroll) -screencols=$(expr `tput cols` / 2 - 1) - -# chars=(a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ^) -# charset via Carl: -chars=(ο½± ο½² ο½³ エ 。 ο½Ά ο½· ο½Έ ο½Ή ο½Ί ο½» ο½Ό ο½½ ο½Ύ ο½Ώ οΎ€ チ οΎ‚ οΎƒ οΎ„ οΎ… οΎ† οΎ‡ ネ οΎ‰ ハ οΎ‹ フ ヘ ホ マ ミ οΎ‘ οΎ’ οΎ“ οΎ” οΎ• οΎ– οΎ— リ οΎ™ レ οΎ› ワ ン) - -count=${#chars[@]} -colorcount=${#colors[@]} - -trap "tput sgr0; clear; exit" SIGTERM SIGINT - -if [[ $1 =~ '-h' ]]; then - echo "Display a Matrix(ish) screen in the terminal" - echo "Usage: matrix [SPACING [SCROLL]]" - echo "Example: matrix 100 0" - exit 0 -fi - - -clear -tput cup 0 0 -while : - do for i in $(eval echo {1..$screenlines}) - do for i in $(eval echo {1..$screencols}) - do rand=$(($RANDOM%$spacing)) - case $rand in - 0) - printf "${colors[$RANDOM%$colorcount]}${chars[$RANDOM%$count]} " - ;; - 1) - printf " " - ;; - *) - printf "\033[2C" - ;; - esac - done - printf "\n" - - # sleep .005 - done - tput cup 0 0 - done \ No newline at end of file diff --git a/scripts/battery b/scripts/battery index aaa66a7..f776a41 100755 --- a/scripts/battery +++ b/scripts/battery @@ -1,3 +1,5 @@ -#!/usr/bin/perl -print grep {/state|to\ full|percentage/} +#!/usr/bin/env perl +use v5.36; + +print grep { /state|to\ full|percentage/ } `upower -i /org/freedesktop/UPower/devices/battery_BAT0`; diff --git a/weechat/setup b/weechat/setup index 511890c..1dd71d3 100755 --- a/weechat/setup +++ b/weechat/setup @@ -35,6 +35,7 @@ cat <"$fifo" */set weechat.look.prefix_join "πŸ‘‹" */set weechat.look.prefix_action "🌟" */set weechat.look.prefix_error "πŸ’’" +*/set weechat.look.prefix_align_max 10 */set weechat.bar.input_items ",input_text" */bar hide buflist */bar hide status From 3880783d8c2fc3ab735fded183c6306ed656e287 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sun, 5 Jan 2025 20:56:19 -0500 Subject: [PATCH 21/78] add linux and mac battery script in perl --- scripts/battery | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/battery b/scripts/battery index f776a41..007cf90 100755 --- a/scripts/battery +++ b/scripts/battery @@ -1,5 +1,28 @@ #!/usr/bin/env perl use v5.36; +my $os = $^O; -print grep { /state|to\ full|percentage/ } - `upower -i /org/freedesktop/UPower/devices/battery_BAT0`; +if ( $os eq 'darwin' ) { get_mac_battery() } +elsif ( $os eq 'linux' ) { get_linux_battery() } +else { die "Unsupported OS: $os" } + +sub get_mac_battery { + `pmset -g batt 2>/dev/null` =~ /(\d+%)\;\s*(\w+)/ + ? say "$1 ($2)" + : die "Unable to fetch macOS battery status."; +} + +sub get_linux_battery { + if (`which upower`) { + my $out = `upower -i \$(upower -e | grep 'BAT') 2>/dev/null`; + $out =~ /state:\s*(\w+)/ && $out =~ /percentage:\s*(\d+%)/ + ? say "Battery: $2 ($1)" && return + : die "Unable to fetch power with upower"; + } + if (`which acpi`) { + `acpi -b 2>/dev/null` =~ /(\d+%)\,\s*(\w+)/ + and say "Battery: $1 ($2)" + and return; + } + die "No battery tools found (upower/acpi)."; +} From 1ce0e1db33584e3e6f2ea474f4597b3d406ed88f Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Sun, 5 Jan 2025 21:45:20 -0500 Subject: [PATCH 22/78] shorten readme --- README.md | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 228e4b0..586237e 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,5 @@ # Dotfiles, scripts, and stuff -Pilfer at your own peril. Follow if you like. Sponsor if you're an angel. +Pilfer at your own peril. If you are thinking of following, just know I commit to main about once every three days, if I had several commits I will put them in a draft PR to avoid blowing followers away with commit notifications. -Unlike other projects, I regularly just commit to main with short commit messages (see [`scripts/savedot`](scripts/savedot)). I regularly commit multiple times per day. You have been warned. - -## Working style - -I'm an old SysAdmin, SysDE, SRE, black-hat, writer, and educator. This means that while I do have a favorite, cozy dev environment on my 14" Unix system with custom GUI desktop manager, I still want my dotfiles to work anywhere. It's also the reason I have my multicall binary monolith (think BusyBox) here as well. - -I've designed this repo to be something I can quickly clone to any system and just run [setup](setup) plus a few `install` scripts for the stuff I need to get immediately up and running. This process is so fast that I consider all the other Git clones read-only and only pull from changes made to this central repo. That way I never have a merge conflict and can use these dotfiles without fear that committing from a system that isn't one I own could give a company full ownership of the entire repo per IP policies (go watch season one of Silicon Valley). - -To keep `git clone` operations fast I regularly rebase this Git repo. - -I've tried workspace containers in the past and it is just too much hassle to keep the up to date even with CI/CD. Who knows, maybe I'll try again some time. Probably not, however, because I don't always need all the stuff that I install on my cozy workstation. Hence all the `install` scripts. - -## Interactive shell - -I use `zsh`, `bash`, and `ksh` for my interactive shells. My `config/shell` has an `rc` file that can be used for `~/.bashrc` or `~/.zshrc`. The `config-shell` command senses the current shell and does the right thing. - -## Dependencies - -Check out my [FAQ](https://github.com/rwxrob/faq) for answers about my preferences for dependencies. - -- POSIX shell (`/bin/sh`) -- Vim or NeoVim (hence the `~/.vimrc` AND `init.lua`) -- WezTerm (no I do not like Ghostty, no dynamic config) -- Perl v5.36 (`/usr/bin/env perl`) - -For other dependencies see the scripts that begin with `install` and `config`. - -## Perl shell dependency - -The Perl scripts assume a POSIX Unix shell underneath and regularly use backtick pipelines and commands and shell builtins such as `which`, `type`, and `command`. Perl is just far better than Bash for everything that requires more than POSIX shellβ€”especially when it involves text processing or math in any way. +Check out my [FAQ](https://github.com/rwxrob/faq) for answers about my work style, preferences, and dependencies. From 42bf993df197fe6874c40e9fab3352031f672fbb Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 00:59:48 -0500 Subject: [PATCH 23/78] start list of dot/scripts --- scripts/README.adoc | 355 ++++++++++++++++++++++++++++++++++++++++++++ scripts/README.md | 32 ---- 2 files changed, 355 insertions(+), 32 deletions(-) create mode 100644 scripts/README.adoc delete mode 100644 scripts/README.md diff --git a/scripts/README.adoc b/scripts/README.adoc new file mode 100644 index 0000000..c10fa5d --- /dev/null +++ b/scripts/README.adoc @@ -0,0 +1,355 @@ += Scripts + +[cols="^.^1,1",options="autowidth"] +|=== + +|255color| Print 255 color samples as numbers +|F| Description +|README.md| Description +|ageof| Description +|allcow| Description +|allfigl| Description +|b| Description +|back| Description +|bandit| Description +|banner| Description +|bannerfishies| Description +|bannerlights| Description +|bannerneo| Description +|bannerwatchcow| Description +|battery| Description +|bing| Description +|blankpane| Description +|blog| Description +|bug| Description +|build| Description +|buildadoc| Description +|bullets| Description +|cal| Description +|calendar| Description +|cast| Description +|catc| Description +|catscript| Description +|cdpath| Description +|changed| Description +|cheat| Description +|checkurls| Description +|chsuffix| Description +|cl| Description +|clip| Description +|close| Description +|cmdhtitles| Description +|colorstrip| Description +|commandfrom| Description +|comment| Description +|commentthis| Description +|confirm| Description +|contexts| Description +|countdown| Description +|countincol| Description +|countmin| Description +|countmin.tdy| Description +|countweeks| Description +|covid| Description +|coworking| Description +|cozycoding| Description +|crnd| Description +|cronoji| Description +|curllast| Description +|currently| Description +|d| Description +|dancing| Description +|dangerln| Description +|datepath| Description +|ddd| Description +|defmain| Description +|deprecated| Description +|distro| Description +|dockerclean| Description +|document| Description +|doh| Description +|doris| Description +|dprune| Description +|dquote| Description +|dstopall| Description +|duck| Description +|echon| Description +|eject| Description +|ending| Description +|enhancement| Description +|ex| Description +|extract| Description +|faq| Description +|faqoff| Description +|figl| Description +|fiocheck| Description +|fishies| Description +|fixapost| Description +|fmttable| Description +|frombase2| Description +|funcsin| Description +|ghtable| Description +|gidof| Description +|giveabout| Description +|givediscord| Description +|giveperl| Description +|giver| Description +|giveraw| Description +|gl| Description +|gmi| Description +|gobadges| Description +|goc| Description +|goclean| Description +|gocopyright| Description +|godistbuild| Description +|godocs| Description +|goduckyourself| Description +|goentrtest| Description +|goerrgen| Description +|goi| Description +|goimethods| Description +|gologtestoutput| Description +|gomethods| Description +|goodfirst| Description +|google| Description +|goprintasjson| Description +|gor| Description +|gosetget| Description +|got| Description +|gotestoutput| Description +|gotests| Description +|gott| Description +|gpgcreate| Description +|gpt| Description +|grepall| Description +|gstreamd| Description +|haschanged| Description +|hasissue| Description +|hboostdates| Description +|headerlist| Description +|heightwidth| Description +|helm-app-version-for-chart-version| Description +|helm-chart-version-for-app-version| Description +|hex2rgb| Description +|hlog| Description +|hnow| Description +|host| Description +|hrule| Description +|hsep| Description +|htbtasks| Description +|htitle| Description +|humm| Description +|indent| Description +|inow| Description +|ips| Description +|isosec| Description +|isosec2plain| Description +|issue| Description +|issues| Description +|istext| Description +|ix| Description +|jsonesc| Description +|justhelm| Description +|k| Description +|k8sapp| Description +|keyoff| Description +|keyon| Description +|kgetall| Description +|kgp| Description +|kn| Description +|krap| Description +|kubfree| Description +|kurl| Description +|kwait| Description +|label| Description +|labstream| Description +|landscape| Description +|lastbookmark| Description +|lastdown| Description +|lastpic| Description +|lasturl| Description +|latest| Description +|lh| Description +|lights| Description +|listening| Description +|livecal| Description +|liveicon| Description +|lorem| Description +|lslinks| Description +|lynx| Description +|lynxa| Description +|lynxar| Description +|lynxlast| Description +|m| Description +|mark| Description +|marquee| Description +|md| Description +|mdold| Description +|mentor| Description +|mimetype| Description +|mk| Description +|mkv2isosec| Description +|mkv2mp4| Description +|mkvlast| Description +|mode2yaml| Description +|monthstable| Description +|mute| Description +|muted| Description +|mvlast| Description +|mvlastpic| Description +|mvmkv2isosec| Description +|myip| Description +|mytrace| Description +|namespace| Description +|netshoot| Description +|newest| Description +|newx| Description +|nohup.out| Description +|nopath| Description +|now| Description +|nowshort| Description +|ns| Description +|numweek| Description +|off| Description +|onchange| Description +|opacity| Description +|open| Description +|openlast| Description +|openlastvid| Description +|origins| Description +|outline1| Description +|pae| Description +|path| Description +|pb| Description +|pdf| Description +|pdgit| Description +|pdhas| Description +|phone| Description +|pkghas| Description +|post| Description +|powerzones| Description +|ppae| Description +|ppie| Description +|ppp| Description +|ppplast| Description +|pr| Description +|pre| Description +|preview| Description +|printfargs| Description +|protonum| Description +|pubkey| Description +|push| Description +|pwdname| Description +|qreview| Description +|question| Description +|quotes| Description +|raid| Description +|randcol| Description +|recording| Description +|regrepos| Description +|remotetags| Description +|resolvtog| Description +|rndcolor| Description +|roll20| Description +|rot13| Description +|run| Description +|rund| Description +|rwxrob| Description +|save| Description +|savedot| Description +|scan| Description +|scentr| Description +|sched| Description +|screenkey| Description +|scripts| Description +|searx| Description +|sec2dur| Description +|semver-sort| Description +|sentencecase| Description +|sgoget| Description +|showcursor| Description +|sing| Description +|skeys| Description +|snip| Description +|song| Description +|songnext| Description +|ssection| Description +|sshkey| Description +|sshspeedtest| Description +|starting| Description +|startvms| Description +|stripesc| Description +|swag| Description +|symlink| Description +|sysderrors| Description +|syserrors| Description +|t| Description +|tags| Description +|tbanner| Description +|tclip| Description +|telln| Description +|termcolors| Description +|tf| Description +|tmatrix| Description +|tmuxin| Description +|tmuxinplain| Description +|tmuxlive| Description +|tobase2| Description +|toduck| Description +|toemoji| Description +|tohd| Description +|tolower| Description +|topdu| Description +|topegntokfilter| Description +|topic| Description +|topics| Description +|tot| Description +|trapterm| Description +|twitch-formats| Description +|twitch-mock-app-token| Description +|twitch-mock-clientid| Description +|twitch-mock-clientsecret| Description +|twitch-mock-users-logins| Description +|twitch-view| Description +|twitch.sh| Description +|twitchcat| Description +|twitchcat2yaml| Description +|twitter| Description +|txt| Description +|uidof| Description +|underconstruction| Description +|untag| Description +|uppera| Description +|upre| Description +|urlencode| Description +|urls| Description +|usageln| Description +|v| Description +|vic| Description +|vidoffset| Description +|vidoffsetsec| Description +|vids| Description +|vilast| Description +|vimcheat| Description +|vimpluginstall| Description +|w| Description +|watchcow| Description +|watching| Description +|wd| Description +|weather| Description +|wee| Description +|what| Description +|wiki| Description +|win2nixpath| Description +|wipe| Description +|ws| Description +|x| Description +|x_cmds| Description +|youtube-dl-audio| Description +|yqdiff| Description +|yt-transcribe| Description +|ytfoot| Description +|yyy| Description +|zet4mkv| Description + +|=== diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index 57aa0a0..0000000 --- a/scripts/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Scripts - -Pilfer at your own peril. You'll find a bit of everything, but mostly -just bash and perl. If that's not your thing, don’t waste your time β€” -especially if you use `zsh-it` for anything. - -More substantial commands have their own repos prefixed with [`cmd-`] -derived [`template-bash-command`]. Other commands (like the popular -[`pomo`] tool) are compiled go utilities with repos prefixed with -[`cmdbox-`]. - -[`template-bash-command`]: -[`cmdbox-`]: -[`cmd-`]: -[`pomo`]: - -## Installation - -> ⚠️ -> If you don't understand what any script is doing and how, then don't -> install it, period. You have been warned. - -Best way to use these scripts is to *read them*, grab them and put them -into your own stuff. ***For personal scripts only***, I've given in and -started using the incredibly inefficient and insecure `/usr/bin/env` -she-bang line convention, which pretty much ensures they will work on most any OS and distro. - -## Legal - -Copyright 2021 Rob Muhlestein -Released under Apache-1.0 License -Please mention From ee4d7b7e1a65f20d3c021a9af165b098e459e29b Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 01:03:28 -0500 Subject: [PATCH 24/78] add desc for f --- scripts/README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/README.adoc b/scripts/README.adoc index c10fa5d..ed36b99 100644 --- a/scripts/README.adoc +++ b/scripts/README.adoc @@ -4,7 +4,7 @@ |=== |255color| Print 255 color samples as numbers -|F| Description +|F| Split lines of input into fields (ex: 1..3,5) |README.md| Description |ageof| Description |allcow| Description From eaae86a32484df8990b54f24c8cac4b429903a9d Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 01:15:01 -0500 Subject: [PATCH 25/78] add links --- scripts/README.adoc | 355 -------------------------------------------- scripts/README.md | 353 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 353 insertions(+), 355 deletions(-) delete mode 100644 scripts/README.adoc create mode 100644 scripts/README.md diff --git a/scripts/README.adoc b/scripts/README.adoc deleted file mode 100644 index ed36b99..0000000 --- a/scripts/README.adoc +++ /dev/null @@ -1,355 +0,0 @@ -= Scripts - -[cols="^.^1,1",options="autowidth"] -|=== - -|255color| Print 255 color samples as numbers -|F| Split lines of input into fields (ex: 1..3,5) -|README.md| Description -|ageof| Description -|allcow| Description -|allfigl| Description -|b| Description -|back| Description -|bandit| Description -|banner| Description -|bannerfishies| Description -|bannerlights| Description -|bannerneo| Description -|bannerwatchcow| Description -|battery| Description -|bing| Description -|blankpane| Description -|blog| Description -|bug| Description -|build| Description -|buildadoc| Description -|bullets| Description -|cal| Description -|calendar| Description -|cast| Description -|catc| Description -|catscript| Description -|cdpath| Description -|changed| Description -|cheat| Description -|checkurls| Description -|chsuffix| Description -|cl| Description -|clip| Description -|close| Description -|cmdhtitles| Description -|colorstrip| Description -|commandfrom| Description -|comment| Description -|commentthis| Description -|confirm| Description -|contexts| Description -|countdown| Description -|countincol| Description -|countmin| Description -|countmin.tdy| Description -|countweeks| Description -|covid| Description -|coworking| Description -|cozycoding| Description -|crnd| Description -|cronoji| Description -|curllast| Description -|currently| Description -|d| Description -|dancing| Description -|dangerln| Description -|datepath| Description -|ddd| Description -|defmain| Description -|deprecated| Description -|distro| Description -|dockerclean| Description -|document| Description -|doh| Description -|doris| Description -|dprune| Description -|dquote| Description -|dstopall| Description -|duck| Description -|echon| Description -|eject| Description -|ending| Description -|enhancement| Description -|ex| Description -|extract| Description -|faq| Description -|faqoff| Description -|figl| Description -|fiocheck| Description -|fishies| Description -|fixapost| Description -|fmttable| Description -|frombase2| Description -|funcsin| Description -|ghtable| Description -|gidof| Description -|giveabout| Description -|givediscord| Description -|giveperl| Description -|giver| Description -|giveraw| Description -|gl| Description -|gmi| Description -|gobadges| Description -|goc| Description -|goclean| Description -|gocopyright| Description -|godistbuild| Description -|godocs| Description -|goduckyourself| Description -|goentrtest| Description -|goerrgen| Description -|goi| Description -|goimethods| Description -|gologtestoutput| Description -|gomethods| Description -|goodfirst| Description -|google| Description -|goprintasjson| Description -|gor| Description -|gosetget| Description -|got| Description -|gotestoutput| Description -|gotests| Description -|gott| Description -|gpgcreate| Description -|gpt| Description -|grepall| Description -|gstreamd| Description -|haschanged| Description -|hasissue| Description -|hboostdates| Description -|headerlist| Description -|heightwidth| Description -|helm-app-version-for-chart-version| Description -|helm-chart-version-for-app-version| Description -|hex2rgb| Description -|hlog| Description -|hnow| Description -|host| Description -|hrule| Description -|hsep| Description -|htbtasks| Description -|htitle| Description -|humm| Description -|indent| Description -|inow| Description -|ips| Description -|isosec| Description -|isosec2plain| Description -|issue| Description -|issues| Description -|istext| Description -|ix| Description -|jsonesc| Description -|justhelm| Description -|k| Description -|k8sapp| Description -|keyoff| Description -|keyon| Description -|kgetall| Description -|kgp| Description -|kn| Description -|krap| Description -|kubfree| Description -|kurl| Description -|kwait| Description -|label| Description -|labstream| Description -|landscape| Description -|lastbookmark| Description -|lastdown| Description -|lastpic| Description -|lasturl| Description -|latest| Description -|lh| Description -|lights| Description -|listening| Description -|livecal| Description -|liveicon| Description -|lorem| Description -|lslinks| Description -|lynx| Description -|lynxa| Description -|lynxar| Description -|lynxlast| Description -|m| Description -|mark| Description -|marquee| Description -|md| Description -|mdold| Description -|mentor| Description -|mimetype| Description -|mk| Description -|mkv2isosec| Description -|mkv2mp4| Description -|mkvlast| Description -|mode2yaml| Description -|monthstable| Description -|mute| Description -|muted| Description -|mvlast| Description -|mvlastpic| Description -|mvmkv2isosec| Description -|myip| Description -|mytrace| Description -|namespace| Description -|netshoot| Description -|newest| Description -|newx| Description -|nohup.out| Description -|nopath| Description -|now| Description -|nowshort| Description -|ns| Description -|numweek| Description -|off| Description -|onchange| Description -|opacity| Description -|open| Description -|openlast| Description -|openlastvid| Description -|origins| Description -|outline1| Description -|pae| Description -|path| Description -|pb| Description -|pdf| Description -|pdgit| Description -|pdhas| Description -|phone| Description -|pkghas| Description -|post| Description -|powerzones| Description -|ppae| Description -|ppie| Description -|ppp| Description -|ppplast| Description -|pr| Description -|pre| Description -|preview| Description -|printfargs| Description -|protonum| Description -|pubkey| Description -|push| Description -|pwdname| Description -|qreview| Description -|question| Description -|quotes| Description -|raid| Description -|randcol| Description -|recording| Description -|regrepos| Description -|remotetags| Description -|resolvtog| Description -|rndcolor| Description -|roll20| Description -|rot13| Description -|run| Description -|rund| Description -|rwxrob| Description -|save| Description -|savedot| Description -|scan| Description -|scentr| Description -|sched| Description -|screenkey| Description -|scripts| Description -|searx| Description -|sec2dur| Description -|semver-sort| Description -|sentencecase| Description -|sgoget| Description -|showcursor| Description -|sing| Description -|skeys| Description -|snip| Description -|song| Description -|songnext| Description -|ssection| Description -|sshkey| Description -|sshspeedtest| Description -|starting| Description -|startvms| Description -|stripesc| Description -|swag| Description -|symlink| Description -|sysderrors| Description -|syserrors| Description -|t| Description -|tags| Description -|tbanner| Description -|tclip| Description -|telln| Description -|termcolors| Description -|tf| Description -|tmatrix| Description -|tmuxin| Description -|tmuxinplain| Description -|tmuxlive| Description -|tobase2| Description -|toduck| Description -|toemoji| Description -|tohd| Description -|tolower| Description -|topdu| Description -|topegntokfilter| Description -|topic| Description -|topics| Description -|tot| Description -|trapterm| Description -|twitch-formats| Description -|twitch-mock-app-token| Description -|twitch-mock-clientid| Description -|twitch-mock-clientsecret| Description -|twitch-mock-users-logins| Description -|twitch-view| Description -|twitch.sh| Description -|twitchcat| Description -|twitchcat2yaml| Description -|twitter| Description -|txt| Description -|uidof| Description -|underconstruction| Description -|untag| Description -|uppera| Description -|upre| Description -|urlencode| Description -|urls| Description -|usageln| Description -|v| Description -|vic| Description -|vidoffset| Description -|vidoffsetsec| Description -|vids| Description -|vilast| Description -|vimcheat| Description -|vimpluginstall| Description -|w| Description -|watchcow| Description -|watching| Description -|wd| Description -|weather| Description -|wee| Description -|what| Description -|wiki| Description -|win2nixpath| Description -|wipe| Description -|ws| Description -|x| Description -|x_cmds| Description -|youtube-dl-audio| Description -|yqdiff| Description -|yt-transcribe| Description -|ytfoot| Description -|yyy| Description -|zet4mkv| Description - -|=== diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..8eafca0 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,353 @@ +# Scripts + +|Script|Description| +|-|-| +|[255color](255color)| Print 255 color samples as numbers +|[F](F)| Split lines of input into fields (ex: 1..3,5) +|[README.md](README.md)| Description +|[ageof](ageof)| Description +|[allcow](allcow)| Description +|[allfigl](allfigl)| Description +|[b](b)| Description +|[back](back)| Description +|[bandit](bandit)| Description +|[banner](banner)| Description +|[bannerfishies](bannerfishies)| Description +|[bannerlights](bannerlights)| Description +|[bannerneo](bannerneo)| Description +|[bannerwatchcow](bannerwatchcow)| Description +|[battery](battery)| Description +|[bing](bing)| Description +|[blankpane](blankpane)| Description +|[blog](blog)| Description +|[bug](bug)| Description +|[build](build)| Description +|[buildadoc](buildadoc)| Description +|[bullets](bullets)| Description +|[cal](cal)| Description +|[calendar](calendar)| Description +|[cast](cast)| Description +|[catc](catc)| Description +|[catscript](catscript)| Description +|[cdpath](cdpath)| Description +|[changed](changed)| Description +|[cheat](cheat)| Description +|[checkurls](checkurls)| Description +|[chsuffix](chsuffix)| Description +|[cl](cl)| Description +|[clip](clip)| Description +|[close](close)| Description +|[cmdhtitles](cmdhtitles)| Description +|[colorstrip](colorstrip)| Description +|[commandfrom](commandfrom)| Description +|[comment](comment)| Description +|[commentthis](commentthis)| Description +|[confirm](confirm)| Description +|[contexts](contexts)| Description +|[countdown](countdown)| Description +|[countincol](countincol)| Description +|[countmin](countmin)| Description +|[countmin.tdy](countmin.tdy)| Description +|[countweeks](countweeks)| Description +|[covid](covid)| Description +|[coworking](coworking)| Description +|[cozycoding](cozycoding)| Description +|[crnd](crnd)| Description +|[cronoji](cronoji)| Description +|[curllast](curllast)| Description +|[currently](currently)| Description +|[d](d)| Description +|[dancing](dancing)| Description +|[dangerln](dangerln)| Description +|[datepath](datepath)| Description +|[ddd](ddd)| Description +|[defmain](defmain)| Description +|[deprecated](deprecated)| Description +|[distro](distro)| Description +|[dockerclean](dockerclean)| Description +|[document](document)| Description +|[doh](doh)| Description +|[doris](doris)| Description +|[dprune](dprune)| Description +|[dquote](dquote)| Description +|[dstopall](dstopall)| Description +|[duck](duck)| Description +|[echon](echon)| Description +|[eject](eject)| Description +|[ending](ending)| Description +|[enhancement](enhancement)| Description +|[ex](ex)| Description +|[extract](extract)| Description +|[faq](faq)| Description +|[faqoff](faqoff)| Description +|[figl](figl)| Description +|[fiocheck](fiocheck)| Description +|[fishies](fishies)| Description +|[fixapost](fixapost)| Description +|[fmttable](fmttable)| Description +|[frombase2](frombase2)| Description +|[funcsin](funcsin)| Description +|[ghtable](ghtable)| Description +|[gidof](gidof)| Description +|[giveabout](giveabout)| Description +|[givediscord](givediscord)| Description +|[giveperl](giveperl)| Description +|[giver](giver)| Description +|[giveraw](giveraw)| Description +|[gl](gl)| Description +|[gmi](gmi)| Description +|[gobadges](gobadges)| Description +|[goc](goc)| Description +|[goclean](goclean)| Description +|[gocopyright](gocopyright)| Description +|[godistbuild](godistbuild)| Description +|[godocs](godocs)| Description +|[goduckyourself](goduckyourself)| Description +|[goentrtest](goentrtest)| Description +|[goerrgen](goerrgen)| Description +|[goi](goi)| Description +|[goimethods](goimethods)| Description +|[gologtestoutput](gologtestoutput)| Description +|[gomethods](gomethods)| Description +|[goodfirst](goodfirst)| Description +|[google](google)| Description +|[goprintasjson](goprintasjson)| Description +|[gor](gor)| Description +|[gosetget](gosetget)| Description +|[got](got)| Description +|[gotestoutput](gotestoutput)| Description +|[gotests](gotests)| Description +|[gott](gott)| Description +|[gpgcreate](gpgcreate)| Description +|[gpt](gpt)| Description +|[grepall](grepall)| Description +|[gstreamd](gstreamd)| Description +|[haschanged](haschanged)| Description +|[hasissue](hasissue)| Description +|[hboostdates](hboostdates)| Description +|[headerlist](headerlist)| Description +|[heightwidth](heightwidth)| Description +|[helm-app-version-for-chart-version](helm-app-version-for-chart-version)| Description +|[helm-chart-version-for-app-version](helm-chart-version-for-app-version)| Description +|[hex2rgb](hex2rgb)| Description +|[hlog](hlog)| Description +|[hnow](hnow)| Description +|[host](host)| Description +|[hrule](hrule)| Description +|[hsep](hsep)| Description +|[htbtasks](htbtasks)| Description +|[htitle](htitle)| Description +|[humm](humm)| Description +|[indent](indent)| Description +|[inow](inow)| Description +|[ips](ips)| Description +|[isosec](isosec)| Description +|[isosec2plain](isosec2plain)| Description +|[issue](issue)| Description +|[issues](issues)| Description +|[istext](istext)| Description +|[ix](ix)| Description +|[jsonesc](jsonesc)| Description +|[justhelm](justhelm)| Description +|[k](k)| Description +|[k8sapp](k8sapp)| Description +|[keyoff](keyoff)| Description +|[keyon](keyon)| Description +|[kgetall](kgetall)| Description +|[kgp](kgp)| Description +|[kn](kn)| Description +|[krap](krap)| Description +|[kubfree](kubfree)| Description +|[kurl](kurl)| Description +|[kwait](kwait)| Description +|[label](label)| Description +|[labstream](labstream)| Description +|[landscape](landscape)| Description +|[lastbookmark](lastbookmark)| Description +|[lastdown](lastdown)| Description +|[lastpic](lastpic)| Description +|[lasturl](lasturl)| Description +|[latest](latest)| Description +|[lh](lh)| Description +|[lights](lights)| Description +|[listening](listening)| Description +|[livecal](livecal)| Description +|[liveicon](liveicon)| Description +|[lorem](lorem)| Description +|[lslinks](lslinks)| Description +|[lynx](lynx)| Description +|[lynxa](lynxa)| Description +|[lynxar](lynxar)| Description +|[lynxlast](lynxlast)| Description +|[m](m)| Description +|[mark](mark)| Description +|[marquee](marquee)| Description +|[md](md)| Description +|[mdold](mdold)| Description +|[mentor](mentor)| Description +|[mimetype](mimetype)| Description +|[mk](mk)| Description +|[mkv2isosec](mkv2isosec)| Description +|[mkv2mp4](mkv2mp4)| Description +|[mkvlast](mkvlast)| Description +|[mode2yaml](mode2yaml)| Description +|[monthstable](monthstable)| Description +|[mute](mute)| Description +|[muted](muted)| Description +|[mvlast](mvlast)| Description +|[mvlastpic](mvlastpic)| Description +|[mvmkv2isosec](mvmkv2isosec)| Description +|[myip](myip)| Description +|[mytrace](mytrace)| Description +|[namespace](namespace)| Description +|[netshoot](netshoot)| Description +|[newest](newest)| Description +|[newx](newx)| Description +|[nohup.out](nohup.out)| Description +|[nopath](nopath)| Description +|[now](now)| Description +|[nowshort](nowshort)| Description +|[ns](ns)| Description +|[numweek](numweek)| Description +|[off](off)| Description +|[onchange](onchange)| Description +|[opacity](opacity)| Description +|[open](open)| Description +|[openlast](openlast)| Description +|[openlastvid](openlastvid)| Description +|[origins](origins)| Description +|[outline1](outline1)| Description +|[pae](pae)| Description +|[path](path)| Description +|[pb](pb)| Description +|[pdf](pdf)| Description +|[pdgit](pdgit)| Description +|[pdhas](pdhas)| Description +|[phone](phone)| Description +|[pkghas](pkghas)| Description +|[post](post)| Description +|[powerzones](powerzones)| Description +|[ppae](ppae)| Description +|[ppie](ppie)| Description +|[ppp](ppp)| Description +|[ppplast](ppplast)| Description +|[pr](pr)| Description +|[pre](pre)| Description +|[preview](preview)| Description +|[printfargs](printfargs)| Description +|[protonum](protonum)| Description +|[pubkey](pubkey)| Description +|[push](push)| Description +|[pwdname](pwdname)| Description +|[qreview](qreview)| Description +|[question](question)| Description +|[quotes](quotes)| Description +|[raid](raid)| Description +|[randcol](randcol)| Description +|[recording](recording)| Description +|[regrepos](regrepos)| Description +|[remotetags](remotetags)| Description +|[resolvtog](resolvtog)| Description +|[rndcolor](rndcolor)| Description +|[roll20](roll20)| Description +|[rot13](rot13)| Description +|[run](run)| Description +|[rund](rund)| Description +|[rwxrob](rwxrob)| Description +|[save](save)| Description +|[savedot](savedot)| Description +|[scan](scan)| Description +|[scentr](scentr)| Description +|[sched](sched)| Description +|[screenkey](screenkey)| Description +|[scripts](scripts)| Description +|[searx](searx)| Description +|[sec2dur](sec2dur)| Description +|[semver-sort](semver-sort)| Description +|[sentencecase](sentencecase)| Description +|[sgoget](sgoget)| Description +|[showcursor](showcursor)| Description +|[sing](sing)| Description +|[skeys](skeys)| Description +|[snip](snip)| Description +|[song](song)| Description +|[songnext](songnext)| Description +|[ssection](ssection)| Description +|[sshkey](sshkey)| Description +|[sshspeedtest](sshspeedtest)| Description +|[starting](starting)| Description +|[startvms](startvms)| Description +|[stripesc](stripesc)| Description +|[swag](swag)| Description +|[symlink](symlink)| Description +|[sysderrors](sysderrors)| Description +|[syserrors](syserrors)| Description +|[t](t)| Description +|[tags](tags)| Description +|[tbanner](tbanner)| Description +|[tclip](tclip)| Description +|[telln](telln)| Description +|[termcolors](termcolors)| Description +|[tf](tf)| Description +|[tmatrix](tmatrix)| Description +|[tmuxin](tmuxin)| Description +|[tmuxinplain](tmuxinplain)| Description +|[tmuxlive](tmuxlive)| Description +|[tobase2](tobase2)| Description +|[toduck](toduck)| Description +|[toemoji](toemoji)| Description +|[tohd](tohd)| Description +|[tolower](tolower)| Description +|[topdu](topdu)| Description +|[topegntokfilter](topegntokfilter)| Description +|[topic](topic)| Description +|[topics](topics)| Description +|[tot](tot)| Description +|[trapterm](trapterm)| Description +|[twitch-formats](twitch-formats)| Description +|[twitch-mock-app-token](twitch-mock-app-token)| Description +|[twitch-mock-clientid](twitch-mock-clientid)| Description +|[twitch-mock-clientsecret](twitch-mock-clientsecret)| Description +|[twitch-mock-users-logins](twitch-mock-users-logins)| Description +|[twitch-view](twitch-view)| Description +|[twitch.sh](twitch.sh)| Description +|[twitchcat](twitchcat)| Description +|[twitchcat2yaml](twitchcat2yaml)| Description +|[twitter](twitter)| Description +|[txt](txt)| Description +|[uidof](uidof)| Description +|[underconstruction](underconstruction)| Description +|[untag](untag)| Description +|[uppera](uppera)| Description +|[upre](upre)| Description +|[urlencode](urlencode)| Description +|[urls](urls)| Description +|[usageln](usageln)| Description +|[v](v)| Description +|[vic](vic)| Description +|[vidoffset](vidoffset)| Description +|[vidoffsetsec](vidoffsetsec)| Description +|[vids](vids)| Description +|[vilast](vilast)| Description +|[vimcheat](vimcheat)| Description +|[vimpluginstall](vimpluginstall)| Description +|[w](w)| Description +|[watchcow](watchcow)| Description +|[watching](watching)| Description +|[wd](wd)| Description +|[weather](weather)| Description +|[wee](wee)| Description +|[what](what)| Description +|[wiki](wiki)| Description +|[win2nixpath](win2nixpath)| Description +|[wipe](wipe)| Description +|[ws](ws)| Description +|[x](x)| Description +|[x_cmds](x_cmds)| Description +|[youtube-dl-audio](youtube-dl-audio)| Description +|[yqdiff](yqdiff)| Description +|[yt-transcribe](yt-transcribe)| Description +|[ytfoot](ytfoot)| Description +|[yyy](yyy)| Description +|[zet4mkv](zet4mkv)| Description + From eb2dd7ce2cee270a7f783309cf854ed086b536de Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 11:29:09 -0500 Subject: [PATCH 26/78] add prepend to scripts --- scripts/README.md | 10 ++++------ scripts/ageof | 5 +---- scripts/b | 2 -- scripts/back | 15 ++++++++------- scripts/{f => fields} | 0 scripts/prepend | 5 +++++ 6 files changed, 18 insertions(+), 19 deletions(-) delete mode 100755 scripts/b rename scripts/{f => fields} (100%) create mode 100755 scripts/prepend diff --git a/scripts/README.md b/scripts/README.md index 8eafca0..0dd5a5a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -3,12 +3,10 @@ |Script|Description| |-|-| |[255color](255color)| Print 255 color samples as numbers -|[F](F)| Split lines of input into fields (ex: 1..3,5) -|[README.md](README.md)| Description -|[ageof](ageof)| Description -|[allcow](allcow)| Description -|[allfigl](allfigl)| Description -|[b](b)| Description +|[fields](fields)| Split lines of input into fields (`1..3,5`) +|[ageof](ageof)| Prints seconds since first argument was last modified +|[allcow](allcow)| Cycle through display of all different cows +|[allfigl](allfigl)| Cycle through display of all different figlet fonts |[back](back)| Description |[bandit](bandit)| Description |[banner](banner)| Description diff --git a/scripts/ageof b/scripts/ageof index 6c5a7dd..ff962ce 100755 --- a/scripts/ageof +++ b/scripts/ageof @@ -1,8 +1,5 @@ #!/bin/sh - -# Outputs the seconds since the thing identified by the first argument -# was last modified (not created). - +# Prints seconds since first argument was last modified (not created) path="$1" if ! test -e "$path"; then echo 'usage: ageof ' diff --git a/scripts/b b/scripts/b deleted file mode 100755 index 97826ac..0000000 --- a/scripts/b +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec ./build "$@" diff --git a/scripts/back b/scripts/back index 13be5aa..d540cd6 100755 --- a/scripts/back +++ b/scripts/back @@ -1,7 +1,8 @@ -#!/bin/sh -what="$*" -if test -z "$what"; then - what="in a bit" -fi -echo "$what" >~/.break -exec bannerneo "back $what" +#!/usr/bin/env perl +use v5.36; +my $what = join ' ', @ARGV; +$what ||= 'in a bit'; +`prepend ~/.current "πŸ’€ $what"`; +my @files = grep { -f && /^banner\S/ } glob("*"); +my $file = $files[ int( rand( scalar(@files) ) ) ]; +exec $file "back $what" diff --git a/scripts/f b/scripts/fields similarity index 100% rename from scripts/f rename to scripts/fields diff --git a/scripts/prepend b/scripts/prepend new file mode 100755 index 0000000..00ba116 --- /dev/null +++ b/scripts/prepend @@ -0,0 +1,5 @@ +#!/bin/sh +[ $# -lt 2 ] && echo "Usage: $0 " && exit 1 +file="$1" && shift +tmpfile=$(mktemp) +echo "$*" | cat - "$file" >"$tmpfile" && mv "$tmpfile" "$file" From cf12f7515f1229a7198cfe8afa125322541a9594 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 11:37:28 -0500 Subject: [PATCH 27/78] port back to perl --- scripts/back | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/back b/scripts/back index d540cd6..540055f 100755 --- a/scripts/back +++ b/scripts/back @@ -2,7 +2,7 @@ use v5.36; my $what = join ' ', @ARGV; $what ||= 'in a bit'; -`prepend ~/.current "πŸ’€ $what"`; +`prepend ~/.currently "πŸ’€ $what"`; my @files = grep { -f && /^banner\S/ } glob("*"); my $file = $files[ int( rand( scalar(@files) ) ) ]; -exec $file "back $what" +exec "$file back $what" From 8de61bf656f57c5ab39905755d0419c56c8f4252 Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 12:13:59 -0500 Subject: [PATCH 28/78] fix back relative path --- scripts/back | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/back b/scripts/back index 540055f..e86cee7 100755 --- a/scripts/back +++ b/scripts/back @@ -1,8 +1,10 @@ #!/usr/bin/env perl use v5.36; +use File::Basename; my $what = join ' ', @ARGV; $what ||= 'in a bit'; `prepend ~/.currently "πŸ’€ $what"`; -my @files = grep { -f && /^banner\S/ } glob("*"); -my $file = $files[ int( rand( scalar(@files) ) ) ]; -exec "$file back $what" +my @paths = grep { -f && m,/banner\S.*$, } glob( dirname($0) . '/*' ); +my @scripts = map { basename($_) } @paths; +my $script = $scripts[ int( rand( scalar(@scripts) ) ) ]; +($script) ? exec "$script back $what" : exec "banner back $what"; From 53cf7ccad8f6e2731527b0a7f70a9f38bc3a67fa Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 12:15:09 -0500 Subject: [PATCH 29/78] fix back currently status --- scripts/back | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/back b/scripts/back index e86cee7..2523786 100755 --- a/scripts/back +++ b/scripts/back @@ -3,7 +3,7 @@ use v5.36; use File::Basename; my $what = join ' ', @ARGV; $what ||= 'in a bit'; -`prepend ~/.currently "πŸ’€ $what"`; +`prepend ~/.currently "πŸ’€ back $what"`; my @paths = grep { -f && m,/banner\S.*$, } glob( dirname($0) . '/*' ); my @scripts = map { basename($_) } @paths; my $script = $scripts[ int( rand( scalar(@scripts) ) ) ]; From 0d472d854ec4c09c166dac16fa5365e4e6dc25fa Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 12:20:52 -0500 Subject: [PATCH 30/78] fix back currently status --- scripts/back | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/back b/scripts/back index 2523786..9728bc2 100755 --- a/scripts/back +++ b/scripts/back @@ -4,7 +4,7 @@ use File::Basename; my $what = join ' ', @ARGV; $what ||= 'in a bit'; `prepend ~/.currently "πŸ’€ back $what"`; -my @paths = grep { -f && m,/banner\S.*$, } glob( dirname($0) . '/*' ); +my @paths = grep { -f && /\/banner\S.*$/ } glob( dirname($0) . '/*' ); my @scripts = map { basename($_) } @paths; my $script = $scripts[ int( rand( scalar(@scripts) ) ) ]; ($script) ? exec "$script back $what" : exec "banner back $what"; From 0238ddb116d3afddcc973127d6f6d6ad369a060c Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Mon, 6 Jan 2025 22:27:04 -0500 Subject: [PATCH 31/78] save --- .bashrc | 5 +- fortunes/mrrobot | 438 +++++++++++++++++++++++++++++++++++++++++++ fortunes/mrrobot.dat | Bin 0 -> 1224 bytes scripts/README.md | 27 ++- scripts/bandit | 3 - scripts/bing | 5 - scripts/blankpane | 7 - scripts/blog | 7 - scripts/bug | 3 +- scripts/buildadoc | 7 +- scripts/bullets | 5 +- scripts/duck | 2 +- scripts/ppie | 2 +- scripts/watchcow | 2 +- 14 files changed, 461 insertions(+), 52 deletions(-) create mode 100644 fortunes/mrrobot create mode 100644 fortunes/mrrobot.dat delete mode 100755 scripts/bandit delete mode 100755 scripts/bing delete mode 100755 scripts/blankpane diff --git a/.bashrc b/.bashrc index f5dbdf9..f6c17b2 100644 --- a/.bashrc +++ b/.bashrc @@ -253,9 +253,10 @@ _have setxkbmap && test -n "$DISPLAY" && unalias -a alias todo='vi ~/.todo' alias ip='ip -c' -alias '?'=gpt +alias '?'=claude alias '??'=duck alias '???'=google +alias '????'=bing alias dot='cd $DOTFILES' alias scripts='cd $SCRIPTS' alias snippets='cd $SNIPPETS' @@ -405,3 +406,5 @@ export NVM_DIR="$HOME/.nvm" export NAME=Rob export PATH=$PATH:/Users/rwxrob/Repos/github.com/rwxrob/lab-sample + +fortune "$REPOS/github.com/rwxrob/dot/fortunes/mrrobot" | cowsay -W 50 -f "$REPOS/github.com/rwxrob/dot/config/cowsay/default.cow" | indent 15 | lolcat -ft diff --git a/fortunes/mrrobot b/fortunes/mrrobot new file mode 100644 index 0000000..127b411 --- /dev/null +++ b/fortunes/mrrobot @@ -0,0 +1,438 @@ +"Sometimes I dream of saving the world. Saving everyone from the invisible hand. The one that controls us every day without us knowing it. But I can't stop it. I'm not that special. I'm just anonymous. I'm just alone." +- Elliot Alderson +% +"Control can sometimes be an illusion. But sometimes you need illusion to gain control." +- Mr. Robot +% +"Are you a one or a zero? That's the question you have to ask yourself. Are you a yes or a no? You gonna act or not?" +- Mr. Robot +% +"Power belongs to the people that take it." +- Mr. Robot +% +"Never appeal to a man's better nature. He may not have one." +- Mr. Robot +% +"Sometimes the only way to truly protect the ones you love is to let them go." +- Mr. Robot +% +"We're all living in each other's paranoia." +- Elliot Alderson +% +"Fear is the most powerful tool in our arsenal." +- Whiterose +% +"Sometimes the only way out is through." +- Mr. Robot +% +"You are stronger than you think." +- Angela Moss +% +"We all wear masks. Everyone, every day." +- Mr. Robot +% +"People are all just people, right? When it gets down to it, everyone is the same. They love something. They want something. They fear something." +- Elliot Alderson +% +"The Internet is the best school ever created. The best peers are on the Internet. The best books are on the Internet. The best teachers are on the Internet." +- Elliot Alderson +% +"We have to let go of what we think we know." +- Elliot Alderson +% +"You're not a hero. You're a coward. You hide behind your insanity." +- Mr. Robot +% +"You can't change the world without getting your hands dirty." +- Mr. Robot +% +"The world runs on one thing: power." +- Tyrell Wellick +% +"Sometimes we go through things that we think are bad but end up being for the best." +- Elliot Alderson +% +"We're not saving the world... we're just changing it." +- Elliot Alderson +% +"The hardest thing in life is knowing who to trust." +- Angela Moss +% +"Dreams are the only escape." +- Elliot Alderson +% +"You can change the world, but you can't change people." +- Mr. Robot +% +"I wanted to save the world, but I only destroyed it." +- Elliot Alderson +% +"Sometimes we make mistakes, big ones, ones we can’t take back. But that doesn’t mean we can’t learn from them." +- Elliot Alderson +% +"Nothing is perfect. We just do the best we can with what we have." +- Mr. Robot +% +"Everyone's fighting a battle you can't see." +- Darlene +% +"The price of freedom is high." +- Whiterose +% +"Hope is the most dangerous thing." +- Elliot Alderson +% +"Every hacker has her fixation. You hack people, I hack time." +- Whiterose +% +"You don't know what you're capable of until you're tested." +- Mr. Robot +% +"The world is sick, Elliot, and you're the cure." +- Mr. Robot +% +"Sometimes the only way forward is to destroy everything and start over." +- Mr. Robot +% +"Isn't that what society is? When we lose our principles, we invite chaos." +- Mr. Robot +% +"Sometimes I wish I could just disappear." +- Elliot Alderson +% +"Dreams aren't just dreams. They're our roadmap for change." +- Elliot Alderson +% +"Pain makes us who we are." +- Mr. Robot +% +"You’re not alone. You never were." +- Darlene +% +"The revolution will not be televised." +- Elliot Alderson +% +"We create our own reality." +- Mr. Robot +% +"The best way to predict the future is to invent it." +- Elliot Alderson +% +"You can't let the mistakes of your past define your future." +- Elliot Alderson +% +"Sometimes you have to break something to fix it." +- Mr. Robot +% +"The world doesn't change. People change." +- Elliot Alderson +% +"We all have monsters inside us. But they don’t have to define us." +- Mr. Robot +% +"The hardest prison to escape is your own mind." +- Elliot Alderson +% +"You have to keep moving forward, even when it hurts." +- Elliot Alderson +% +"No one is coming to save us. We have to save ourselves." +- Elliot Alderson +% +"Sometimes the best thing you can do is start over." +- Elliot Alderson +% +"You're the hero. You're the one who can fix this." +- Angela Moss +% +"The world isn't broken, it’s just unfinished." +- Elliot Alderson +% +"Nothing worth having comes easy." +- Mr. Robot +% +"We all make mistakes, Elliot. The question is, what do we do next?" +- Mr. Robot +% +"The revolution starts with one person. One decision. One moment." +- Elliot Alderson +% +"We're not defined by our failures. We're defined by how we rise after them." +- Elliot Alderson +% +"Sometimes we think we're helping, but we're really just making it worse." +- Elliot Alderson +% +"We have to take responsibility for what we've done, and find a way forward." +- Elliot Alderson +% +"Every choice we make creates ripples. Make sure yours count." +- Mr. Robot +% +"I thought I was fixing the world, but maybe I was just breaking myself." +- Elliot Alderson +% +"If you want to change things, perhaps you should try from within, because this is what happens from the outside." +- Terry Colby +% +"You can ask me anything you want, but at the end of the day, money is always going to be better than anything you ask for." +- Terry Colby +% +"Sometimes you gotta close your eyes and really envision that shit, bro. If you like it, then it's beautiful. If you don't? Then you might as well fade the fuck out right now." +- Leon +% +"Do you not know your Vonnegut? Man, nobody fuckin' reads anymore." +- Leon +% +"Yo, man, when you see Whiterose, make sure you say I did you good. I'll be rooting for you, cuz. Always." +- Leon +% +"Control is about as real as a unicorn taking a leak at the end of a double rainbow." +- Leon +% +"People out here, man, they be ignorant. They see a dude talking to himself, they think he's crazy. I see someone talking to themselves, I think they're a genius." +- Leon +% +"People walk around, act like they know what hate means. Nah, no one does, until you hate yourself. I mean truly hate yourself. That's power." +- Fernando Vera +% +"Home isn't where you're from, it's where you're supposed to be." +- Fernando Vera +% +"There's a smart time to be scared, bro... and a stupid time." +- Fernando Vera +% +"If they lock me up, the kind of door they close don't matter." +- Fernando Vera +% +"We all have a purpose in this world, and it's our lot in life to wait for the cosmos to reveal what that is." +- Fernando Vera +% +"Only the north stars of the cosmos can help a visionary like me." +- Fernando Vera +% +"Once you've weathered a storm like yours... you become the storm." +- Fernando Vera +% +"Just a brave traveler, who's finally come home." +- Fernando Vera +% +"See, this shit you went through, most people don't know pain like that. They never will. And if they did, it would end them." +- Fernando Vera +% +"People out here, man, they be ignorant. They see a dude talking to himself, they think he's crazy. I see someone talking to themselves, I think they're a genius." +- Fernando Vera +% + + +"Every hacker has her fixation. You hack people, I hack time." +- Whiterose +% +"The concept of waiting bewilders me. There are always deadlines. There are always ticking clocks. That's why you must manage your time." +- Whiterose +% +"I have learned to listen when time speaks." +- Whiterose +% +"Our paths were too precisely linked to this moment for there not to be a reason. This is why. You get to decide." +- Whiterose +% +"I've always found doors fascinating inventions. They hold the entry to unlimited imagination." +- Whiterose +% +"Life is but a walking shadow, a poor player that struts and frets his hour upon the stage and then is heard no more." +- Whiterose +% +"Dwelling is so inefficient." +- Whiterose +% +"Time is the ultimate power. Those who control time, control everything." +- Whiterose +% +"Patience is not a virtue; it's a waste of time." +- Whiterose +% +"To understand the future, one must understand the nature of time." +- Whiterose +% +"Time is the only resource we cannot replenish." +- Whiterose +% +"Efficiency is the key to success; dwelling on the past is the key to failure." +- Whiterose +% +"Time reveals all truths." +- Whiterose +% +"Waiting is a fool's errand; action must be immediate." +- Whiterose +% +"Time is a construct; those who master it, master their destiny." +- Whiterose +% +"Every second wasted is an opportunity lost." +- Whiterose +% +"Time is the most valuable commodity; spend it wisely." +- Whiterose +% +"To control time is to control the world." +- Whiterose +% +"Time waits for no one; neither should you." +- Whiterose +% +"Time is the ultimate judge; it reveals all secrets." +- Whiterose +% +"Time is the currency of the universe; invest it wisely." +- Whiterose +% +"Time is the architect of fate." +- Whiterose +% +"Time is the most powerful weapon; wield it carefully." +- Whiterose +% +"Time is the great equalizer; it spares no one." +- Whiterose +% +"Time is the silent partner in all success." +- Whiterose +% +"Time is the master of all things; respect it." +- Whiterose +% +"Time is the ultimate strategist; learn from it." +- Whiterose +% +"Time is the most honest of all; it never lies." +- Whiterose +% +"Time is the canvas upon which we paint our lives." +- Whiterose +% +"Time is the most relentless force; it stops for nothing." +- Whiterose +% +"Time is the true currency; all else is illusion." +- Whiterose +% +"Time is the most precious gift; cherish it." +- Whiterose +% +"Time is the ultimate teacher; heed its lessons." +- Whiterose +% +"Time is the most elusive element; grasp it firmly." +- Whiterose +% +"Time is the great sculptor; it shapes all destinies." +- Whiterose +% +"Time is the most potent force; harness it." +- Whiterose +% +"Time is the ultimate healer; trust in its process." +- Whiterose +% +"Time is the most impartial judge; it favors no one." +- Whiterose +% +"Time is the most constant companion; acknowledge it." +- Whiterose +% +"Time is the ultimate resource; manage it wisely." +- Whiterose +% +"Time is the most profound mystery; explore it." +- Whiterose +% +"Time is the most steadfast ally; rely on it." +- Whiterose +% +"Time is the ultimate challenge; confront it." +- Whiterose +% +"Time is the most intricate puzzle; solve it." +- Whiterose +% +"Time is the most formidable adversary; respect it." +- Whiterose +% +"Time is the most essential element; prioritize it." +- Whiterose +% +"Time is the most influential force; be aware of it." +- Whiterose +% +"Time is the most significant factor; consider it." +- Whiterose +% +"Time is the most enduring presence; embrace it." +- Whiterose +% +"Time is the most valuable asset; protect it." +- Whiterose +% +"When we lose our principles, we invite chaos." +- Irving +% +"What's the name of your youngest family member again? Oh, that's right... four-year-old Jamie DiPierro from Morrisville. That's your brother Joseph's son, right? I want you to look at this jack-off and imagine that's little Jamie." +- Irving +% +"And now I want you to imagine ya mom Trudie, IN PHILLY! And now imagine uncle Chris one morning, as he's picking up his copy of the DALLAS MORNING STAR! OR YA OLDER BROTHER, JERRY... WHILE HE'S WATCHING WHEEL! OF! FORTUNE! Am I done stating my point?! DOM! I'M GONNA NEED VERBAL CONFIRMATION THAT YOU'RE GRASPING THE DETAILS OF THIS AGREEMENT!" +- Irving +% +"Control is about as real as a unicorn taking a leak at the end of a double rainbow." +- Irving +% +"Sometimes the only way to truly protect the ones you love is to let them go." +- Irving +% +"Patience is not a virtue; it's a waste of time." +- Irving +% +"Time is the ultimate power. Those who control time, control everything." +- Irving +% +"Efficiency is the key to success; dwelling on the past is the key to failure." +- Irving +% +"Time reveals all truths." +- Irving +% +"Waiting is a fool's errand; action must be immediate." +- Irving +% +"You're gonna get yourself killed messing around with that psycho." +- Romero +% +"Man, I ain't got time for this hacker vigilante bullshit." +- Romero +% +"Do you know how many federal laws you've broken? You're playing with fire, kid." +- Romero +% +"Look, kid, this ain't a game. These people don't mess around." +- Romero +% +"You're in way over your head. This isn't some movie." +- Romero +% +"Paranoia's just reality on a finer scale." +- Romero +% +"Trust is a luxury we can't afford." +- Romero +% +"Every revolution needs a skeptic." +- Romero +% +"Just because you're paranoid doesn't mean they're not out to get you." +- Romero +% +"Sometimes the only way to stay sane is to go a little crazy." +- Romero +% + diff --git a/fortunes/mrrobot.dat b/fortunes/mrrobot.dat new file mode 100644 index 0000000000000000000000000000000000000000..668b10511d1b35fdba241535109b635b8c35a1fd GIT binary patch literal 1224 zcmYk*KS/{~ETjg5a26HTf)O^mrqG*zSLAQ`G?$0AZi3dI%`R1{aiLR$(V=+;3* zOVL6H9dr@wAaro(;GdyTGL#}x+d7KW)=m{#$nPtd<&)oY$KCrp@4bd$xD5T~g=>_2 zRnNsF#cQ1FzpEdQ<&6kV;J(cBVmHp>d;BBaZ)AQSF5#)Xc?YNPyYx8t1UK+P7Tm>; zve3c-e2IIqr~*fDO%@BI_%V3}e@ZX?dwa+{*Gr#1kLtchNWZ?X$|bG%9GRcrRQ9tT z|2p}X46sFkr{t_G&EPA%lx1DWoPx|RxTAXL86L=6o%mLk(_i^-<%)Z_jLaiEsT}4x zCUZB(RX6|2$}L&tM&?p=s2pLRBJ5xEf$Gs2Jd)Kh"docs/$file" fi - exec "$EDITOR" "docs/$file" diff --git a/scripts/bug b/scripts/bug index 997537b..de7b4a3 100755 --- a/scripts/bug +++ b/scripts/bug @@ -1,3 +1,2 @@ -#!/bin/bash - +#!/bin/sh exec gh issue create --label bug --title "$*" diff --git a/scripts/buildadoc b/scripts/buildadoc index 970b001..f3072a0 100755 --- a/scripts/buildadoc +++ b/scripts/buildadoc @@ -31,6 +31,7 @@ qx{ asciidoctor \\ ./docs/index.adoc }; +# HTML without table of contents qx{ asciidoctor \\ -D docs \\ -a date="$date" \\ @@ -74,9 +75,3 @@ qx{ asciidoctor-epub3 \\ -o "$parent-$name.epub" \\ ./docs/index.adoc }; - -__END__ - -=head1 NAME - -buildadoc - build AsciiDoc with rwxrob preferences diff --git a/scripts/bullets b/scripts/bullets index e8e9c7a..83feff5 100755 --- a/scripts/bullets +++ b/scripts/bullets @@ -1,3 +1,2 @@ -#!/bin/sh -exec pae '$_=join " β€’ ", @F' - +#!/usr/bin/perl -pa +$_ = join " β€’ ", @F diff --git a/scripts/duck b/scripts/duck index 6577feb..00db32f 100755 --- a/scripts/duck +++ b/scripts/duck @@ -2,7 +2,7 @@ #exec w3m "duckduckgo.com/lite?kd=-1&kp=-1&q=$*" tmux rename-window "$*" url="https://lite.duckduckgo.com/lite?kd=-1&kp=-1&q=$(urlencode "$*")" # πŸ¦† -#chat "πŸ¦† searching: $* $url" +wee "πŸ¦† searching: $* $url" exec lynx "$url" #exec w3m "$url" #exec lynx "duckduckgo.com/lite?q=$*" # πŸ¦† diff --git a/scripts/ppie b/scripts/ppie index 3b4c638..dfa2766 100755 --- a/scripts/ppie +++ b/scripts/ppie @@ -1,2 +1,2 @@ #!/bin/sh -exec perl -pi -e "$@" +exec perl -pi -E "$@" diff --git a/scripts/watchcow b/scripts/watchcow index 8f13d6e..31c4faf 100755 --- a/scripts/watchcow +++ b/scripts/watchcow @@ -28,7 +28,7 @@ while (1) { if ( $pid == 0 ) { print $curoff. $clear . $top; exec -"fortune -s | cowsay -W 50 -f '$ENV{REPOS}/github.com/rwxrob/dot/config/cowsay/default.cow' | indent 15 | lolcat -ft | cat" +"fortune $ENV{REPOS}/github.com/rwxrob/dot/fortunes/mrrobot | cowsay -W 50 -f '$ENV{REPOS}/github.com/rwxrob/dot/config/cowsay/default.cow' | indent 15 | lolcat -ft | cat" or die "Failed to exec cowsay"; } else { From fa80d66f7dfb512a90f911ce01d254d7d41df01b Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Tue, 7 Jan 2025 09:38:28 -0500 Subject: [PATCH 32/78] save --- scripts/README.md | 11 +++++------ scripts/{back => afk} | 0 scripts/batc | 2 ++ scripts/calendar | 2 -- scripts/cast | 2 -- scripts/catc | 2 -- scripts/catscript | 2 -- scripts/cdpath | 5 +++-- scripts/trimfirst | 3 +++ scripts/trimlast | 2 ++ 10 files changed, 15 insertions(+), 16 deletions(-) rename scripts/{back => afk} (100%) create mode 100755 scripts/batc delete mode 100755 scripts/calendar delete mode 100755 scripts/cast delete mode 100755 scripts/catc delete mode 100755 scripts/catscript create mode 100755 scripts/trimfirst create mode 100755 scripts/trimlast diff --git a/scripts/README.md b/scripts/README.md index 145a755..381f350 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -14,17 +14,14 @@ |[bannerneo](bannerneo)| Banner with `neo` in TMUX pane |[bannerwatchcow](bannerwatchcow)| Banner with `watchcow` in TMUX pane |[battery](battery)| Print battery usage on Linux or macOS +|[batc](batc)| Find command in PATH and send to `bat` |[blog](blog)| Create a new adoc blog post in `./docs/` |[bug](bug)| Create new GitHub bug issue with `gh` |[build](build)| Call `./build` if found or `buildadoc` if `./docs/` |[buildadoc](buildadoc)| Build adoc stuff in `.` or `./docs/` |[bullets](bullets)| Joins all fields of line with bullets -|[cal](cal)| Description -|[calendar](calendar)| Description -|[cast](cast)| Description -|[catc](catc)| Description -|[catscript](catscript)| Description -|[cdpath](cdpath)| Description +|[cal](cal)| Three month calendar with current date +|[cdpath](cdpath)| Prints the `CDPATH` one per line |[changed](changed)| Description |[cheat](cheat)| Description |[checkurls](checkurls)| Description @@ -299,6 +296,8 @@ |[topics](topics)| Description |[tot](tot)| Description |[trapterm](trapterm)| Description +|[trimfirst](trimfirst)| Remove first line of all files given as arguments +|[trimlast](trimlast)| Remove last line of all files given as arguments |[twitch-formats](twitch-formats)| Description |[twitch-mock-app-token](twitch-mock-app-token)| Description |[twitch-mock-clientid](twitch-mock-clientid)| Description diff --git a/scripts/back b/scripts/afk similarity index 100% rename from scripts/back rename to scripts/afk diff --git a/scripts/batc b/scripts/batc new file mode 100755 index 0000000..61ea518 --- /dev/null +++ b/scripts/batc @@ -0,0 +1,2 @@ +#!/bin/sh +exec bat $(which "$1") diff --git a/scripts/calendar b/scripts/calendar deleted file mode 100755 index 5aef7db..0000000 --- a/scripts/calendar +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -zet edit 20220112151926 diff --git a/scripts/cast b/scripts/cast deleted file mode 100755 index cc1854f..0000000 --- a/scripts/cast +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -exec zet cast.start "$@" diff --git a/scripts/catc b/scripts/catc deleted file mode 100755 index 3170308..0000000 --- a/scripts/catc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec cat $(which "$1") diff --git a/scripts/catscript b/scripts/catscript deleted file mode 100755 index d17c7b6..0000000 --- a/scripts/catscript +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -cat $(which "$1") diff --git a/scripts/cdpath b/scripts/cdpath index b3e2f78..2b95fbc 100755 --- a/scripts/cdpath +++ b/scripts/cdpath @@ -1,2 +1,3 @@ -#!/usr/bin/env bash -echo -e "${CDPATH//:/\\n}" +#!/usr/bin/perl +use v5.10; +map { say } split( /:/, $ENV{CDPATH} ); diff --git a/scripts/trimfirst b/scripts/trimfirst new file mode 100755 index 0000000..333d90f --- /dev/null +++ b/scripts/trimfirst @@ -0,0 +1,3 @@ +#!/usr/bin/env perl -i -n +print unless $. == 1; +close ARGV if eof; diff --git a/scripts/trimlast b/scripts/trimlast new file mode 100755 index 0000000..d4c9dc3 --- /dev/null +++ b/scripts/trimlast @@ -0,0 +1,2 @@ +#!/usr/bin/env perl -i -n +print if !eof; From a5b4ad3aa591e4a530e054600fa7aa018b49606b Mon Sep 17 00:00:00 2001 From: Rob Muhlestein Date: Wed, 8 Jan 2025 13:06:17 -0500 Subject: [PATCH 33/78] a bunch more fixes and cleanup --- .bashrc | 4 +- scripts/README.md | 19 ++++---- scripts/termcolors | 52 --------------------- scripts/termstuff | 77 ++++++++++++++++++++++++++++++++ scripts/twitch-channel | 5 +++ scripts/twitch-current | 5 +++ scripts/twitch-formats | 15 ------- scripts/twitch-games | 5 +++ scripts/twitch-id | 5 +++ scripts/twitch-mock-app-token | 4 +- scripts/twitch-mock-clientid | 2 +- scripts/twitch-mock-clientsecret | 2 +- scripts/twitch-mock-users-logins | 11 ++--- scripts/twitch-transcoding | 5 +++ scripts/twitch-user | 5 +++ scripts/twitch-view | 44 +++--------------- scripts/twitch.sh | 8 ---- scripts/twitchcat | 8 ---- scripts/twitchcat2yaml | 7 --- scripts/watchcow | 3 +- 20 files changed, 133 insertions(+), 153 deletions(-) delete mode 100755 scripts/termcolors create mode 100755 scripts/termstuff create mode 100755 scripts/twitch-channel create mode 100755 scripts/twitch-current delete mode 100755 scripts/twitch-formats create mode 100755 scripts/twitch-games create mode 100755 scripts/twitch-id create mode 100755 scripts/twitch-transcoding create mode 100755 scripts/twitch-user delete mode 100755 scripts/twitchcat delete mode 100755 scripts/twitchcat2yaml diff --git a/.bashrc b/.bashrc index f6c17b2..97fab63 100644 --- a/.bashrc +++ b/.bashrc @@ -280,6 +280,8 @@ alias gptags="git push origin --tags" alias km="kimono" alias s=wee alias cur="vi ~/.currently" +alias het_tanis="twitch-view het_tanis" +alias prime="twitch-view theprimeagen" set-editor() { export EDITOR="$1" @@ -406,5 +408,3 @@ export NVM_DIR="$HOME/.nvm" export NAME=Rob export PATH=$PATH:/Users/rwxrob/Repos/github.com/rwxrob/lab-sample - -fortune "$REPOS/github.com/rwxrob/dot/fortunes/mrrobot" | cowsay -W 50 -f "$REPOS/github.com/rwxrob/dot/config/cowsay/default.cow" | indent 15 | lolcat -ft diff --git a/scripts/README.md b/scripts/README.md index 381f350..695e029 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -279,7 +279,7 @@ |[tbanner](tbanner)| Description |[tclip](tclip)| Description |[telln](telln)| Description -|[termcolors](termcolors)| Description +|[termstuff](termstuff)| Dump variables for terminal ANSI escapes |[tf](tf)| Description |[tmatrix](tmatrix)| Description |[tmuxin](tmuxin)| Description @@ -298,17 +298,16 @@ |[trapterm](trapterm)| Description |[trimfirst](trimfirst)| Remove first line of all files given as arguments |[trimlast](trimlast)| Remove last line of all files given as arguments -|[twitch-formats](twitch-formats)| Description -|[twitch-mock-app-token](twitch-mock-app-token)| Description -|[twitch-mock-clientid](twitch-mock-clientid)| Description -|[twitch-mock-clientsecret](twitch-mock-clientsecret)| Description -|[twitch-mock-users-logins](twitch-mock-users-logins)| Description -|[twitch-view](twitch-view)| Description +|[twitch-mock-app-token](twitch-mock-app-token)| Fetch an app token from running twitch mock API server +|[twitch-mock-clientid](twitch-mock-clientid)| Fetch a client ID from running twitch mock API server +|[twitch-mock-clientsecret](twitch-mock-clientsecret)| Fetch a client secret from running twitch mock API server +|[twitch-mock-users-logins](twitch-mock-users-logins)| Fetch list of all users on mock API server +|[twitch-transcoding](twitch-transcoding)| List all the transcoding options for a Twitch channel +|[twitch-view](twitch-view)| Watch Twitch without web browser +|[twitch-games](twitch-games)| List top COUNT (100) categories on Twitch |[twitch.sh](twitch.sh)| Description -|[twitchcat](twitchcat)| Description -|[twitchcat2yaml](twitchcat2yaml)| Description |[twitter](twitter)| Description -|[txt](txt)| Description +|[txt](txt)| Render standard input Markdown as plain text with pandoc |[uidof](uidof)| Description |[underconstruction](underconstruction)| Description |[untag](untag)| Description diff --git a/scripts/termcolors b/scripts/termcolors deleted file mode 100755 index 3b7b3b8..0000000 --- a/scripts/termcolors +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Prints the terminal theme regular colors (and some other escapes). For -# "bright/bold" variation add 1; in front of the number. Useful for -# sampling and remembering the escapes when hardcoding them into scripts -# for portability. Keep in mind that the color names are those given for -# the original color terminal and obviously can vary widely. For color -# intensive output consider shortening the names to their first letter -# instead and don't forget to wrap them within ${}. Omits (and overrides -# any inherited) colors when not interactive/piped. - -case "$1" in - -shell) - cat <