Skip to content

Instantly share code, notes, and snippets.

View Harduim's full-sized avatar

Arthur Harduim Harduim

View GitHub Profile
@Harduim
Harduim / import_submodules.py
Created December 22, 2022 19:28
Import all submodules of a module, recursively, including subpackages
def import_submodules(package, recursive=True):
"""Import all submodules of a module, recursively, including subpackages
:param package: package (name or actual module)
:type package: str | module
:rtype: dict[str, types.ModuleType]
"""
if isinstance(package, str):
package = importlib.import_module(package)
results = {}
@Harduim
Harduim / tsql_datetime_10min_rounder_udf.sql
Last active October 4, 2023 20:13
Datetime 10min based rounder for SQL Server
IF OBJECT_ID (N'[ts_round_base]', N'FN') IS NOT NULL
DROP FUNCTION ts_round_base;
GO
CREATE FUNCTION [dbo].[ts_round_base](@ts datetime, @secs_delta int)
RETURNS DATETIME
AS
-- =============================================
-- Author: Arthur Harduim
-- Description: DATETIME rounding function
--