This file contains hidden or 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 collections import deque | |
import numpy as np | |
import torch | |
from datasets import load_dataset | |
from transformers import WhisperProcessor, WhisperForConditionalGeneration | |
# Load and preprocess dataset | |
ds = load_dataset("librispeech_asr", "clean", split="validation") | |
sample = ds[0]["audio"] | |
sample["array"] = sample["array"][16000 * 1 : 16000 * 4] # Extract a 3-second clip |
This file contains hidden or 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
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav | |
# To convert all mp3 files in a directory in Linux: | |
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done | |
# Or Windows: | |
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav |
This file contains hidden or 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/python | |
# python3 ./all-git-commits.py -u <user> -d <directory> -r <repo> -n <number of commits> | |
# | |
# Tool to inspect Github and pull local copies of all commits for | |
# for the given user. | |
# | |
# Why? Every ask yourself the question 'I know I did this before, but | |
# which repos commit was it in?' | |
# With all files local, you can use any serach-in-files app to look. |
This file contains hidden or 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
iprange=${1} | |
devices=$( ip -o -4 route show to default | awk '{print $5}') | |
echo "whitelist:" $1 | |
sudo iptables -D DOCKER-USER ! -s $1 -i $devices -m conntrack --ctdir ORIGINAL -j DROP | |
sudo iptables -I DOCKER-USER -i $devices ! -s $1 -m conntrack --ctdir ORIGINAL -j DROP | |
# run on reboot | |
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections | |
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections | |
sudo apt-get -y install iptables-persistent |