Skip to content

Instantly share code, notes, and snippets.

View vepetkov's full-sized avatar

V. Petkov vepetkov

  • Munich, Germany
View GitHub Profile
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import tarfile
import json
def get_tar_metadata(file_name):
tar = tarfile.open(file_name, encoding="iso8859-1")
# Test SMTP with STARTTLS
openssl s_client -showcerts -connect smtp.office365.com:587 -servername smtp.office365.com -starttls smtp
# Test IMAP with SSL/TLS
openssl s_client -showcerts -connect outlook.office365.com:993 -servername outlook.office365.com
# Test POP3 with SSL/TLS
openssl s_client -showcerts -connect outlook.office365.com:995 -servername outlook.office365.com
@vepetkov
vepetkov / direnvrc
Created July 14, 2023 09:14
Load .venv automatically using DirEnv
# Store in ~/.config/direnv/direnvrc to run for all folders automatically
# check if VENV is loaded
if [[ -z "${VIRTUAL_ENV_PROMPT}" ]] ; then
if [ ! -d ".venv" ] ; then
echo "Installing virtualenv for $(python -V)"
python -m venv .venv
fi
echo "Activating $(python -V) virtualenv from .venv"
source .venv/bin/activate
fi
# Parse the whole git history and show files larger than 1Mb (2^20 b)
git rev-list --objects --all |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
sed -n 's/^blob //p' |
awk '$2 >= 2^20' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest