Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# embed-search
# Takes query text (utext) on the commandline,
# and many lines of text from stdin or a file (lines).
# Outputs the highest semantically-matching line(s)
# gist-paste -u https://gist.github.com/jaggzh/d57ef8757c10e945d99c77f91449e33a embed-search-wrapped
# Dependencies:
#!/usr/bin/env python3
# gist-paste -u https://gist.github.com/jaggzh/47b1c58617601b5aaab9da6233aaeae1 mapper-linear
import json
import datetime
import folium
from folium.plugins import TimestampedGeoJson
# Load the fire perimeter data
with open("query-to-2025-01-09_23-14pm.json") as F:
data = json.load(F)
#!/bin/bash
# Source at: https://gist.github.com/jaggzh/4f4159b1b137cbc9553efb7d8364f0c9
. ansi.sh # ansi.sh from: https://gist.github.com/jaggzh/6b3746475bbde5a077dfaeae793b7d1f
bgblu=$'\e[44m'
bmag=$'\e[35m'
whi=$'\e[37m'
rst=$'\e[0m'
# blank to disable
@jaggzh
jaggzh / plotter.py
Last active December 19, 2024 17:04
#!/usr/bin/env python3
# Copyleft 2024 jaggz.h {over yonder at} gmail.com
# jaggzh @ reddit
# Usage:
# python plotter.py -i defocus.ods -o defocus.png
# Gist url for this script:
# https://gist.github.com/jaggzh/f4aea3e8c09363bf4924b8bd2f80895d
@jaggzh
jaggzh / spect
Last active August 12, 2024 22:16
#!/bin/bash
# gist-paste -u https://gist.github.com/jaggzh/f687be9a23d267e641dc7ff7a1967b9a spect
# Dependencies:
# ffmpeg (we extract audiosecs=60 for the spectrogram)
# sox (for spectrogram image creation)
# chafa (for conversion of spectrogram to text)
tmpdel_s=$((60)) # 5 minutes
def_maxh=5
def_maxh_1=16 # Height for 1 file
def_maxh_2=10 # Height for each of 2 files
readcountdown1 () {
if [[ "$#" -lt 3 ]]; then
cat <<-EOT
Accepts a single char of user input
Usage: readcountdown1 seconds variable message
Ex: readcountdown1 5 inp '(d)elete (anything else exits)'
gives 5 seconds and sets inp if anything (even enter) entered
returns 0 on success, 1 for timeout
EOT
return 1
@jaggzh
jaggzh / ansi.sh
Last active December 30, 2024 08:27
# gist-paste -u https://gist.github.com/jaggzh/6b3746475bbde5a077dfaeae793b7d1f
bgbla=''; bgred=''; bggre=''; bgbro='';
bgblu=''; bgmag=''; bgcya=''; bggra='';
bla=''; red=''; gre=''; bro='';
blu=''; mag=''; cya=''; gra='';
bbla=''; bred=''; bgre=''; yel='';
bblu=''; bmag=''; bcya=''; whi='';
rst=''; inv=''; cll=''; cllr='';
cls=''; clsb='';
package Proc::Knife;
use strict;
use warnings;
use v5.36;
use Exporter 'import';
use POSIX ":sys_wait_h";
our @EXPORT_OK = qw(knife);
import numpy as np
import simpleaudio as sa
import threading
import time
def play_tone(freq, dur, delay):
# Wait for the specified delay before playing the tone
time.sleep(delay)
# Sample rate (samples per second)
from __future__ import print_function
import sys
# Some color codes for terminals.
# You just print the text and color codes, and print rst to
# send the color reset sequence.
# The color sequence names are in the first bit of code below.
# Usually, just use with something like: