Skip to content

Instantly share code, notes, and snippets.

View bengerman13's full-sized avatar

Ben Berry bengerman13

View GitHub Profile
#!/usr/bin/env zsh
# howdidi is a tool for remembering how you installed things
function howdidi_load_vars() {
HOWDIDI_TARGET="$1"
HOWDIDI_TARGET_DIR="${HOWDIDI_DIR:=${HOME}/.howdidi}/${HOWDIDI_TARGET}"
HOWDIDI_TARGET_META="${HOWDIDI_TARGET_DIR}/meta"
HOWDIDI_TARGET_HIST="${HOWDIDI_TARGET_DIR}/history"
HOWDIDI_TARGET_POST="${HOWDIDI_TARGET_DIR}/post"
@bengerman13
bengerman13 / conventional-commits.md
Created April 15, 2025 20:01
Nudge yourself to use conventional commits

Nudge yourself to use Conventional Commits

If you want to use conventional commits, but always forget until it's too late, you can edit your commit template to nudge you to use them

# Please follow the conventional commits specification:
# <type>(<scope>): <subject>
#
# Types:
import time
from adafruit_circuitplayground.express import cpx
minolta_speeds = [1,2,4,8,15,30,60,125,250,500]
yashica_speeds = [1,2,5,10,25,50,100,300]
class ShutterSpeed:
def __init__(self, reciprocal):
@bengerman13
bengerman13 / fmt.py
Created April 19, 2023 15:49
Abusing locals in the name of laziness
"""
This is a lazy shell text formatting tool.
Use it like this:
```
import fmt
print(fmt.red("This text is red"))
print(fmt.bold(fmt.green("this is bold and green"))
print(f"Would you like some {fmt.green("eggs")} and {fmt.green("ham")}")
@bengerman13
bengerman13 / circuitpython-counter.py
Created July 16, 2019 08:02
count up and down with circuitplayground
import time
from adafruit_circuitplayground.express import cpx
TIMER_INCREMENT = 0.5
PIXEL_ON = 0.004
PIXEL_OFF = 0
RED = (255, 0, 0)
BLUE = (0,0,255)
#!/bin/bash -ex
PYTHON3=$(which python3)
temp=$(mktemp -d)
pushd $temp
python3 -m venv pipx
pipx/bin/pip install pipx
pipx/bin/pipx install --python ${PYTHON3} pipx
popd
"""
A handful of convenience methods for parsing logs. Requires python 3.7+
start with:
aws s3 cp --recursive s3://my-log-bucket/path/to/some/logs .
cat *.log > my_big_logfile.txt
ipython
In [1]: import log_parser
In [2]: logs = log_parser.parse_alb_logs('my_big_logfile.txt')
In [3]: import pandas as pd
In [4]: df = pd.DataFrame(logs)
@bengerman13
bengerman13 / dump.txt
Created August 18, 2016 18:57
rundeck threaddump
main id=1 state=WAITING
- waiting on <0x7471a8f5> (a java.lang.Object)
- locked <0x7471a8f5> (a java.lang.Object)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at org.eclipse.jetty.util.thread.QueuedThreadPool.join(QueuedThreadPool.java:386)
at org.eclipse.jetty.server.Server.join(Server.java:402)
at com.dtolabs.rundeck.RunServer.run(RunServer.java:121)
at com.dtolabs.rundeck.RunServer.main(RunServer.java:80)