Skip to content

Instantly share code, notes, and snippets.

View bioshazard's full-sized avatar
🎯
Focusing

Joe bioshazard

🎯
Focusing
View GitHub Profile
@bioshazard
bioshazard / flatten-sbs-vr-hequirect.sh
Created June 28, 2024 18:22
Flatten SBS VR to Left and Right
INPUT=$1
# TY https://github.com/paulpaul999/vr-video-notes/blob/main/vr-to-flat/README.md
ffmpeg -i $INPUT -filter_complex "
[0:v]crop=iw/2:ih:0:0[left];
[0:v]crop=iw/2:ih:iw/2:0[right];
[left]v360=input=hequirect:output=flat:d_fov=125:w=1920:h=1080:pitch=0[flattened_left];
[right]v360=input=hequirect:output=flat:d_fov=125:w=1920:h=1080:pitch=0[flattened_right]
" \
-map "[flattened_left]" -c:v libx265 -crf 18 -pix_fmt yuv420p flattened_left.mp4 \
@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.