This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Added .ics file mistakenly to google calendar? Undo using this script. | |
# Iterate over all events and delete ones with icalUID which contains a unique identifier of events in the .ics file | |
# %% | |
# pip install gcsa | |
from gcsa.google_calendar import GoogleCalendar | |
from datetime import datetime | |
TARGET_GOOGLE_CALENDAR_NAME = None # None => default calender | |
ICALUID_IDENTIFIER = "some_name" # icalUID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable | |
def conditional_decorator(condition: bool, decorator: Callable, *args, **kwargs): | |
if condition: | |
if len(args) == 0 and len(kwargs) == 0: | |
return decorator | |
return decorator(*args, **kwargs) | |
return lambda x: x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dev environment: https://github.com/jplane/pyspark-devcontainer | |
from pyspark.sql import functions as F, Column | |
import string | |
from typing import Dict, Union, Callable | |
from functools import reduce | |
def interpolate_string(template: str, strict: bool = True, **kwargs: Dict[str, Union[str, Column]]): | |
""" | |
- `template`: string with python string placeholders | |
- `strict`: if False, placeholders with no matching kwarg will be automaticity replaced with column of their name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file location: $HOME\Documents\PowerShell\Profile.ps1 | |
# ref: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.4#profile-types-and-locations | |
# aliases | |
New-Alias -Name Unzip -Value Expand-Archive | |
New-Alias -Name Which -Value Get-Command | |
function Get-Size { | |
param ( |