Skip to content

Instantly share code, notes, and snippets.

View bioshazard's full-sized avatar
🎯
Focusing

Joe bioshazard

🎯
Focusing
View GitHub Profile
@bioshazard
bioshazard / m4b-tool.sh
Last active January 30, 2024 17:23
Compile an alpha-sorted list (eg "CH01-Title.mp3, ...") of MP3s into a chaptered M4B audiobook
# BOOK_SRC=mp3s/what-govt-has-done-to-our-money BOOK_DEST=What-Government-Has-Done-To-Our-Money.m4b bash m4b-tool.sh
docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt sandreas/m4b-tool:latest \
merge -vv --jobs=3 --ffmpeg-threads=3 "/mnt/$BOOK_SRC" --output-file="/mnt/$BOOK_DEST"
import https from 'https';
import request from 'request';
import fs from 'fs';
import bodyParser from 'body-parser';
var jsonParser = bodyParser()
const backend = {
'proto': 'https',
'host': 'your-instance-name.openai.azure.com'

This paste.txt is a transcript of a podcast episode. Generate a concise descriptive non-click-baity podcast title. Also generate a concise descriptive non-click-baity episode description using "we" language like "we cover ...". Finally, provide a concise representative bullet list of topics along with when those topics start based on timestamp in format "- HH:MM:SS ".

Use custom upstream DNS with CoreDNS

In my use case, I run a K3D cluster in my home and wanted to resolved my local .home.arpa domain hosts (eg ponics.home.arpa) via my router DNS from the pods rather than setting static IPs in DHCP and manifests.

The solution was pretty simple: update in kubectl edit cm/coredns -n kube-system to replace in forward . 192.168.0.1 so domains not handled by CoreDNS used my router as the upstream.

const markdownComponents = {
code: CodeBlock, // look up how to use Syntax Highlighter etc, this gist is really just for the rest of the elements
p: ({ children }) => <p className='py-2'>{children}</p>,
// li: ({ children }) => <li className='list-disc ml-6'>{children}</li>,
h1: ({ children }) => <h1 className='text-2xl font-bold py-2'>{children}</h1>,
h2: ({ children }) => <h2 className='text-xl font-bold py-2'>{children}</h2>,
h3: ({ children }) => <h3 className='text-lg font-bold py-2'>{children}</h3>,
h4: ({ children }) => <h4 className='text-base font-bold py-2'>{children}</h4>,
h5: ({ children }) => <h5 className='text-sm font-bold py-2'>{children}</h5>,
em: ({ children }) => <em className='italic'>{children}</em>,
# WIP attempt at summarizing a podcast given a timestamped transcript
# https://python.langchain.com/en/latest/modules/chains/index_examples/summarize.html
import os
from langchain import OpenAI, PromptTemplate, LLMChain
from langchain.text_splitter import CharacterTextSplitter
from langchain.chains.mapreduce import MapReduceChain
from langchain.prompts import PromptTemplate
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.docstore.document import Document
from langchain.chains.summarize import load_summarize_chain
# Completely Disable SSL Validation in Python
# ty Misty, https://stackoverflow.com/questions/15445981/how-do-i-disable-the-security-certificate-check-in-python-requests#comment127677868_66207445
import ssl
ssl.SSLContext.verify_mode = property(lambda self: ssl.CERT_NONE, lambda self, newval: None)
@bioshazard
bioshazard / helm-get-objects.sh
Created March 3, 2022 22:46
List all objects in helm deployment
helm get manifest $RELEASE_NAME | yq -N eval '[.kind, .metadata.name] | join("/")' - | sort
pi@chia1:~ $ lsblk
...
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdd           8:48   0  3.7T  0 disk
├─sdd1        8:49   0   16M  0 part
└─sdd2        8:50   0  3.7T  0 part
...
pi@chia1:~ $ udisksctl mount -b /dev/sdd2
Mounted /dev/sdd2 at /media/pi/Farm-WDH19YVN.
@bioshazard
bioshazard / gun-service.sh
Created July 27, 2021 16:20
Automation for installing GunDB as a service (tested on Pi)
#!/bin/bash
## Usage: GUN_USER=gun GUN_ROOT=~gun/gun-pi-custom GUN_BRACH=master gun-service.sh
# Should be run as root (with sudo or directly)
[[ "$(whoami)" == "root" ]] || { echo "Must be run as root"; exit 1; }
# Setup default environment
[ -z "${GUN_USER}" ] && GUN_USER="pi"
GUN_DETECTED_USER_HOME=$(getent passwd ${GUN_USER} | cut -d: -f6)