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
import linecache | |
import re | |
import sys | |
from types import TracebackType | |
from typing import Any, Optional | |
PACKAGE_PATH_PATTERN = r'.*/lib/python.*/site-packages/.*' | |
class TracebackLogger: |
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
# the else below should really have been named 'nobreak' | |
for n in range(2, 10): | |
for x in range(2, n): | |
if n % x == 0: | |
print(f"{n} = {x}*{int(n/x)}") | |
break | |
else: # only occurs when 'nobreak' | |
# loop fell through without finding a factor | |
print(f"{n} is a prime number") |
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
#!/bin/bash | |
# change_route53_dns_entry.sh | |
# -John Taylor | |
# 2022-05-01 | |
# Change or add a route53 DNS entry | |
# dependencies: the aws cli, jq | |
# a AWS profile that has IAM permissions for Route53 API calls |
Install Certbot using Python PIP (Package Installer for Python) without using SNAP, APT or SYSTEMD) (Debian/Ubuntu)
This guide will help you install LetsEncrypt / Certbot and a DNS plugin (certbot-dns-route53) using PIP under Debian/Ubuntu.
-
You should already be somewhat familiar with LetsEncrypt, Certbot and any plugin you might need.
-
This guide uses a DNS provider plugin (AWS Route53), but this is really about the install method - not plugins, or validation methods.
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
# Copyright (c) 2018 Bao Nguyen <b@nqbao.com> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
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
r""" | |
dataclass_demo.py | |
-John Taylor | |
2022-03-23 | |
A very quick demo of how to use Python 3 dataclasses. | |
Shows how to define a dict and a list for a dataclass. | |
""" | |
from dataclasses import dataclass, field |