diff --git a/.bashrc b/.bashrc index 25380221..6c52ed58 100644 --- a/.bashrc +++ b/.bashrc @@ -6,16 +6,32 @@ 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; } -_source_if() { [[ -r "$1" ]] && source "$1"; } +_source_if() { [[ -r "$2" ]] && source "$1"; } # ----------------------- environment variables ---------------------- export LANG=en_US.UTF-8 export USER="${USER:-$(whoami)}" export GITUSER="$USER" +export TWITCH_BROADCASTER_ID=447179030 export TZ=America/New_York export REPOS="$HOME/Repos" export GHREPOS="$REPOS/github.com/$GITUSER" @@ -39,7 +55,6 @@ export CLIP_VOLUME=0 export CLIP_SCREEN=0 export CLICOLOR=1 export HRULEWIDTH=73 -export GOPATH="$HOME/.local/go" export GOBIN="$HOME/.local/bin" export GOPROXY=direct export NVIM_SCREENKEY=1 @@ -47,6 +62,12 @@ 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 + +# explicit to fix wierd defaults (like macOS) +export XDG_STATE_HOME="$HOME/.local/state" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_CONFIG_HOME="$HOME/.config" # 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" @@ -59,13 +80,11 @@ export LESS_TERMCAP_se=$'\e[0m' # end standout export LESS_TERMCAP_us=$'\e[4m' # start underline export LESS_TERMCAP_ue=$'\e[0m' # end underline -export ANSIBLE_CONFIG="$HOME/.config/ansible/config.ini" -export ANSIBLE_INVENTORY="$HOME/.config/ansible/inventory.yaml" +export ANSIBLE_CONFIG="$GHREPOS/homelab/ansible.cfg" +export ANSIBLE_INVENTORY="$GHREPOS/homelab/inventory.yaml" export ANSIBLE_LOAD_CALLBACK_PLUGINS=1 #export ANSIBLE_STDOUT_CALLBACK=json -export K8SAPP_CLUSTER=dev - [[ -d /.vim/spell ]] && export VIMSPELL=("$HOME/.vim/spell/*.add") # ----------------------------- PostgreSQL ---------------------------- @@ -210,6 +229,8 @@ __ps1() { PS1="$short" fi + [[ "${VENVS[$PWD]}" =~ ^y ]] && PS1="${PS1//\$/🐍}" + if _have tmux && [[ -n "$TMUX" ]]; then tmux rename-window "$(wd)" fi @@ -222,7 +243,26 @@ wd() { echo "$parent/$dir" } && export wd -PROMPT_COMMAND="__ps1" +found-venv() { test -e .venv/bin/activate; } +venv-is-on() { [[ "$(which python)" =~ \.venv\/bin\/python$ ]]; } + +declare -A VENVS +export VENVS + +llvenv() { + found-venv || return + venv-is-on && return + test -n "${VENVS[$PWD]}" && return + read -rp "Want to activate the .venv? [Y/n]" answer + answer=${answer,,} + test -z "$answer" && answer=y + VENVS["$PWD"]="$answer" + if [[ $answer =~ ^y ]]; then + . .venv/bin/activate + fi +} + +PROMPT_COMMAND="llvenv; __ps1" # ----------------------------- keyboard ----------------------------- @@ -236,16 +276,17 @@ _have setxkbmap && test -n "$DISPLAY" && unalias -a alias todo='vi ~/.todo' +alias tree='tree -a -I .git' alias ip='ip -c' alias '?'=gpt alias '??'=duck alias '???'=google +alias '????'=bing alias dot='cd $DOTFILES' alias scripts='cd $SCRIPTS' alias snippets='cd $SNIPPETS' alias ls='ls -h --color=auto' alias free='free -h' -alias tree='tree -a' alias df='df -h' alias chmox='chmod +x' alias diff='diff --color' @@ -256,13 +297,22 @@ 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" alias km="kimono" alias s=wee +alias x=clip +alias t=topic +alias chan=twitch-channel +alias status=twitch-status +alias lurk=twitch-view alias cur="vi ~/.currently" +alias contexts="kubectl config get-contexts" +alias reload='exec $SHELL -l' +alias python=python3 +alias pip=pip3 set-editor() { export EDITOR="$1" @@ -271,7 +321,7 @@ set-editor() { export GIT_EDITOR="$1" alias vi="\$EDITOR" } -_have "vim" && set-editor vi +_have "vim" && set-editor vim _have "nvim" && set-editor nvim # ----------------------------- functions ---------------------------- @@ -349,6 +399,7 @@ _have goreleaser && . <(goreleaser completion bash 2>/dev/null) _have klogin && . <(klogin completion bash 2>/dev/null) _have pandoc && . <(pandoc --bash-completion) _have kubectl && . <(kubectl completion bash 2>/dev/null) +_have kubectl && . <(kubectl cnpg completion bash 2>/dev/null) _have kubeadm && . <(kubeadm completion bash 2>/dev/null) _have k && complete -o default -F __start_kubectl k _have istioctl && . <(istioctl completion bash 2>/dev/null) @@ -360,16 +411,18 @@ _have conftest && . <(conftest completion bash) _have yq && . <(yq completion bash) _have mk && complete -o default -F __start_minikube mk _have podman && _source_if "$HOME/.local/share/podman/completion" # d - -_have ansible && . <(register-python-argcomplete3 ansible) -_have ansible-config && . <(register-python-argcomplete3 ansible-config) -_have ansible-console && . <(register-python-argcomplete3 ansible-console) -_have ansible-doc && . <(register-python-argcomplete3 ansible-doc) -_have ansible-galaxy && . <(register-python-argcomplete3 ansible-galaxy) -_have ansible-inventory && . <(register-python-argcomplete3 ansible-inventory) -_have ansible-playbook && . <(register-python-argcomplete3 ansible-playbook) -_have ansible-pull && . <(register-python-argcomplete3 ansible-pull) -_have ansible-vault && . <(register-python-argcomplete3 ansible-vault) +_have mkdocs && . <(_MKDOCS_COMPLETE=bash_source mkdocs) +_have kuti && . <(kuti completion bash) + +_have ansible && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible) +_have ansible-config && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-config) +_have ansible-console && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-console) +_have ansible-doc && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-doc) +_have ansible-galaxy && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-galaxy) +_have ansible-inventory && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-inventory) +_have ansible-playbook && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-playbook) +_have ansible-pull && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-pull) +_have ansible-vault && _have register-python-argcomplete3 && . <(register-python-argcomplete3 ansible-vault) #_have ssh-agent && test -z "$SSH_AGENT_PID" && . <(ssh-agent) # -------------------- personalized configuration -------------------- diff --git a/.wezterm.lua b/.wezterm.lua index 6207988a..47d8139a 100644 --- a/.wezterm.lua +++ b/.wezterm.lua @@ -1,22 +1,25 @@ -local wezterm = require("wezterm") +local wezterm = require 'wezterm' return { + audible_bell = "Disabled", window_close_confirmation = 'NeverPrompt', default_prog = {'/opt/homebrew/bin/bash','--login'}, color_scheme = 'Gruvbox Material (Gogh)', font = wezterm.font('UbuntuMono Nerd Font'), - font_size = 34, + font_size = 35.2, +send_composed_key_when_left_alt_is_pressed = true, +send_composed_key_when_right_alt_is_pressed = true, colors = { cursor_bg = '#928374', cursor_border = '#928374', }, term = "xterm-256color", - window_decorations = "RESIZE", +-- window_decorations = "RESIZE", hide_tab_bar_if_only_one_tab = true, window_padding = { - left = 40, + left = 10, right = 0, - top = 50, - bottom = 0, + top = 0, + bottom = 10, }, } diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..5ea61b98 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,10 @@ +# Agent Instructions + +## General + +- Automatically update this AGENTS.md file when new preferences, conventions, or context are established for this repo + +## Commits + +- Never add `Co-authored-by: Copilot` or any Copilot trailer to commits +- Never add any AI co-authorship trailers to commit messages diff --git a/DCO b/DCO deleted file mode 100644 index 36fe7b6c..00000000 --- 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 d7ef5ec4..1f4edeec 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,44 @@ -# Dotfiles, scripts, and stuff +# Unix/Linux dotfiles, scripts, and stuff -*You probably want [`dot-template`](https://github.com/rwxrob/dot-template) instead.* +> [!TIP] +> You are probably looking for the minimal stuff I have installed into the [Beginner Boost](https://github.com/rwxrob/boost) container 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) +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. -## Legal +## Operating system preference -Copyright 2024 Robert S. Muhlestein () -SPDX-License-Identifier: Apache-2.0 +Everything in this repo will work on any Unix or Linux system once the dependencies are satisfied. As for host workstation operating systems I personally prefer the following in order: -This license makes you safe to use anything in here pretty much anywhere—including at work. But you do it at your own peril. +1. macOS (Unix) +2. WSL2 with `wslu` (Linux) +3. Linux Mint Cinnamon + +Note that much of this repo content will also work with Git-Bash, Cygwin, and MinGW but not all. + +## Check core dependencies + +Run the `check-workstation-deps` script to check if the current system has everything required before running any `install-*` script: + +- `/bin/sh` (POSIX 2018, no `ksh`-isms) +- `/usr/bin/perl` (v5.26 which modern `git` depends on) +- `git` +- `curl` +- `uname` + +Note that `perl`—required for any `git` install—is used more efficiently and powerfully than any of the usual handicapped alternatives: `sed`, `awk`, `grep`, `head`, `tail`, `cut`, `tr`, etc. + +In true Unix fashion, many of the `scripts` depend on one another and most depend on everything in `install-all` to have been installed. + +## Install into ~/.local + +This repo is designed to work on both a cozy personal workstation as well as a multi-user system. In the later case it can never be assumed that I have access or the desire to install many of these tools or their dependencies for every user on the system. Plus there is the complication of choosing any of several different package managers. Instead, all `install-*` scripts install from the latest official release directly into `~/.local/` usually by way of `gh release download` or `go install`. + +## Scripts over functions and aliases + +Even a one-line script works anywhere: as a Vim filter, pipeline text transformation, and interactive command. _Functions cannot be called universally from other executables._ In fact, the _only_ time a function should ever be used is when the state of the current shell needs to change, such as changing the current working directory (see `clone` function). + +Aliases are nice to same typing on the command line, but that is the only place they should ever be used. Very often an alias is better as a one-line script. + +## More info + +Check out my [FAQ](https://github.com/rwxrob/faq) for more answers about my work style, preferences, and dependencies. diff --git a/config/cowsay/default.cow b/config/cowsay/default.cow new file mode 100644 index 00000000..ad660764 --- /dev/null +++ b/config/cowsay/default.cow @@ -0,0 +1,7 @@ +$the_cow = <<"EOC"; + $thoughts ^__^ + $thoughts 👁️👁️\\_______ + (__)\\ )\\/\\ + $tongue ||----w | + || || +EOC diff --git a/fortunes/combined b/fortunes/combined new file mode 100644 index 00000000..5dde2f77 --- /dev/null +++ b/fortunes/combined @@ -0,0 +1,122 @@ +When you see a good move, look for a better one. — Elliot, Mr. Robot +% +Control is an illusion. — Mr. Robot, Mr. Robot +% +I wanted to save the world. But I couldn't even save myself. — Elliot, Mr. Robot +% +You have to know when to let go. — Mr. Robot, Mr. Robot +% +Sometimes the only way to truly protect someone is to stay away. — Elliot, Mr. Robot +% +The world’s not coming to an end, my friend. It already did. — Leon, Mr. Robot +% +What is reality if not collective delusion? — Mr. Robot, Mr. Robot +% +Power belongs to those who take it. — Mr. Robot, Mr. Robot +% +Every choice you make has a consequence. — Mr. Robot, Mr. Robot +% +We're all living in each other's paranoia. — Elliot, Mr. Robot +% +You ever think about why we’re here? — Leon, Mr. Robot +% +The best way to deal with fear is to face it. — Elliot, Mr. Robot +% +You don’t fix a problem by pretending it doesn’t exist. — Mr. Robot, Mr. Robot +% +We’re all code. Some of us are just written better than others. — Mr. Robot, Mr. Robot +% +It’s not the plan that fails. It’s the execution. — Mr. Robot, Mr. Robot +% +I am not the hero of this story. — Elliot, Mr. Robot +% +Pain is a part of the process. — Mr. Robot, Mr. Robot +% +You're afraid. That's good. Fear means you're alive. — Mr. Robot, Mr. Robot +% +I can’t change the past. But I can change the future. — Elliot, Mr. Robot +% +No matter how much we think we're in control, we're not. — Mr. Robot, Mr. Robot +% +I’m not saying I’m normal. I’m saying I’m not crazy. — Elliot, Mr. Robot +% +The greatest illusion of this world is the illusion of control. — Mr. Robot, Mr. Robot +% +This isn't a revolution. It's a revelation. — Mr. Robot, Mr. Robot +% +I am a leaf on the wind. Watch how I soar. — Wash, Firefly +% +You can’t take the sky from me. — Mal, Firefly +% +We’re not gonna die. We can’t die. You know why? Because we are so very pretty. — Mal, Firefly +% +I aim to misbehave. — Mal, Serenity +% +If you can't do something smart, do something right. — Jayne, Firefly +% +I am not afraid of you. — River, Serenity +% +You know what the chain of command is? It's the chain I go get and beat you with until you understand who's in command. — Jayne, Firefly +% +You don’t fix faith. It fixes you. — Shepherd Book, Firefly +% +I don't care what you believe in, just believe in it. — Shepherd Book, Serenity +% +I don’t murder children. I don’t take innocent lives. — Mal, Serenity +% +Love. You can know all the math in the 'verse, but take a boat in the air you don't love, she'll shake you off just as sure as the turnin' of worlds. — Mal, Serenity +% +You ever sailed in a Firefly? — Mal, Firefly +% +There's no place I can be since I found Serenity. — Mal, Serenity +% +I’m a leaf on the wind. Watch me—oh God. — Wash, Serenity +% +We have done the impossible, and that makes us mighty. — Mal, Firefly +% +I swear by my pretty floral bonnet, I will end you. — Mal, Firefly +% +You are very much lacking in imagination. — River, Serenity +% +The important thing is the stories. — Shepherd Book, Serenity +% +Do you know what your sin is? It's pride. — The Operative, Serenity +% +This is what I do, darling. This is what I’m good at. — Inara, Firefly +% +If your hand touches metal, I swear by my pretty floral bonnet, I will end you. — Mal, Firefly +% +They tell you: never hit a man with a closed fist. But it is, on occasion, hilarious. — Mal, Firefly +% +You can't stop the signal. — Mr. Universe, Serenity +% +We're all just floating. — River, Serenity +% +I don't believe in fairytales. — The Operative, Serenity +% +The world is a dangerous place. Not because of those who do evil, but because of those who look on and do nothing. — Leon, Mr. Robot +% +You gotta play the hand you're dealt. Life ain't fair. Never has been. — Terry Colby, Mr. Robot +% +There are no heroes. No villains. Just people with agendas. — Mr. Robot, Mr. Robot +% +This isn’t chaos. This is the new order. — Mr. Robot, Mr. Robot +% +What we fight for isn’t always what we believe in. — Mr. Robot, Mr. Robot +% +Never underestimate the power of stupid people in large groups. — Mr. Robot, Mr. Robot +% +It’s not about saving the world. It’s about making a difference. — Elliot, Mr. Robot +% +If you can’t walk, you crawl. And if you can’t crawl, you find someone to carry you. — Zoe, Firefly +% +I look out for me and mine. That don’t include you unless I conjure it does. — Mal, Firefly +% +When you can't run, you crawl, and when you can't crawl, you find someone to carry you. — Firefly +% +You can’t stop the signal, Mal. Everything goes somewhere, and I go everywhere. — Mr. Universe, Serenity +% +No more running. I aim to misbehave. — Mal, Serenity +% +Ain’t all buttons and charts, little albatross. Know what the first rule of flying is? Love. — Mal, Serenity +% diff --git a/fortunes/combined.dat b/fortunes/combined.dat new file mode 100644 index 00000000..52a50354 Binary files /dev/null and b/fortunes/combined.dat differ diff --git a/fortunes/mainstream b/fortunes/mainstream new file mode 100644 index 00000000..9ac3f0db --- /dev/null +++ b/fortunes/mainstream @@ -0,0 +1,126 @@ +The best way to predict the future is to invent it. — Alan Kay +% +It does not matter how slowly you go as long as you do not stop. — Confucius +% +Do not fear failure but rather fear not trying. — Roy T. Bennett +% +In the middle of every difficulty lies opportunity. — Albert Einstein +% +Believe you can and you're halfway there. — Theodore Roosevelt +% +Stay hungry, stay foolish. — Steve Jobs +% +The only limit to our realization of tomorrow is our doubts of today. — Franklin D. Roosevelt +% +Success is not final, failure is not fatal: It is the courage to continue that counts. — Winston Churchill +% +Your time is limited, so don’t waste it living someone else’s life. — Steve Jobs +% +Hardships often prepare ordinary people for an extraordinary destiny. — C.S. Lewis +% +If you want to lift yourself up, lift up someone else. — Booker T. Washington +% +Do what you can, with what you have, where you are. — Theodore Roosevelt +% +I have not failed. I've just found 10,000 ways that won't work. — Thomas A. Edison +% +Courage is resistance to fear, mastery of fear, not absence of fear. — Mark Twain +% +Happiness is not something ready made. It comes from your own actions. — Dalai Lama +% +Act as if what you do makes a difference. It does. — William James +% +The way to get started is to quit talking and begin doing. — Walt Disney +% +A journey of a thousand miles begins with a single step. — Lao Tzu +% +It’s not whether you get knocked down, it’s whether you get up. — Vince Lombardi +% +Dream big and dare to fail. — Norman Vaughan +% +Innovation distinguishes between a leader and a follower. — Steve Jobs +% +You miss 100% of the shots you don’t take. — Wayne Gretzky +% +The only way to do great work is to love what you do. — Steve Jobs +% +Strive not to be a success, but rather to be of value. — Albert Einstein +% +Nothing in life is to be feared, it is only to be understood. — Marie Curie +% +It always seems impossible until it’s done. — Nelson Mandela +% +Whatever the mind can conceive and believe, it can achieve. — Napoleon Hill +% +Fall seven times and stand up eight. — Japanese Proverb +% +To succeed in life, you need two things: ignorance and confidence. — Mark Twain +% +Be yourself; everyone else is already taken. — Oscar Wilde +% +Success usually comes to those who are too busy to be looking for it. — Henry David Thoreau +% +Don’t let yesterday take up too much of today. — Will Rogers +% +Life is what happens when you're busy making other plans. — John Lennon +% +You only live once, but if you do it right, once is enough. — Mae West +% +To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment. — Ralph Waldo Emerson +% +Keep your face always toward the sunshine—and shadows will fall behind you. — Walt Whitman +% +There is only one way to avoid criticism: do nothing, say nothing, and be nothing. — Aristotle +% +He who has a why to live can bear almost any how. — Friedrich Nietzsche +% +Start where you are. Use what you have. Do what you can. — Arthur Ashe +% +Go confidently in the direction of your dreams. Live the life you have imagined. — Henry David Thoreau +% +Life isn’t about finding yourself. It’s about creating yourself. — George Bernard Shaw +% +What lies behind us and what lies before us are tiny matters compared to what lies within us. — Ralph Waldo Emerson +% +It is during our darkest moments that we must focus to see the light. — Aristotle Onassis +% +We may encounter many defeats, but we must not be defeated. — Maya Angelou +% +Opportunities don't happen. You create them. — Chris Grosser +% +Don't cry because it's over, smile because it happened. — Dr. Seuss +% +Be the change that you wish to see in the world. — Mahatma Gandhi +% +The only impossible journey is the one you never begin. — Tony Robbins +% +Happiness is not by chance, but by choice. — Jim Rohn +% +Life is short, and it is up to you to make it sweet. — Sarah Louise Delany +% +Do not wait for the perfect moment. Take the moment and make it perfect. — Unknown +% +Don’t count the days, make the days count. — Muhammad Ali +% +Challenges are what make life interesting, and overcoming them is what makes life meaningful. — Joshua J. Marine +% +Every moment is a fresh beginning. — T.S. Eliot +% +Be a voice, not an echo. — Albert Einstein +% +Wisely, and slow. They stumble that run fast. — William Shakespeare +% +Don’t let what you cannot do interfere with what you can do. — John Wooden +% +Great things are done by a series of small things brought together. — Vincent Van Gogh +% +It’s not what we have in life, but who we have in our life that matters. — Unknown +% +Turn your wounds into wisdom. — Oprah Winfrey +% +Believe in yourself and all that you are. — Christian D. Larson +% +Everything you’ve ever wanted is on the other side of fear. — George Addair +% +Success doesn’t just find you. You have to go out and get it. — Unknown +% diff --git a/fortunes/mainstream.dat b/fortunes/mainstream.dat new file mode 100644 index 00000000..f95f1c76 Binary files /dev/null and b/fortunes/mainstream.dat differ diff --git a/fortunes/mrrobot b/fortunes/mrrobot new file mode 100644 index 00000000..127b4117 --- /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 00000000..668b1051 Binary files /dev/null and b/fortunes/mrrobot.dat differ diff --git a/go.mod b/go.mod deleted file mode 100644 index 41420d01..00000000 --- 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 6ac79ab5..00000000 --- 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 4567d9db..00000000 --- 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 8c85bc70..00000000 --- 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/install/redhat/install-gh b/install/redhat/install-gh new file mode 100755 index 00000000..aa48ce9c --- /dev/null +++ b/install/redhat/install-gh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +echo "🔧 Installing GitHub CLI (gh)..." + +# Ensure dnf plugins are installed +sudo dnf install -y 'dnf-command(config-manager)' >/dev/null + +# Add the official GitHub CLI repo +sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo + +# Install gh +sudo dnf install -y gh + +echo "✅ GitHub CLI installed." +gh --version diff --git a/obs/presenter-small b/obs/presenter-small new file mode 100755 index 00000000..1228cf03 --- /dev/null +++ b/obs/presenter-small @@ -0,0 +1,11 @@ +#!/bin/sh +osascript <<'EOF' +tell application "System Events" + tell process "ControlCenter" + click first menu bar item of menu bar 1 whose description is "Audio and Video Controls" + end tell +end tell +EOF +menu bar item 8 of menu bar 1 of application process ControlCenter +#cliclick c:1432,340 +cliclick c:1345,338 diff --git a/obs/some.app b/obs/some.app new file mode 100644 index 00000000..805e9fba --- /dev/null +++ b/obs/some.app @@ -0,0 +1 @@ +do shell script "/opt/homebrew/bin/mpv --fs --ontop --force-window=immediate '/Users/rwxrob/Movies/clips/02NQ3Mi-aOs' >/dev/null 2>&1 &" diff --git a/scripts/1to10 b/scripts/1to10 deleted file mode 100755 index 6a44cd1c..00000000 --- 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 0ed2f433..c6515723 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/README.md b/scripts/README.md index 57aa0a03..1408fa74 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,32 +1,342 @@ # 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. +|Script|Description| +|-|-| +|[255color](255color)| Print 255 color samples as numbers +|[fields](fields)| Split lines of input into fields (`1..3,5`) +||[afk](afk)| TMUX AFK screen with random banner +|[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 +|[banner](banner)| Colorful text banner in `figlet` futura font +|[bannerfishies](bannerfishies)| Banner with fishies in TMUX pane +|[bannerlights](bannerlights)| Banner with `lights` in TMUX pane +|[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)| Three month calendar with current date +|[cdpath](cdpath)| Prints the `CDPATH` one per line +|[changed](changed)| Print full path to all changed files in directory +|[checkurls](checkurls)| Check for broken URLs in web sites +|[close](close)| Close GitHub issue with `gh` +|[cmdhtitles](cmdhtitles)| Filter to add htitles to Bonzai `*Cmds` +|[colortest](colortest)| Print gradian RGB color test strip +|[comment](comment)| Same as `gh issue comment "$@"` +|[commentthis](commentthis)| Filter to add comment to any function using AI +|[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)| Submit ChatGPT API query through `mods` +|[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)| Add a prefix (default: #) +|[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 +|[slugify](slugify)| Convert arguments or stdin lines to slugs +|[song](song)| Description +|[songnext](songnext)| Description +|[ssection](ssection)| Description +|[sshkey](sshkey)| Description +|[sshspeedtest](sshspeedtest)| Description +|[starting](starting)| Description +|[startvms](startvms)| Description +|[stripesc](stripesc)| Strip all ANSI terminal escape sequences +|[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 +|[termstuff](termstuff)| Dump variables for terminal ANSI escapes +|[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 +|[trimfirst](trimfirst)| Remove first line of all files given as arguments +|[trimlast](trimlast)| Remove last line of all files given as arguments +|[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-channel](twitch-channel)| Return Twitch channel data +|[twitch-current](twitch-current)| Return Twitch current title and category for channel +|[twitch-user](twitch-user)| Return Twitch login user data +|[twitch-id](twitch-id)| Return Twitch broacast_id for a Twitch channel +|[twitch-formats](twitch-formats)| Return available Twitch stream quality formats +|[twitch-channel](twitch-channel)| Return Twitch channel data +|[twitch-view](twitch-view)| View a Twitch channel with mvp +|[txt](txt)| Render standard input Markdown as plain text with pandoc +|[uidof](uidof)| Print owner UID of file +|[untag](untag)| Remove a git tag locally and remotely +|[upre](upre)| Remove a prefix (default: #) +|[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 -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 diff --git a/scripts/_old/compexample b/scripts/_old/compexample deleted file mode 100755 index c039ccfa..00000000 --- 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 fc91e5f5..00000000 --- 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 3215cb10..00000000 --- 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 0e5264b3..00000000 --- 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/afk b/scripts/afk new file mode 100755 index 00000000..e0fbb62f --- /dev/null +++ b/scripts/afk @@ -0,0 +1,10 @@ +#!/usr/bin/perl +use v5.26; +use File::Basename; +my $what = join ' ', @ARGV; +$what ||= 'in a bit'; +`prepend ~/.currently "💤 back $what"`; +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"; diff --git a/scripts/ageof b/scripts/ageof index a0e29132..ff962ce5 100755 --- a/scripts/ageof +++ b/scripts/ageof @@ -1,15 +1,10 @@ -#!/usr/bin/env bash - -# 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 "$@" +#!/bin/sh +# Prints seconds since first argument was last modified (not created) +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/allcow b/scripts/allcow new file mode 100755 index 00000000..17554ce9 --- /dev/null +++ b/scripts/allcow @@ -0,0 +1,43 @@ +#!/usr/bin/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/allfigl b/scripts/allfigl index 8506f930..4a8c71a7 100755 --- a/scripts/allfigl +++ b/scripts/allfigl @@ -1,6 +1,28 @@ -#!/bin/sh -fontsd="$REPOS/github.com/rwxrob/fonts/figlet" -for font in "$fontsd"/*.flf; do - echo "FONT: $font" - figlet -d "$fontsd" -f "${font}" hello -done +#!/usr/bin/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/aln b/scripts/aln deleted file mode 100755 index 84e1455a..00000000 --- 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 88378dab..00000000 --- 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 32312bbb..00000000 --- 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 9f20e0ff..00000000 --- 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 bddb149a..00000000 --- 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/b b/scripts/b deleted file mode 100755 index 97826acb..00000000 --- a/scripts/b +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec ./build "$@" diff --git a/scripts/back b/scripts/back deleted file mode 100755 index 771a5f9d..00000000 --- a/scripts/back +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -what="$*" -if [[ -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/ban b/scripts/ban deleted file mode 100755 index 2b4a6c75..00000000 --- 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/bandit b/scripts/bandit deleted file mode 100755 index d9031d75..00000000 --- a/scripts/bandit +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -#exec w3m https://overthewire.org/wargames/bandit/bandit$1.html -exec lynx https://overthewire.org/wargames/bandit/bandit$1.html diff --git a/scripts/banner b/scripts/banner index 8837e187..b73dca65 100755 --- a/scripts/banner +++ b/scripts/banner @@ -1,21 +1,31 @@ -#!/usr/bin/env bash +#!/usr/bin/perl +use v5.26; +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 = ""; -what="$*" -if [ -z "${what}" ]; then - read -rp "Text: " what -fi +my $what = join ' ', @ARGV; +if ( not $what ) { + print "Text: "; + $what = ; + chomp $what; +} -echo "${clear}" -while true; do - echo "${top}" - figl <<<"$what" | lolcat - echo "${curoff}" - sleep 2 -done +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 bfc9b9de..00000000 --- a/scripts/bannerfish +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -what="$*" -if [ -z "${what}" ]; then - read -r -p "Text: " what -fi -cols=$(tput lines) -tmux split-window \; resize-pane -y $((cols-6)) \; send -t 1 "banner \"$what\"" Enter -sleep 1 -tmux send -t 2 "fishies" Enter diff --git a/scripts/bannerfishies b/scripts/bannerfishies new file mode 100755 index 00000000..17726808 --- /dev/null +++ b/scripts/bannerfishies @@ -0,0 +1,22 @@ +#!/usr/bin/perl +use v5.26; + +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` diff --git a/scripts/bannerlights b/scripts/bannerlights index a425f743..3b612b3e 100755 --- a/scripts/bannerlights +++ b/scripts/bannerlights @@ -1,8 +1,23 @@ -#!/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 +#!/usr/bin/perl +use v5.26; +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` diff --git a/scripts/bannerneo b/scripts/bannerneo index 18cdbeaa..3b612b3e 100755 --- a/scripts/bannerneo +++ b/scripts/bannerneo @@ -1,8 +1,23 @@ -#!/usr/bin/env bash -what="$*" -if [ -z "${what}" ]; then - read -p "Text: " 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 +#!/usr/bin/perl +use v5.26; +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` diff --git a/scripts/bannerwatchcow b/scripts/bannerwatchcow new file mode 100755 index 00000000..3b612b3e --- /dev/null +++ b/scripts/bannerwatchcow @@ -0,0 +1,23 @@ +#!/usr/bin/perl +use v5.26; +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` diff --git a/scripts/bashentrtest b/scripts/bashentrtest deleted file mode 100755 index 2c40295f..00000000 --- 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 9f3a271d..00000000 --- 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/batc b/scripts/batc new file mode 100755 index 00000000..61ea518d --- /dev/null +++ b/scripts/batc @@ -0,0 +1,2 @@ +#!/bin/sh +exec bat $(which "$1") diff --git a/scripts/battery b/scripts/battery index aaa66a76..e3589bd3 100755 --- a/scripts/battery +++ b/scripts/battery @@ -1,3 +1,28 @@ #!/usr/bin/perl -print grep {/state|to\ full|percentage/} - `upower -i /org/freedesktop/UPower/devices/battery_BAT0`; +use v5.26; +my $os = $^O; + +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)."; +} diff --git a/scripts/bing b/scripts/bing deleted file mode 100755 index f5985043..00000000 --- a/scripts/bing +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -url="https://www.bing.com/search?q=$(urlencode "$*")" -chat "$url" -exec lynx "www.bing.com/search?q=$url" - diff --git a/scripts/blankpane b/scripts/blankpane deleted file mode 100755 index 6d861950..00000000 --- a/scripts/blankpane +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -hidecursor -while true; do - clear - sleep 10 -done diff --git a/scripts/blog b/scripts/blog new file mode 100755 index 00000000..eeb09092 --- /dev/null +++ b/scripts/blog @@ -0,0 +1,16 @@ +#!/bin/sh +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 +if [ ! -e docs/"$file" ]; then + printf "= %s\n\n%s\n\n\n" "$*" "$(inow)" >"docs/$file" +fi +exec "$EDITOR" "docs/$file" diff --git a/scripts/bug b/scripts/bug index 997537b3..de7b4a30 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/build b/scripts/build deleted file mode 100755 index 4b9ddeb7..00000000 --- a/scripts/build +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -test -x ./build && exec ./build "$@" -test -r docs/index.adoc && exec buildadoc "$@" diff --git a/scripts/buildadoc b/scripts/buildadoc index 08c2a68c..559b4077 100755 --- a/scripts/buildadoc +++ b/scripts/buildadoc @@ -1,9 +1,11 @@ #!/usr/bin/perl +use v5.26; # 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; @@ -20,6 +22,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" \\ @@ -28,14 +31,30 @@ qx{ asciidoctor \\ ./docs/index.adoc }; +# HTML without table of contents +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" \\ + -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 +$pwd =~ s/\R$//; my ( $parent, $name ) = $pwd =~ m,/([^/]+)/([^/]+)$,m; # PDF 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" \\ @@ -48,6 +67,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" \\ @@ -55,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 e8e9c7a0..83feff57 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/calendar b/scripts/calendar deleted file mode 100755 index 5aef7dbd..00000000 --- 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 cc1854f1..00000000 --- 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 31703082..00000000 --- a/scripts/catc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec cat $(which "$1") diff --git a/scripts/categories b/scripts/categories new file mode 100755 index 00000000..c9bc03ad --- /dev/null +++ b/scripts/categories @@ -0,0 +1,2 @@ +#!/bin/sh +exec vim ~/.config/twitch/categories diff --git a/scripts/catscript b/scripts/catscript deleted file mode 100755 index d17c7b60..00000000 --- a/scripts/catscript +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -cat $(which "$1") diff --git a/scripts/cdpath b/scripts/cdpath index b3e2f78f..2b95fbc3 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/changed b/scripts/changed index a8132359..932aa39b 100755 --- a/scripts/changed +++ b/scripts/changed @@ -1,19 +1,29 @@ -#!/usr/bin/env bash +#!/usr/bin/perl +use v5.26; +use File::Basename; +use Cwd; -## Returns the full path to any changed files in the current directory -## or any subdirectories recursively one to a line. Useful for detecting -## changes and taking action (see onchange). - -changed () { - local dir="${PWD}" - local tmpname="onchange${dir//\//-}" - local tmp="/tmp/${tmpname}" - if [[ ! -e "${tmp}" ]]; then - find "${dir}" -type f -not -path '*testdata*' - else - find "${dir}" -newer "${tmp}" -type f -not -path '*testdata*' - fi - touch "${tmp}" +sub get_file { } -changed "$@" +my $statedir = $ENV{XDG_STATE_HOME} || $ENV{HOME} . '/.local/state'; +$statedir .= '/changed'; +`mkdir -p "$statedir"`; + +my $dir = shift || cwd(); +my $last = $statedir . '/' . `slugify "$dir"`; +chomp($last); + +not -d $dir and die "$dir isn't a directory"; +$dir !~ m,/$, and $dir = $dir . '/'; + +my $out; +if ( not -e "$last" ) { + $out = `find "$dir" -type f -not -path '*testdata*'`; +} +else { + $out = `find "$dir" -newer "$last" -type f -not -path '*testdata*'`; +} +$out =~ s,//,/,g; +print $out; +`touch "$last"`; diff --git a/scripts/chat b/scripts/chat deleted file mode 100755 index 960a3e26..00000000 --- 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/cheat b/scripts/cheat deleted file mode 100755 index 9984e856..00000000 --- a/scripts/cheat +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -cheat() { - where="$1" - if [ $# -ge 1 ]; then - shift - fi - IFS=+ curl -sS "http://cht.sh/$where/ $*" -} - -cheat "$@" - - diff --git a/scripts/checkurls b/scripts/checkurls index 86d9114b..64074c4c 100755 --- a/scripts/checkurls +++ b/scripts/checkurls @@ -1,26 +1,29 @@ -#!/usr/bin/env bash +#!/bin/sh +# shellcheck disable=2059 -declare target="$1" -declare red=$'\033[38;2;255;0;0m' -declare grey=$'\033[38;2;100;100;100m' -declare green=$'\033[38;2;0;255;0m' -declare x=$'\033[0m' +target="$1" +red="\033[38;2;255;0;0m" +grey="\033[38;2;100;100;100m" +green="\033[38;2;0;255;0m" +x="\033[0m" -if [[ -z "$(which muffet)" ]]; then - echo "${red}Requires ${grey}https://github.com/raviqqe/muffet ${red}be installed.${x}" - exit 1 -fi - -if [[ -z "$target" ]]; then - echo "usage: checkurls " - exit 1 +if ! command -v muffet; then + printf "${red}Requires ${grey}https://github.com/raviqqe/muffet$x\n" + exit 1 fi -if [[ ${1:0:4} != http ]]; then - target="http://$1" +if test -z "$target"; then + echo "usage: checkurls " + exit 1 fi -muffet --one-page-only "$target" -if [[ $? -eq 0 ]];then - echo "${green}No Broken URLs detected.${x}" +if test "$(printf "%.4s" "$1")" != http; then + target="http://$1" fi + +muffet \ + --one-page-only "$target" \ + --buffer-size=16384 \ + --timeout=45 \ + --max-connections=10 && + printf "${green}No Broken URLs detected.$x\n" diff --git a/scripts/chsuffix b/scripts/chsuffix deleted file mode 100755 index 9fc31098..00000000 --- a/scripts/chsuffix +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -# Changes the suffixes from the first argument to the second argument for -# all files specified after that as arguments. Use globstar expansion to -# recurse. - -chsuffix () -{ - declare i - declare from="$1" - shift - declare to="$1" - shift - declare files=("$@") - if [[ -z "$files" ]]; then - usageln 'chsuffix ...' - return 1 - fi - for i in "${files[@]}" - do - if [[ "$i" =~ $from$ ]]; then - declare stripped=${i%$from} - telln "Moving $i"'` -> `'"$stripped$to" - mv "$i" "$stripped$to" - fi - done -} - -chsuffix $* diff --git a/scripts/cl b/scripts/cl deleted file mode 100755 index 1480e171..00000000 --- a/scripts/cl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec wee /buffer clear diff --git a/scripts/clip b/scripts/clip deleted file mode 100755 index 210fe0ff..00000000 --- a/scripts/clip +++ /dev/null @@ -1,313 +0,0 @@ -#!/usr/bin/env bash -# shellcheck disable=SC2016 -set -e - -# Copyright 2021 Rob Muhlestein -# Released under Apache-2.0 License -# Please mention https://youtube.com/rwxrob - -: "${CLIP_DATA:="$HOME/.config/clip/data"}" -: "${CLIP_DIR:="$HOME/Movies/clips"}" -: "${CLIP_SCREEN:=2}" -: "${CLIP_VOLUME:=-50}" -: "${PAGER:=more}" -: "${EDITOR:=vi}" -: "${HELP_BROWSER:=}" - -EXE="${0##*/}" - -declare -A help - -help[main]=' -The `clip` utility (a bash script) is for downloading managing and -playing clips from videos in full screen from the command line. - -## Dependencies - -Required: - -* `bash` (4+) -* `mpv` -* `yt-dlp` - -Will use if detected: - -* `keyon` / `keyoff` -* `pandoc` - -Environment variables: - -``` -: ${CLIP_DATA:="$HOME/.config/clip/data"} -: ${CLIP_DIR:="$HOME/Videos/clips"} -: ${CLIP_SCREEN:=1} -: ${CLIP_VOLUME:=-50} -: ${PAGER:=more} -: ${EDITOR:=vi} -: ${HELP_BROWSER:=} -``` - -## Usage - -``` -clip dir -clip data [] -clip add -clip edit -clip help [] -clip list -clip (play) [] -clip usage -``` -## Commands - -* [usage] - print usage summary -* [play] - play clip, randomize if duplicates, select menu if none -* [list] - print list of all clips by name -* [data] - print data for name (random if dupicates) -* [dir] - print directory path containing clip videos -* [add] - download and add video from YouTube URL -* [edit] - open data file for editing with `$EDITOR` -* [help] - display help for all or specified command - -[usage]: help-clip-usage.html -[play]: help-clip-play.html -[list]: help-clip-list.html -[data]: help-clip-data.html -[dir]: help-clip-dir.html -[add]: help-clip-add.html -[edit]: help-clip-edit.html -[help]: help-clip-help.html - -## Data File Format - -The data file containing clip name, volume, and source information can be edited with the `edit` command and is updated by the `add` command when adding new clips. The first two numbers after the file name (separated by commas) are for the start second (including decimals) and the length. To add another segment from the same file, add a semicolon and another start and length, and so on. Clips that have the same name will be randomized. The `play` commands accepts a regular expression which can also be used to randomize between several clips. - -``` -working 100 dXjcvIPSBr4.mkv,19,20 -revenge 100 _oyP0QHjty8.webm,17,30 -rick 100 dQw4w9WgXcQr.mkv,0,9001 -shit 120 seKLsHOkN1U.mkv,2,4.3 -shutup 100 k8QE4-BEy4E.mkv,0,10 -guy 120 _uMEE7eaaUA.mp4,9.5,9001 -verse 240 VX58scb5_B0.mkv,-16.9,14 -element 140 gINEJhFyQmk.mp4,5.4,1.9 -opinion 140 j95kNwZw8YY.mp4,2,15 -code 110 sMMpYiiuEMc.webm,-13,2.2 -dance 110 wCDIYvFmgW8.webm,43,24 -walken 110 wCDIYvFmgW8.webm,43,24 -fever 120 cVsQLlk-T0s.mkv,255.6,1.7 -yes 100 lNEX0fbGePg.mkv,120,6.2 -lobot 70 taUSotxNaGA.mkv,20.5,1.7 -stupid 100 yf8Y85Lfrwk.mkv,35.2,3 -fish 100 KezvwARhBIc.mp4,0,9001 -no 100 CQ_eDE0OMds.mp4,106.8,6.5 -word 110 dTRKCXC0JFg.mp4,-4.2,2.2 -phone 110 6xZif3WmG7I.mkv,142,6.5 -everyone 100 mX-qK4qG2EY.mkv,127.4,2.1 -hack 120 u3CKgkyc7Qo.mkv,21,1.5 -planet 120 u3CKgkyc7Qo.mkv,21,1.5 -game 100 KXzNo0vR_dU.mkv,60.4,4 -ping 180 jr0JaXfKj68.mkv,10.5,2 -shark 130 Cs9M1m-dpgM.mp4,6,14 -hack 130 u8qgehH3kEQ.mkv,0,5 -scan 130 u8qgehH3kEQ.mkv,0,5 -stop 120 Iur1d9CP6bA.mkv,206.5,2.25 -cube 100 u1Ds9CeG-VY.mkv,0,9001 -hack 100 u1Ds9CeG-VY.mkv,7,13 -dance 100 u1Ds9CeG-VY.mkv,100.5,2.3 -hdance 100 u1Ds9CeG-VY.mkv,100.5,2.3 -unix 120 dxIPcbmo1_U.mkv,8.5,2.5 -helm 120 9FHw2aItRlw.mkv,0,9001 -danger 100 HdKqAVpUOwI.mkv,0,3 -irc 180 O2rGTXHvPCQ.mp4,17.5,8 -gui 140 hkDD03yeLnU.mkv,0,13 -lawn 101 Ho8o92Ro-Ig.mp4,58.8,1.5 -excellent 150 lVhATSQHw9k.mkv,3.2,1.4 -developers 80 KMU0tzLwhbE.mkv,0,9001 -clap 200 DdCYMvaUcrA.mkv,26.8,1.6 -``` - -' - -help[edit]=' -The `edit` command opens the clip data file (`CLIP_DATA`) with the current `$EDITOR` (default: `vi`). -' - -x_edit() { "$EDITOR" "$CLIP_DATA"; } - -help[data]=' -The `data` command returns a line from the data file (`$CLIP_DATA`) that -matches the argument passed, which can be simply a string or an extended -regular expression. If more than one line matches, then one will randomly be returned.' - -x_data() { - _filter "$@" - local -a data - mapfile -t data <"$CLIP_DATA" - local -a matches - IFS=$'\n' - for c in "${data[@]}"; do - [[ $c =~ ^$1 ]] && matches+=($c) - done - echo "${matches[$((RANDOM % ${#matches[@]}))]}" -} - -help[play]=' -The `play` command (which is the default when no command is passed) -takes the basename of a video in the `$CLIP_DIR` and plays it with -passed volume (100), starting point (0), and length (10). If the name -passed refers to one or more clips, a random clip from among them will -be select. Also, rather than a specific, any Bash-compatible regular -expression may be passed allowing for interesting combinations. For -example, a `coin` alias could be created to select randomly from between -the *yes* and *no* clips, which could themselves also have multiple in -their groups. (See `man mpv` for more details on how the videos are -played.)' - -x_play() { - if [[ -z "$1" ]]; then - select c in $(x_list); do - x_play "$c" || true - done - return $? - fi - type keyoff &>/dev/null && (keyoff || true) - local -a data - data=($(x_data "$@")) - local -i volume="$CLIP_VOLUME" - volume+=${data[3]:-100} - mpv --fs \ - "--volume=$volume" \ - "edl://$CLIP_DIR/${data[2]//;/;$CLIP_DIR/${data[2]%%,*},}" \ - &>/dev/null - - # mpv --fs \ - # "--volume=$volume" \ - # "--fs-screen=$CLIP_SCREEN" \ - # "edl://$CLIP_DIR/${data[2]//;/;$CLIP_DIR/${data[2]%%,*},}" \ - # &>/dev/null - - #type keyon &>/dev/null && (keyon || true) -} - -help[add]=' -The `add` command will download the provided YouTube URL into the -`$CLIP_DIR` directory and name it according the YouTube identifier -preserving the same file suffix. It then add an entry to the clips data -file (`$CLIP_DATA`) with default settings which can be changed easily -with `edit` later. Be sure to use the shareable URL (rather than the one -in the omnibox) so that the ID is extracted correctly.' - -x_add() { - _filter "$@" - (($# == 2)) || (echo "usage: $EXE add