Skip to content

Instantly share code, notes, and snippets.

@takumiirie
takumiirie / midnightConverter.py
Created March 8, 2018 09:36
dealing with str to date time when date time is over 24:00
def midnightConverter(*, year, month, day, hours, minutes):
totalMin = int(hours)*60 + int(minutes)
diff = divmod(totalMin,1440)
if diff[0] >= 0:
deltaMin = timedelta(minutes=totalMin)
baseDate = datetime(
year=int(year),
month=int(month),
day=int(day),
hour=0,
nkf -w --overwrite ./*
@takumiirie
takumiirie / spreadsheet_conditional-formatting1.txt
Created January 26, 2018 08:53
Google Spreadsheet - Regex with Conditional Formatting
# set "Apply to range" to whereever you want to apply setting.
# set "Format cells if..." to "Custom formula is" and paste following code
# Following Forumula will detect if it's match with regex or not.
=REGEXMATCH(INDIRECT("R[0]C[0]", false),"<PUT YOUR REGEX HERE>") = true
# set your "formatting style"
That's it!