Skip to content

Instantly share code, notes, and snippets.

View thomstratton's full-sized avatar

Thomas Stratton thomstratton

  • Eastern Time Zone
View GitHub Profile
@thomstratton
thomstratton / macos-postfix-outbound-smtp.md
Last active May 15, 2026 15:10
macos-postfix-outbound-smtp.md

setting up postfix on macos as outbound only smtp through relay host

  • checking connection
    nc -zv smtp.mailgun.org 587

  • configure login
    sudo nano /etc/postfix/sasl_passwd

[smtp.mailgun.org]:587 username@example.com:password

@thomstratton
thomstratton / send-test-email-using-openssl.md
Last active May 15, 2026 14:49
send-test-email-using-openssl.md

example send email using openssl

  • this being done on a mac with available commands.
  • this example is using mailgun and AUTH LOGIN method. may need to be adjusted for different providers.

first get hashes for your username and password

echo -n username@example.com|base64
echo -n password|base64

cloudflare flattener

Write a cloudflare worker that runs as a cron task every 5 minutes. The task should read a static asset that contains the text of an spf configuration, then read the include and a records in the spf, use doh to retrieve and parse those records from dns recursively, and resolve them down to their ip4 and ip6 entries to produce a flattened version of the spf. Finally, publish the updated flattened spf to cloudflare as txt record using cloudflare api and retrieving the api keys from cloudflare secret vault

Cloudflare Worker (cron) — flatten SPF by resolving includes/A records via DoH and publish as TXT via Cloudflare API

Notes:

  • Assumes Cloudflare Workers (Modules) runtime with cron trigger configured every 5 minutes.
  • Uses Cloudflare Secrets (Secrets Vault) for API token (named CLOUDFLARE_API_TOKEN) and ACCOUNT_ID and ZONE_ID stored as secrets or environment bindings.
  • Uses DNS-over-HTTPS (Cloudflare DoH at https://cloudflare-dns.com/dns-query).
@thomstratton
thomstratton / Convert-SourceToMarkDown.ps1
Created January 29, 2026 21:37
Convert multiple source files to markdown (for example to feed the markdown to a web based ai)
#requires -version 7.4
function Get-FilesSkippingDirsAndExts {
param(
[Parameter(Mandatory)][string]$RootPath,
[string[]]$SkipNames = @(),
[string[]]$Extensions = @() # e.g. @(".cs",".js",".txt") or @("cs","js")
)
# Normalize extensions to start with dot and lower-case
$normExts = $Extensions |
@thomstratton
thomstratton / pi400laptop.md
Last active March 23, 2022 15:18
rasberry pi old laptop

pi 400 laptop

hooking up a rasberry pi 400 to an old laptop case and screen

starting info

@thomstratton
thomstratton / pgp-basics.md
Last active January 20, 2022 14:34
pgp-basics
We couldn’t find that file to show.
@thomstratton
thomstratton / handling_multiple_github_accounts.md
Created August 16, 2021 20:54 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@thomstratton
thomstratton / gist:9f7523f0b4db891bc724f4e3383b797e
Last active February 8, 2022 22:56
orderport_plantuml.md
@startuml

class AcctId {
    +@value : string
}
class AcctType {
    +@value : string
}
class ActiveFIAccountHolderId {