This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# description: demo of shared data in plpython functions | |
# by: Cody Kochmann | |
# date: 2021-10-02 | |
# | |
testdb=> -- pg has two magic vars for plpython3u functions | |
testdb=> -- SD | dict | per function memory | |
testsb=> -- GD | dict | global shared function memory | |
testdb=> CREATE FUNCTION state_test (t TEXT) | |
RETURNS TEXT[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# by: Cody Kochmann | |
# | |
# this program tells the kernel to turn off the | |
# odd cores on a host. This is useful when you | |
# want to disable hypertheading in an ec2 | |
# instance and dont have bios access to do it | |
# at the chip level. | |
seq 0 127 | awk '{print "echo 0 > /sys/devices/system/cpu" $1 * 2 + 1 "/online"}' | bash -x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by: Cody Kochmann | |
// this iterates stdin lines to a golang channel | |
package main | |
import ( | |
"os" | |
"bufio" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script backs up all existing docker volumes to archives | |
# by: Cody Kochmann | |
cd $(mktemp -d) | |
docker volume ls \ | |
| grep -v 'volume-backups' \ | |
| awk '/local/ {print "docker run -i --rm -v "$2":/outside:ro -v volume-backups:/bak --workdir /outside registry.gitlab.com/icody/containers/debian tar czfv /bak/"strftime("%Y.%m.%d.%H.%M.%S-",systime())$2".tar.gz ./"}' \ | |
| tee backup-volumes.sh | |
bash -x backup-volumes.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ tmp.QicwwydLd3 cat a.json | |
{ | |
"name": "Cody Kochmann", | |
"flags": [ | |
"engineer", | |
"scientist" | |
], | |
"stats": { | |
"commits": 45 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# by: Marcin Pohl | |
# created: 2021-06-30 | |
# this bash script js used to flatten and optimize | |
# docker images for better file access times. | |
| |
function docker_flatten() { | |
[[ $# -ne 2 ]] && ( echo "Example usage: docker_flatten python:3.7-slim python:3.7-slim-flat"; exit 255 ) | |
| |
local SRC="$1" # Name or SHA of the source image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Author: Cody Kochmann | |
# Created: 2021-06-18 | |
# License: MIT | |
from random import randint | |
class cron(): | |
@property | |
def hourly(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# author: Cody Kochmann | |
# created: 2021-06-13 | |
# license: MIT | |
from functools import partial | |
import json, logging | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# by: Cody Kochmann | |
# license: MIT | |
# created: 2021-06-13 | |
import sqlite3, sys | |
from sqlite3 import Cursor | |
''' My essentials for interactively working with sqlite in python. ''' |