Skip to content

Instantly share code, notes, and snippets.

View CodyKochmann's full-sized avatar

Cody Kochmann CodyKochmann

  • Severn, MD
View GitHub Profile
@CodyKochmann
CodyKochmann / sources.list
Created September 29, 2019 11:04
kali linux default /etc/apt/sources.list
deb https://http.kali.org/kali kali-rolling main contrib non-free
deb-src https://http.kali.org/kali kali-rolling main contrib non-free
@CodyKochmann
CodyKochmann / demo-sqlite-over-ssh-user.sh
Created March 6, 2023 13:41
dedicated db user that has a login shell of sqlite for a sqlite over ssh interface
➜ ~ ssh kali@10.0.0.8 cat /usr/local/bin/sqlite3-user-db
kali@10.0.0.8's password:
#!/bin/bash
/usr/bin/sqlite3 "$HOME/$USER.db"
➜ ~ ssh db@10.0.0.8
db@10.0.0.8's password:
Linux kali 6.0.0-kali3-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.7-1kali1 (2022-11-07) x86_64
@CodyKochmann
CodyKochmann / ocr_remote_image.py
Created February 17, 2023 13:27
python ocr conversion of an image from a url
# by: Cody Kochmann
# this script pulls the contents of $TARGET_IMAGE
# and uses pytesseract against it to output the
# text contents of the image to stdout
import os, sys, functools
import requests
try:
from PIL import Image
except ImportError:
@CodyKochmann
CodyKochmann / cicd-life-advice.md
Created February 5, 2023 17:18
CICD life advice inspired by reddit.

I need scripts to run on github webhooks just as bad as you do. But this one-size-fits-all "lets make scripts but in yaml" shit has got to go.

Yaml acts as the "purely ci details". Script logic goes in... SCRIPTS!

Every CI/CD engine has a million different 'input' layers - environment variables, repo variables, workflows from various branches, maybe the git commit object. Oftentimes your scripts will have the ability to jam more variables into the 'input' layer for later scripts - such as in the case of the github environment variables. UNFORTUNATELY, it's never clear WHICH input layers are available to WHICH parts of the script. "Oh, no, you can't use outputs from this script to as arguments for something in our yaml, because the yaml is calculated first." Well thanks, Mr Nadella, I'll just torch my entire pipeline and start over.

My form of dynamic ci materializes all variables into logged and exam-able ci code. Hidden ci assembly magic was one of the first things I got rid of because life triggered

@CodyKochmann
CodyKochmann / random_hash.py
Created February 8, 2016 14:24
Random hash generator for Python
import random
hash = random.getrandbits(128)
print "hash value: %032x" % hash
@CodyKochmann
CodyKochmann / SetUpCouchDBSSL.sh
Created August 3, 2016 14:51
This script will set up ssl for couchdb on a raspberry pi, debian or ubuntu system. I added a password generator plugged into openssl so you can just copy and paste that into the server key password prompt unless you either dont trust openssl (which would defeat the purpose of using SSL) or can come up with a better password than a SHA-512 bit h…
#!/bin/bash
# this creates a self signed certificate for couchdb
function SetUpCouchDBSSL
{
mkdir -p /etc/couchdb/ssl \
&& cd /etc/couchdb/ssl \
&& suggestion=`openssl rand -base64 4096 | openssl dgst -sha512 | sed "s/(stdin)= //g"` \
&& echo "Here is a secure password you can use - ${suggestion}" \
&& suggestion="" \
@CodyKochmann
CodyKochmann / pg_kv_store_functions.sql
Last active April 6, 2022 23:17
postgres function based kv storage for sql algorithms.
-- -------------------------------------------
-- This is an implementation of a key, value
-- store for function based kv storage for
-- different sql based algorithms to utilize
-- in postgres.
-- -------------------------------------------
-- Author: Cody Kochmann
-- license: MIT
-- -------------------------------------------
@CodyKochmann
CodyKochmann / curl.coffee
Last active March 27, 2022 16:24
grep (actually curl) equivalent (http requester) for javascript
curl = (theUrl) ->
xmlHttp = null
xmlHttp = new XMLHttpRequest
xmlHttp.open 'GET', theUrl, false
xmlHttp.send null
xmlHttp.responseText
from functools import wraps
from threading import Timer, Semaphore
import requests
def service_request_rate_limit(per_minute: int):
assert isinstance(per_minute, int), per_minute
assert per_minute > 0, per_minute
lock = Semaphore(per_minute)
@CodyKochmann
CodyKochmann / .tmux.conf
Created October 12, 2021 15:59
My personal tmux.conf I like to start with when setting up new systems.
# by: Cody Kochmann
# license: MIT
#
# This is my personal tmux.conf I like to start with when setting up new systems before I tune
# things for the specific monitors I need to work with.
#
# This has been a comfortable "starting point" for ultrawides, pocket laptops (like gpd pocket),
# and even iphones. (yes, I daily drive tmux on my iphone. I win the oddball fight.)
#