Skip to content

Instantly share code, notes, and snippets.

@dungsaga
dungsaga / sync-time.sh
Last active Jan 26, 2021
sync local clock in bash without NTP
View sync-time.sh
# I want to sync the local clock but don't have access to any NTP server.
# Websites such as https://time.is give me the correct time and I can manually adjust the local clock.
# But then I recall that a HTTP response often contains a date header with current time in GMT timezone.
# I'll use it to set the system clock with the precision of 1 or 2 seconds.
# in Linux
sudo date -us "$(curl -Is google.com | grep '^Date:' | cut -d' ' -f3-)"
# in Linux with fish shell
@championofblocks
championofblocks / wav-mp3
Last active Jan 27, 2021
Command line bash to convert all wav to mp3
View wav-mp3
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done