Skip to content

Instantly share code, notes, and snippets.

View brandonpapworth's full-sized avatar
:shipit:

Brandon Papworth brandonpapworth

:shipit:
View GitHub Profile
@alessandrobologna
alessandrobologna / lm-studio-copilot-config.py
Last active April 4, 2026 12:29
configure copilot for lm studio models
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "requests",
# "click",
# "json5",
# ]
# ///
"""
LM Studio to GitHub Copilot Custom Models Generator
@amattu2
amattu2 / postman.json
Created February 11, 2023 15:39
This is a WIP Postman and ThunderClient request repository for interacting with the TryFi.com (api.tryfi.com) pet collar API.
{
"info": {
"name": "TryFi",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"description": ""
},
"item": [
{
"name": "Auth",
"item": [
@WoozyMasta
WoozyMasta / Dockerfile
Created July 12, 2022 02:49
An example of building a Python application into a self-contained statically linked binary and packaging it into a container image based on scratch
FROM docker.io/python:3.9-bullseye AS build
WORKDIR "/app"
# Install dependecies
# hadolint ignore=DL3008,DL3013
RUN set -eux && \
apt-get update; \
apt-get install --no-install-recommends -y \
python3-dev build-essential patchelf upx; \
apt-get clean; \
@brandonpapworth
brandonpapworth / README.md
Last active January 31, 2022 09:03
[WIP] TypeScript: Creating "Enums" from Tuple of String Literals

Creating Enums from Tuple of String Literals

Description

It is as it sounds: this function will create something similar to an enum (in this case, an object with a null prototype) from a tuple of string literals.

Why?

Even though native enums have some convenient benefits, they can get a little "wordy" when you wish them to work like holders of string constants.

@brandonpapworth
brandonpapworth / README.md
Last active March 8, 2021 14:20
Simple "what's-my-ip" service (think ipify) via Lambda@Edge

Simple "what's-my-ip" service

via Lambda@Edge

Usage

This will return the IPv4 or IPv6 address of the client making the GET request to the domain you specified when making the CloudFront distribution. If you add an Accept header with application/json present, it will return an json-parseable object like { "ip": "127.0.0.1" }, but if not specified or text/plain appears before application/json, it will default to text/plain and just return the IP address like 127.0.0.1 (following standard handling of Accept headers).

Shitty Directions

@brandonpapworth
brandonpapworth / README.md
Created June 3, 2020 13:57
Project: Temp Management System for AC Unit
@DzeryCZ
DzeryCZ / ReadingHelmResources.md
Last active February 24, 2026 00:10
Decoding Helm3 resources in secrets

Helm 3 is storing description of it's releases in secrets. You can simply find them via

$ kubectl get secrets
NAME                                                TYPE                                  DATA   AGE
sh.helm.release.v1.wordpress.v1                     helm.sh/release.v1                    1      1h

If you want to get more info about the secret, you can try to describe the secret

$ kubectl describe secret sh.helm.release.v1.wordpress.v1
@ajbeach2
ajbeach2 / ray_trace_postgres.sql
Last active October 11, 2019 15:10
ray_trace_postgres.sql
-- ported to postgres from https://observablehq.com/@pallada-92/sql-3d-engine
WITH RECURSIVE numbers AS (
SELECT 0 AS n UNION ALL SELECT n+1 FROM numbers WHERE n<89
),
pixels AS (
SELECT rows.n as row, cols.n as col
FROM numbers as rows CROSS JOIN numbers as cols
WHERE rows.n > 2 AND rows.n < 40 AND cols.n > -1 AND cols.n < 89
), rawRays AS (
SELECT
@Kmaschta
Kmaschta / generate-self-signed-certificate-with-custom-CA.md
Created January 9, 2019 14:43
How to generate a self-signed that is valid for your browser (by creating your custom certificate authority)

If you're using self-signed certificate for your web server on development, you might know the browser warning saying that your certificate isn't valid. If like me you had manually added an exception for this certificate error each time it showed up, this gist is for you.

Properly Configure OpenSSL with your DNS aliases

You'll have to create a self-signed certificate with a custom SubjectAltName.

  1. Find your openssl config. find /usr/lib -name openssl.cnf
@HyperBrain
HyperBrain / lifecycle-cheat-sheet.md
Last active April 9, 2026 05:34
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,