Skip to content

Instantly share code, notes, and snippets.

View vijinho's full-sized avatar

Vijay vijinho

  • England
View GitHub Profile
@vijinho
vijinho / transliterate-file.sh
Created January 6, 2025 10:07
bash shell script to transliterate a file - that is, to strip any accents from the file and make it standard English alphabetic characters
#!/bin/bash
# Parse command-line options
while getopts ":f:" opt; do
case ${opt} in
f)
file=$OPTARG
;;
\?)
@vijinho
vijinho / url_final.sh
Created January 6, 2025 12:53
bash script to follow a given url to its final destination, i.e. to unshorten URLs or follow-through redirects to the ultimate destination URL
#!/bin/bash
# Function to parse command line arguments
parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-u=*|--url=*)
URL="${1#*=}"
shift # past argument=value
;;
@vijinho
vijinho / text_to_wav.sh
Last active January 7, 2025 11:24
Uses mimic https://github.com/MycroftAI/mimic1?tab=readme-ov-file to speak text or output wav or mp3 file
#!/bin/bash
# Uses mimic https://github.com/MycroftAI/mimic1?tab=readme-ov-file to speak
# optionally uses aplay https://linux.die.net/man/1/aplay to speak then delete the output file
# Set default values
VOICE='slt_hts'
WAVFILE="$TEMP/$(date "+%Y%m%d.%H%M%S")-tts.wav"
TEXT=''
TEXTFILE=''
@vijinho
vijinho / say-fortune.sh
Last active January 7, 2025 16:07
TTS example script for Coqui-AI https://github.com/coqui-ai/TTS which speaks-out a fortune, for testing models and vocoders
#!/bin/bash
# requires https://github.com/coqui-ai/TTS
# Associative arrays for mapping IDs to model and vocoder names
declare -A model_ids=(
[11]="tts_models/en/ljspeech/tacotron2-DDC"
[12]="tts_models/en/ljspeech/tacotron2-DDC_ph"
[15]="tts_models/en/ljspeech/tacotron2-DCA"
[20]="tts_models/en/ljspeech/neural_hmm"
@vijinho
vijinho / text_to_speech.sh
Created January 7, 2025 16:25
Wrapper for TTS https://github.com/coqui-ai/TTS that takes model and vocoder ids and outputs a wav or mp3
#!/bin/bash
# Associative arrays for mapping IDs to model and vocoder names
declare -A model_ids=(
[12]="tts_models/en/ljspeech/tacotron2-DDC_ph"
[15]="tts_models/en/ljspeech/tacotron2-DCA"
)
declare -A vocoder_ids=(
[4]="vocoder_models/en/ljspeech/multiband-melgan"
@vijinho
vijinho / ia-mount.sh
Created January 8, 2025 01:27
Folder mounting tool for Internet Archive archive.org items using rclone, making access to IA items transparent to the filesystem
#!/bin/bash
# Internet Archive File Mounting Tool
usage() {
echo "Usage:"
echo "1. Create a file with the archive.org ID (e.g., 'test.ia' for https://archive.org/details/test)."
echo "2. Run this script."
echo "It will mount each '.ia' file, list its contents, and append directory information to the corresponding file."
}