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 | |
# 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 |
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
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 |
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
bgbla='[40m'; bgred='[41m'; bggre='[42m'; bgbro='[43m'; | |
bgblu='[44m'; bgmag='[45m'; bgcya='[46m'; bggra='[47m'; | |
bla='[30m'; red='[31m'; gre='[32m'; bro='[33m'; | |
blu='[34m'; mag='[35m'; cya='[36m'; gra='[37m'; | |
bbla='[30;1m'; bred='[31;1m'; bgre='[32;1m'; yel='[33;1m'; | |
bblu='[34;1m'; bmag='[35;1m'; bcya='[36;1m'; whi='[37;1m'; | |
rst='[0m'; inv='[7m'; cll='[2K'; cllr='[K'; | |
cls='[2J'; clsb='[J'; | |
bgblae='\033[40m'; bgrede='\033[41m'; bggree='\033[42m'; bgbroe='\033[43m'; |
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
package Proc::Knife; | |
use strict; | |
use warnings; | |
use v5.36; | |
use Exporter 'import'; | |
use POSIX ":sys_wait_h"; | |
our @EXPORT_OK = qw(knife); |
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
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) |
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
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: |
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 python3 | |
# gist-paste -u https://gist.github.com/jaggzh/e9a5b31afc218b8d44fd5ddb976c8c96 bansi.py kbnb.py audiosplit.py | |
import librosa | |
import numpy as np | |
import random | |
from typing import Generator | |
import matplotlib.pyplot as plt | |
from bansi import * | |
import kbnb | |
import re |
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
bgbla='[40m'; bgred='[41m'; bggre='[42m'; bgbro='[43m'; | |
bgblu='[44m'; bgmag='[45m'; bgcya='[46m'; bggra='[47m'; | |
bla='[30m'; red='[31m'; gre='[32m'; bro='[33m'; | |
blu='[34m'; mag='[35m'; cya='[36m'; gra='[37m'; | |
bbla='[30;1m'; bred='[31;1m'; bgre='[32;1m'; yel='[33;1m'; | |
bblu='[34;1m'; bmag='[35;1m'; bcya='[36;1m'; whi='[37;1m'; | |
rst='[0m'; inv='[7m'; cll='[2K'; cllr='[K'; | |
cls='[2J'; clsb='[J'; | |
bgblae='\033[40m'; bgrede='\033[41m'; bggree='\033[42m'; bgbroe='\033[43m'; |
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
# datagen.py | |
import numpy as np | |
import librosa | |
def load_audio_chunk(audio_path, start_frame, dur_s, sr): | |
# Load a specific chunk of the audio file | |
audio, _ = librosa.load(audio_path, sr=sr, mono=True, offset=start_frame/sr, duration=dur_s) | |
return audio | |
def preprocess_audio(audio_data): |
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
/* gist-paste -u https://gist.github.com/jaggzh/7b483b183562db31bde6f9bc972f126e manifest.json content-script.js */ | |
(function() { | |
const accentColor = `#f39c12`; | |
const messagesCss = ` | |
/* Message body width */ | |
@media (min-width: 1280px) { | |
.xl\\:max-w-3xl { | |
max-width: 90% !important; | |
} |
NewerOlder