Skip to content

Instantly share code, notes, and snippets.

View yuygfgg's full-sized avatar
☠️
Tired

yuygfgg yuygfgg

☠️
Tired
View GitHub Profile
@yuygfgg
yuygfgg / asmr_one_organize_command.sh
Last active March 10, 2025 10:01
asmr_one_organize_command.sh
# export COVER=/path/to/cover
# organizes wav + vtt to flac(embedded lrc & cover) + lrc
for wav in *.wav; do [ -f "$wav" ] && ffmpeg -i "$wav" -compression_level 12 "${wav%.wav}.flac" -y && rm "$wav"; done && for vtt in *.vtt; do [ -f "$vtt" ] && lrc="${vtt%.vtt}.lrc" && echo -e "[ti:]\n[ar:]\n[al:]\n[by:]\n[00:00.00]" > "$lrc" && grep -n "^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]" "$vtt" | while IFS=: read -r ln line; do start=$(echo "$line" | awk '{print $1}') && h=$(echo "$start" | cut -d: -f1) && m=$(echo "$start" | cut -d: -f2) && s=$(echo "$start" | cut -d: -f3 | cut -d. -f1) && ms=$(echo "$start" | cut -d: -f3 | cut -d. -f2 | cut -c1-2) && tm=$((10#$h*60+10#$m)) && txt=$(sed -n "$((ln+1))p" "$vtt") && printf "[%02d:%02d.%s]%s\n" "$tm" "$s" "$ms" "$txt" >> "$lrc"; done && rm "$vtt"; done && for flac in *.flac; do [ -f "$flac" ] && metaflac --import-picture-from="$COVER" "$flac" && lrc="${flac%.flac}.lrc" && [ -f "$lrc" ] && metaflac --set-tag="LYRICS=$(cat "$lrc" | tr '\n' '|' | sed 's/|/\\n/g')" "$flac"; done
@yuygfgg
yuygfgg / ip.cpp
Last active March 10, 2025 10:00
ip fomats
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <sstream>
#include <arpa/inet.h>
#include <cstdint>
#include <iomanip>
#include <regex>