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; | |
} |
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
#include <stdint.h> | |
#include <cfloat> // FLT_MIN FLT_MAX | |
#include "driver/adc.h" // use esp-idf directly | |
#define OPT_PLOT_DATA | |
/* #define OPT_PLOT_COUNT */ | |
#define US_PER_SAMP 45 | |
#define US_PER_60HZ_CYCLE 8333 | |
/* #define BS 120 */ | |
#define BS 150 |
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
// Ultrasonic module: HC - SR04 | |
const int US1TRIGPIN = 12; | |
const int US1ECHOPIN = 13; | |
//define sound speed in cm/uS | |
#define SOUND_SPEED 0.034 | |
#define CM_TO_INCH 0.393701 | |
#define UL unsigned long | |
#define SUL static unsigned long |
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
void loop() { | |
unsigned long cmicros = micros(); | |
unsigned long cmillis = millis(); | |
static unsigned long last_read = cmillis; | |
static unsigned long last_print = cmillis; | |
#define BB 300 | |
unsigned long buf_us[BB+1]; | |
float buf_v[BB+1]; | |
float pbuf_v[BB+1]; | |
float pbuf_slv[BB+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
#!/usr/bin/perl | |
# gist-paste -u https://gist.github.com/jaggzh/68ade8171e8d7983f63d3017762699e1 rewrap-paragraphs | |
use v5.36; | |
use strict; | |
use warnings; | |
use Getopt::Long; | |
use Lingua::EN::Sentence qw(get_sentences add_acronyms); | |
use utf8; | |
use bansi; |
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
https://gist.github.com/jaggzh/8982a842784cabdb6cf1b5df4a7810da | |
-------------------------------------------------------- | |
Location: Key West, Florida. Person B was in a public park, with a public shower. Park had a shallow water pool with a fountain, and a sign had a rule saying "no bathing". B claims it was unclear if this rule applied to a shower. B was rinsing a t-shirt in the shower and someone called the police and they arrested B (a male) saying the shower was for children. This was not posted. B was in jail for a day before being informed they were "corrupting public morals." The sign actually stated, "The Splash Pad is designed for recreational purposes and not for bathing" The shower was not in the splash pad, but the police claimed the rules applied to the shower as well. | |
B is seeking damages. They were locked up in jail for a week. Caught covid in jail. Lights were on 24h/day in jail. They didn't sleep for a week, got sick, constipated, etc. They had $47 which was taken and not returned. They wer |