Skip to content

Instantly share code, notes, and snippets.

View bbengfort's full-sized avatar
🎯
Focusing

Benjamin Bengfort bbengfort

🎯
Focusing
View GitHub Profile
@bbengfort
bbengfort / requires
Created May 21, 2025 21:37
Manages python dependencies in requirements.txt file maintaining the ordering of the dependencies and any comments. Adds, removes, and updates, dependencies.
#!/usr/bin/env python
# requires
# Creates a requirements.txt file using pip freeze.
#
# Author: Benjamin Bengfort <[email protected]>
# Created: Fri Jan 22 08:50:31 2016 -0500
#
# Copyright (C) 2016 Bengfort.com
# For license information, see LICENSE.txt
#
@bbengfort
bbengfort / k8secret.py
Created March 30, 2025 16:45
Helper functions to manage k8s secrets more easily
#!/usr/bin/env python3
# Helper functions to manage k8s secrets more easily
import os
import yaml
import base64
import argparse
template = """apiVersion: v1
@bbengfort
bbengfort / process.py
Created October 6, 2024 20:42
Processes original parlance data and outputs some analyses
#!/usr/bin/env python3
import os
import re
import csv
import json
from datetime import datetime, timedelta
@bbengfort
bbengfort / hexdraw.py
Created September 26, 2024 18:02
A utility to draw Rotational colored hexagonal tiles. Adapted from https://variable-scope.com/posts/hexagon-tilings-with-python
#!/usr/bin/env python
import math
import random
import argparse
from PIL import Image
from aggdraw import Draw, Brush
@bbengfort
bbengfort / Envoy Workflows.ipynb
Created August 16, 2024 14:46
Envoy data workflows for travel rule exchanges using pyenvoy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bbengfort
bbengfort / perdiem.py
Created July 9, 2024 15:29
Compute per-diem for travel based on GSA M&IE (Meals and Incidental Expenses)
#!/usr/bin/env python3
import argparse
from tabulate import tabulate
from datetime import datetime, timedelta
DATE_FMT = "%Y-%m-%d"
ONE_DAY = timedelta(days=1)
@bbengfort
bbengfort / randommer.py
Created April 5, 2024 22:51
Access the randommer.io API to generate fake crypto addresses and names for test fixtures.
#!/usr/bin/env python3
import os
import requests
import argparse
API_KEY_VAR = "RANDOMMER_API_KEY"
CRYPTO_TYPES = "https://randommer.io/api/Finance/CryptoAddress/Types"
CRYPTO_ADDRESS = "https://randommer.io/api/Finance/CryptoAddress"
RANDOM_NAME = "https://randommer.io/api/Name"
@bbengfort
bbengfort / cryptpress.go
Created October 27, 2023 22:09
Data encryption and compression are heavyweight algorithms that must be used with care in performance intensive applications; but when applying both mechanics to the same data, which should come first? These benchmarks compare Go gzip compression with AES-GCM cryptography. For more see: https://rotational.io/blog/compression-vs-cryptography/.
package cryptpress
import (
"bytes"
"compress/gzip"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"io"
)
@bbengfort
bbengfort / .dockerignore
Created September 19, 2023 12:15
Dockerfile examples for the blog post "How to Dockerize Python Data Science Processes" on rotational.io
# Ignore docker specific files
.dockerignore
docker-compose.yml
Dockerfile
# Ignore git directory and files
.gitignore
.git
# Ignore text files at the root of the project (optional)
@bbengfort
bbengfort / hashtopic.py
Last active April 3, 2023 17:18
Murmur3 comparison and test fixtures
#!/usr/bin/env python3
import mmh3
import json
import base64
def topic_hash(name):
hash = mmh3.hash128(name.encode('utf-8'), signed=False).to_bytes(16, byteorder='big', signed=False)
hash = hash[8:] + hash[:8]