Skip to content

Instantly share code, notes, and snippets.

View tcarrio's full-sized avatar
🧙‍♂️

Tom Carrio tcarrio

🧙‍♂️
View GitHub Profile
@tcarrio
tcarrio / Makefile
Last active June 13, 2024 20:50
Zero at-rest residual decryption of sops for Make process execution with AWS auth
SHELL:=/bin/bash
CURRENT_DIR := $(PWD)
ENV := ${CURRENT_DIR}/.env # the location of the environment file
ENCRYPTED_ENV_FILE := ${CURRENT_DIR}/.sops.env # the location of the sops encrypted environment file
DECRYPTED_ENV_PIPE := $(shell mktemp)
# Ensure the plaintext environment file is loaded into Make
include $(ENV)
# This bit of fun magic creates a named pipe that exists for transmitting
@tcarrio
tcarrio / README.md
Created May 8, 2024 01:51
Rusty Option-like operations in PHP

Rusty Option-like operations in PHP

This is very half-baked, but I'm capturing an idea I wrote in an empty buffer.

This provides a similar behavior to Rust's std::option::Option enum which encapsulates a value either existing as it should as "Some" value, or being empty or "None".

There's also a convenience for pattern matching, though more would need to go into the typing with PHPStan docstrings to make it more dynamic. As it is now though, it's possible to act on a Some or None match with a closure for the items.

Future ideas

@tcarrio
tcarrio / README.md
Created September 20, 2023 19:38
Configuring VS Code integrated terminal shell

In my specific scenario, I am using fish but installed by the Nix package manager on macOS.

The following configuration resides in my user settings JSON file.

@tcarrio
tcarrio / ssh.txt
Created September 4, 2023 04:14
public-keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDe7xvr45OB0rHkLy9EWSxGGe/OpmMqawr90+d/RXTP2F9H/X7DDByLuH1VMNtjYAltnRO4zQW6vod90EptfuiTOl6B1lipg2abkRg8yFe+BWSzgNdtzmaKp0UEA6+EbeQft/zGEaPcibcJT8OFEeGdYeMthq5bXiFowgBgdIaMxNo5wn7SButgvT6Jo9VXyWUbMG/HkIKpNzNP1bfMhYcrGGWVfiu3Lyvulj2lJ4OkbEXMQN+sPE+Ti5rUX07zc0sqAvohRxTwAeSJM7RndD4+rEb/tj8bpHYbvcZwmvmVculh/5+vDnWRXJCjbuj6gMnvn2Njbz7Mu6xRZx+ev4SdXpO5vdvd2BBV08fvrWx3iMAqGNppqS0h4UadtApWkx1TjMMuvyk+SZmAtv8OQ662SauS3pIUpr+o8D7BjS8my1mQP5MMW7M3rvpBJ5TlKf2RecDR43R1MZdKzgtKmTLtlarna30Xt4phDXhpyW7C5L9DruZ9MV1Gc4820juIplmN2/WGcwvLGxu+YMiN7jm26T/2bogr039Bpcb3aPLTTm1dkC4qowcFQ7Eww3QH5ECRg8e8b/BaQgA0CUXOZxDSIH3X3c0LdEUCuXVrCc9bHK8U8XFijbMkosIQabudqPiXBXDsrKDSu0qI//T315EfNeXGCocmM5Ujb2P7a2zZFQ== [email protected]
@tcarrio
tcarrio / README.md
Created July 3, 2023 20:31
Absolute shred all files under the current directory

shredit

Have you ever wanted something on your disk absolutely destroyed? Shredit.

@tcarrio
tcarrio / README.md
Last active June 14, 2023 14:16
Domain modeling for D2-Vendor-Alert

domain modeling

This demostrates a scenario of generating persistence-layer agnostic domain models which reflect the context of your service, but are not explicitly tied to a data store (in this case, MongoDB)

The pattern enforces separation of concerns such that the persistence layer and domain layer are kept independent of each other.

One important component here is the interface, IUserRepository, which we could swap with any other implementation backed by whatever data store. You can swap in a Fake for e2e testing that is backed by an in-memory datastore.

@tcarrio
tcarrio / listener.py
Created March 3, 2023 23:39
Python HTTP listener - Client IP logger
import http.server
import socketserver
class MyHandler(http.server.SimpleHTTPRequestHandler):
def handle_one_request(self):
print(self.client_address[0])
return super().handle_one_request()
@tcarrio
tcarrio / README.md
Created February 28, 2023 13:53
XCode automations

xcode.sh

A few functions to help automate installation and validation of the XCode developer tools

⚠️ Still a work in progress

@tcarrio
tcarrio / .gitconfig
Created November 23, 2022 21:49
Git config
[alias]
a = add
f = fetch
p = push
co = checkout
cm = commit
st = status
br = branch
rs = reset
rb = rebase
@tcarrio
tcarrio / .env
Created October 2, 2022 04:45
Makefile with .env
EXAMPLE=deadbeef