This file contains hidden or 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
import typing as t | |
from cProfile import Profile | |
from functools import wraps | |
from pstats import SortKey, Stats | |
def profile( | |
user_function: t.Optional[t.Callable] = None, | |
*, | |
output: t.Optional[str] = None, |
This file contains hidden or 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
function gitchanges () { | |
# Get commits between last annotated tag and HEAD. | |
if [ ! -d ".git" ] | |
then | |
echo "ERROR! You have to be in a root of a git repo to run this script!" | |
return -1 | |
fi | |
git fetch --tags | |
last_tag=$(git describe --tags --abbrev=0) | |
branch=$(git rev-parse --abbrev-ref HEAD) |
This file contains hidden or 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
# | |
# Increment SemVer git tags without mistakes. | |
# | |
# For SemVer, check https://semver.org/. | |
# | |
function New-SemVer() { | |
# Create annotated git tag in SemVer format. | |
# Based on first argument, appropriate version part will be increased by one. | |
# |
This file contains hidden or 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
-- Get disk usage statistics about all tables in all schemas. | |
-- Tables with high bytes/row ratio can be good candidates for normalization | |
-- | |
-- Database Engine: PostgreSQL | |
SELECT *, | |
pg_size_pretty(total_bytes) AS "total", | |
pg_size_pretty(index_bytes) AS "index", | |
pg_size_pretty(toast_bytes) AS "toast", | |
pg_size_pretty(table_bytes) AS "table", |