Skip to content

Instantly share code, notes, and snippets.

View abathur's full-sized avatar
🦖

Travis A. Everett abathur

🦖
View GitHub Profile
@abathur
abathur / File_differs
Last active February 16, 2017 18:28
Check the server_file once an hour for changes and pop-up a notification if it has.
1. Copy both files into your user dir (C:/users/<username>)
2. edit the "server_file" path on line 4 of file_differs.bat to use the network file location of your excel sheet
3. Save the edits
4. Click your Start button
5. Type "cmd" and hit enter
6. In the cmd window, type "file_differs.vbs" and hit enter.

I've included a minimal server example and 3 request/response logs. The server code sets a trace for exception events to pull out exceptions that restplus is swallowing (unfortunately this is a little spammy, since there's a trace event every step up the stack). FWIW, running this in Python 2.7.12.

log_clean_get

Nothing significant here. Just demonstrating that everything works for an undecorated endpoint.

log_post_without_auth_header

Requesting the @jwt_required post endpoint without an auth header raises this error: NoAuthorizationError: Missing Authorization Header

I've registered log_unauth_exceptions as a restplus error handler for NoAuthorizationError, but don't correctly return a Flask response. This potential user mistake is hard to figure out without seeing the exception in restplus that gets swallowed in the error-handling and is only visible via the exception trace:

gcc -O2 -g -I/usr/include/python3.5m -I/usr/include/x86_64-linux-gnu/python3.5m -lpython3.5m access_check.o actions.o array.o arraylist.o backend.o bitstrings.o call_out.o closure.o comm.o dumpstat.o ed.o efuns.o files.o gcollect.o hash.o heartbeat.o interpret.o lex.o main.o mapping.o md5.o mempools.o mregex.o mstrings.o object.o otable.o parser.o parse.o pkg-iksemel.o pkg-xml2.o pkg-idna.o pkg-mccp.o pkg-mysql.o pkg-gcrypt.o pkg-json.o pkg-python.o pkg-pgsql.o pkg-sqlite.o pkg-tls.o pkg-openssl.o pkg-gnutls.o port.o ptrtable.o random.o regexp.o sha1.o simulate.o simul_efun.o stdstrings.o strfuns.o structs.o sprintf.o swap.o types.o wiz_list.o xalloc.o -o ldmud -lnsl -lm -lcrypt -lssl -lcrypto -lpcre -lmysqlclient -lsqlite3 -ljson-c -lpython3.5m -liksemel -lz
backend.o: In function `backend':
/home/ubuntu/ldmud/src/backend.c:891: undefined reference to `python_call_hook'
closure.o: In function `closure_to_string':
/home/ubuntu/ldmud/src/closure.c:6092: undefined reference to `closure_python_efun_to_stri
@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 / 0_demo
Last active March 31, 2020 21:46
resholved Nix demo
============================= resholver Nix demo ===============================
test_future_perfection
nothing up my sleeve
+++++ type jq openssl
/nix/store/nd1pqfcmv5yjx5wqr07b8xsw0s683h19-testmod3-unreleased/bin/conjure.sh: line 6: type: jq: not found
/nix/store/nd1pqfcmv5yjx5wqr07b8xsw0s683h19-testmod3-unreleased/bin/conjure.sh: line 6: type: openssl: not found
+++++ set +x
test_openssl
+++++ /nix/store/i6rnpwfhwdd7wjazfxk07rnzr58jba43-openssl-1.1.1d-bin/bin/openssl version
OpenSSL 1.1.1d 10 Sep 2019
@abathur
abathur / test procedure.md
Last active June 2, 2020 19:52
Test procedure for exploring impact of Catalina's networked executable assessments on Nix build times.

Goal

In Catalina, it appears that there's a networked assessment of new executables (including scripts). Nix is constantly generating new executables during a build, so I'm trying to get a bead on how stable/variable this effect is. (AFAIK, it's only meaningful to test this on single-user installs. We have yet to identify any way to successfully exempt builds under multi-user/daemon installs.)

Setup

Open 2 terminal tabs/windows and set up the first to monitor the relevant logs by running:

log stream --debug --info --predicate 'process == "syspolicyd" AND subsystem == "com.apple.securityd" AND category == "gk"'
@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
@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 / 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
@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.