Skip to content

Instantly share code, notes, and snippets.

@dungsaga
dungsaga / sync-time.sh
Last active December 14, 2022 22:15
sync local clock in without NTP in Linux, MacOS, Windows
# I want to sync the local clock but don't have access to any NTP server.
# Website https://time.is tells me the time difference of my system clock 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.
# When I need more accurate time, I can use `datetime` (or `utc_datetime`) from `http://worldtimeapi.org/api/ip.txt`
# time from worldtimeapi.org has millisecond precision, you can use it to compare with your system time:
date -uIns && time curl -s http://worldtimeapi.org/api/ip.txt | sed -n 's/^utc_datetime://p'
date -Ins && time curl -s http://worldtimeapi.org/api/ip.txt | sed -n 's/^datetime://p'
@noku
noku / tmux-cheatsheet.markdown
Last active November 6, 2023 19:57 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

Tmux Shortcuts & Cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@la1o
la1o / automatedManualCertbotRenewal.sh
Last active March 8, 2024 18:53 — forked from AnthonyWharton/automatedManualCertbotRenewal.sh
FreeDNS (afraid.org) Cerbot/Let's Encrypt Manual Automation Script
#!/bin/bash
# Copyright 2018, Anthony Wharton
# Single script that can be called that generates certificates using the
# certbotFreeDNSAuthHook.sh and certbotFreeDNSCleanupHook.sh scripts.
# This should be used as guidence of my usage, and changed to your needs. Note
# the generic `/path/to/...` and `DOMAIN.COM`, which should be replaced with
# your script location and domain respectively. In addition, for this to be
# used on a live system, one must remove the `--dry-run` flag.
@championofblocks
championofblocks / wav-mp3
Last active March 18, 2024 20:08
Command line bash to convert all wav to mp3
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done