Skip to content

Instantly share code, notes, and snippets.

View abathur's full-sized avatar
🦖

Travis A. Everett abathur

🦖
View GitHub Profile
@abathur
abathur / 0_script_install_of_automator_folder_action_workflow.md
Last active March 12, 2024 19:19
Script to install and activate a macos Automator folder action workflow. This isn't fully unattended. You'll have to click through dialogs.

My macos system/dotfile bootstrap process uses brew bundle to install some apps. This takes a while to complete, so I hoped to use an Automator Folder Action workflow to watch the /Applications/ directory and launch a few apps that require logins as soon as brew bundle finishes installing them.

Automator did not do a good job of this (I did 3 test runs and it never opened each of the apps in the trigger list), but I didn't realize that until after I figured out how to actually install and activate the workflow during my bootstrap process. I wanted to go ahead and share the bits of this process in the hope someone else trying to accomplish the same will need a little less work.

@abathur
abathur / hierarchical_shell-esque_language.md
Last active June 14, 2022 13:44
some sort of hierarchical shell-esque language?

I'm just ~braindumping something to (hopefully) get it out of my head.

status quo

Part of what I like about shell is how squishy/pliable the language is. For a while I've had the nagging sense that it is really close to being an interesting format for a lot of different kinds of plain-text ~DSLs...

  • go to the store later is a perfectly-good shell invocation. If you wanted some little task/TODO DSL, you could dive right in by writing
--- /nix/store/1nqnzfqzxsxrwafksffj78w48jc1iah8-shunit2-2.1.8/bin/shunit2 1969-12-31 18:00:01.000000000 -0600
+++ /nix/store/zh0ac2n6wyff2kpxc32wai8szhj4mk8z-resholved-shunit2-2.1.8/bin/shunit2 1969-12-31 18:00:01.000000000 -0600
@@ -29,15 +29,15 @@
# Logging functions.
_shunit_warn() {
- ${__SHUNIT_CMD_ECHO_ESC} \
+ echo -e \
"${__shunit_ansi_yellow}shunit2:WARN${__shunit_ansi_none} $*" >&2
}
dr-xr-xr-x - abathur 31 Dec 1969 /nix/store/p0876isrv4gi1pbfkc6bms737grzwjlj-python3.8-j2cli-0.3.10
dr-xr-xr-x - abathur 31 Dec 1969 ├── bin
.r-xr-xr-x 964 abathur 31 Dec 1969 │ ├── .j2-wrapped
.r-xr-xr-x 371 abathur 31 Dec 1969 │ └── j2
dr-xr-xr-x - abathur 31 Dec 1969 ├── lib
dr-xr-xr-x - abathur 31 Dec 1969 │ └── python3.8
dr-xr-xr-x - abathur 31 Dec 1969 │ └── site-packages
dr-xr-xr-x - abathur 31 Dec 1969 │ ├── j2cli
.r--r--r-- 261 abathur 31 Dec 1969 │ │ ├── __init__.py
dr-xr-xr-x - abathur 31 Dec 1969 │ │ ├── __pycache__
#!/nix/store/z6rd8wq02azalrlm2m5k08iy53klg624-bash-5.1-p12/bin/sh
# (c) Christoph Sieghart <sigi@0x2a.at> 2007 - 2011
VERSION=0.9.2
# Flags for commandline options
S_FLAG=0
C_FLAG=0
trap 'if [ $S_FLAG -eq 1 ]; then clean_temp_dir; clean_cursor; fi' 0 1 2
#!/nix/store/z6rd8wq02azalrlm2m5k08iy53klg624-bash-5.1-p12/bin/bash
# Usage: pdf2{odt,ods} [ options ] input.{jpg,pdf,png} ... output.{odt,ods}
#
# This script converts one or more PDF, JPG, or PNG files to an ODT or ODS
# file. The contents of any PDF file(s) is first converted to a set of image
# files. These files are then inserted as background images in the ODT or
# ODS file.
#
# Copyright (c) 2011 Markus Gutschke. All rights reserved.
@abathur
abathur / difftest.sh
Last active January 10, 2022 22:21
Confirming how portable this diff invocation is/isn't on any OS you can/want to install Nix on that isn't already in reports! This tries each diff on PATH, but I'm interested in default and common user-installed diffs (leave out any uncommon build you have). See 1st comment for a screenshot of expected output.
#!/usr/bin/env bash
readonly ESC='\033[0m'
readonly GREEN='\033[32m'
readonly RED='\033[31m'
printf -v _UNCHANGED_GRP_FMT "%b" $'\033[2m%='"$ESC" # "dim"
# bold+invert+red and bold+invert+green just for the +/- below
# red/green foreground for rest of the line
printf -v _OLD_LINE_FMT "%b" $'\033[1;7;31m-'"$ESC ${RED}%L${ESC}"
@abathur
abathur / nixiverse-mapping.md
Last active June 20, 2021 19:36
braindumping ideas about different kinds of discovery in the Nix ecosystem

I've had a few different ideas kicking around that boil down to finding one or more places/formats for documenting parts of the known nixiverse (at least nix + nixpkgs + ecosystem/toolchain projects).

(each of these would need software and interested parties/personalities to drive them...)

A massive living differential-diagnosis-style flowchart of the ecosystem

  • Basically, everything official is fair game: concepts, official commands, config, modules, packages, error messages, best practices, and many third-party projects/resources (but I guess curation should be empowered to filter out self-promo/obsolete stuff).
  • Most importantly, the thing that drives linking those resources into the flowchart should be linking them to plausible questions/decisions.
  • Very specific details should probably be version-tagged?
  • When people ask novel questions, those questions/answers should go into the map.
  • Longer-term aspirations are things like:
@abathur
abathur / nix-make.md
Created June 20, 2021 18:37
braindump nix-ecosystem idea (I've had my head in the sand--maybe flakes break off part of this problem?)

There's a gap between what we can do well within Nix builds and other stateful ~project-management tasks that people need to do if Nix is a critical part of their project.

Because Nix doesn't cover these cases gracefully/fluently, there's an awkward liminal zone on the project where even though they've bothered nailing down all of their preconditions for the .nix builds, they still have things like Makefiles that use dependencies they need to provide. So they're either weirdly invoking make inside a Nix shell, or they're using invoking nix-shell/run a dozen times inside the Makefile.

So I wondered if there's good case for like a nix-make/nix make core command/util that interprets a nix-shell or nix-shell-esque shebang specifying the Makefile's dependencies and supplies them before invoking gnumake/bin/make.

@abathur
abathur / alias_riddle.sh
Last active June 26, 2020 23:03
refactoring to fix aliases finally bearing fruit...
# don't try to run me; I'll probably crash or hang or something
# I'm just a succinct test for complex resolution logic...
alias ls="ls -l" # the function
alias stat="stat -f" # external!
function ls(){
ls -a # the alias :P
}
ls # I'm the alias