Skip to content

Instantly share code, notes, and snippets.

View coolaj86's full-sized avatar
😎
🐹 Go 🦎 Zig 📦 Node 🐧 POSIX 🪟 PowerShell

AJ ONeal coolaj86

😎
🐹 Go 🦎 Zig 📦 Node 🐧 POSIX 🪟 PowerShell
View GitHub Profile
@coolaj86
coolaj86 / recaptcha-express-gpt.js
Created September 19, 2024 22:29
A Simple Demo using Google reCAPTCHA with Express, lovingly coaxed out of GPT4o with a heavy hand.
const express = require('express');
const AsyncRouter = require('@root/async-router');
const fetch = require('node-fetch'); // For making external API requests
const app = AsyncRouter.Router();
// Secret key for reCAPTCHA
const RECAPTCHA_SECRET_KEY = 'YOUR_SECRET_KEY';
app.post('/api/process-payment', async (req, res) => {
@coolaj86
coolaj86 / notes-on-pci-compliance.md
Created September 18, 2024 05:45
Notes on PCI Compliance

Copied from https://github.com/bnnanet/bnna-payment-gateway.js/issues/5 for the immediate benefit of others, to be available as a Public gist until we make the whole repo public (once it's useful).

Key Takeaways

  • We should limit stored data to what's required for a specific, known business purposes
    (not "just in case it's useful")
  • We may, for internal use, salt and hash the full credit card number (with per-vendor salts)
    • We MUST NOT expose that salt or hash via API
  • We may create a 1:1 mapping with a random (or otherwise unrelated) key and the salted hash
  • This is the user-facing identifier
@coolaj86
coolaj86 / timeout.rs
Last active September 12, 2024 19:23
POSIX.1-2024 timeout implemented in Rust
// generated by GPT4o using the command summary in this README as the prompt:
// https://github.com/posix-utilities/timeout
use std::process::{Command, ExitStatus};
use std::time::Duration;
use std::os::unix::process::CommandExt;
use std::sync::{Arc, atomic::{AtomicBool, Ordering}};
use std::thread;
use nix::sys::signal::{self, Signal};
use std::env;
use std::ffi::OsString;
@coolaj86
coolaj86 / Plaid Security Questionnaire (v6).md
Created September 1, 2024 01:40
Plaid Security Questionnaire (v6)

Plaid Security Questionnaire (v6)

Part One

Hosting (inf_sec_hosting)

  1. What is your organization's strategy for hosting the server-side components of your application?
    • On-prem hosting - We host all server-side components of our application using on-premise physical infrastructure
@coolaj86
coolaj86 / proxmox-container-urls.md
Last active August 25, 2024 23:27
Proxmox PVE Container Image Download URLs

Proxmox's pveam update fetches releases from http://download.proxmox.com/images/aplinfo-pve-8.dat and https://releases.turnkeylinux.org/pve/aplinfo.dat, which can be changed in /usr/share/perl5/PVE/APLInfo.pm.

The dat files contain the names of images which can you use to get the direct pveam download download URLs, for example:

@coolaj86
coolaj86 / LICENSE
Last active August 16, 2024 14:52
EventSocket
@copyright AJ ONeal 2024 MPL-2.0
@coolaj86
coolaj86 / view-dependent-tables-mysql.sql
Last active December 2, 2023 15:48
How to View Tables that Reference a Target Table in MySQL
-- USAGE
-- call show_references_to('my_much_referenced_table') \G
DELIMITER //
CREATE OR REPLACE PROCEDURE show_references_to(
my_table_name VARCHAR(255)
-- , my_column_name VARCHAR(255)
)
BEGIN
@coolaj86
coolaj86 / posix-bsd-flags.md
Last active October 20, 2023 19:40
POSIX, BSD, GNU, & IEEE Standard Command Line Flags & Options

POSIX & BSD Standard Command Line Flags & Options

The vital resource for developers creating new command-line tools to learn the wisdom of the ancients.

All programs should universally implement these flags:

  • -V (uppercase), --version, version
  • --help, help (also the default if nothing is given)
  • -- stop processing flags; treat all else as raw arguments

I'm creating a backup retention strategy with this directory structure:

backups
├── daily
├── monthly
│  ├── 2019
│  └── 2020
└── weekly