214 karma · joined March 2, 2023
find -> fd, time(for runtime comparison) -> hyperfine, grep->ripgrep, asciinema + converting to .gif -> t-rec[1], manually creating convertional commits -> koji[2], etc.
[1]https://terminaltrove.com/t-rec/ [2]https://terminaltrove.com/koji/
def abs_days_difference(date1, date2, /):
# note that swapping passed params will yield the same result
delta = abs((date2 - date1).days)
return delta
d1 = date(2023, 1, 1)
d2 = date(2024, 1, 15)
abs_days_difference(d1,d2)==abs_days_difference(d2,d1)
The function returns the absolute diff in the number of days, so date1, date2 are meaningless variable names. It looks like then introduce an order(could #1 be the earlier date, while #2 be the later one?). If you don't get users any options it is clear that the order is meaninglessCompare with
def day_difference(earlier_date, later_date):
delta = (later_date - earlier_date).days
return delta
Note that now d1 = date(2023, 1, 1)
d2 = date(2024, 1, 15)
day_difference(d1,d2)!=day_difference(d2,d1)
If you function signature is day_difference(date1, date2,*) you have to specify params as kwargs only, removing the confusion: d1 = date(2023, 1, 1)
d2 = date(2024, 1, 15)
#this now doesn't work
day_difference(d1,d2)
# this works and is much clearer for caller
day_difference(earlier_date=d1,later_date=d2) alias -g L="| less"
alias -g T="| tee"
alias -g C="| pbcopy"
alias -g @all="> /dev/null 2>&1"
if command -v rg > /dev/null; then
alias -g G="| rg"
else
alias -g G="| grep"
fi[1] https://www.nytimes.com/2024/08/31/climate/pfas-fertilizer-s... [2] https://www.npr.org/2024/03/28/1241473455/pfas-forever-chemi...
The majority of OS that people use either have it installed or can be trivially downloaded to, so I see no point in using gzip nowadays, unless it is mandated by API
Still, I backed up my passwords as soon as I logged into the mobile app, so like some people here say I highly recommend everyone do periodic backups and not be like me (:. I would have lost everything if something did happen to my vault access
False is False is False. If you thought, True, you were right :)
I would recommend to take a look at one of my favourite repos for more[1].