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.
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 / 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 / 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 / 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 / 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}"
#!/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.