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_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 / 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.

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

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:

@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.