Skip to content

Instantly share code, notes, and snippets.

import linecache
import re
import sys
from types import TracebackType
from typing import Any, Dict, List, Optional
PACKAGE_PATH_PATTERN = r'.*/lib/python.*/site-packages/.*'
class TracebackLogger:
bmatthewshea /
Last active Jul 27, 2022
Ubuntu 20 - CERTBOT without SNAP/SNAPD

CERTBOT - Install using Python PIP

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.

jerieljan /
Created May 22, 2021
Screenshot OCR with BetterTouchTool on MacOS
#!/usr/bin/env bash
# Usage:
# - Install `tesseract` with `brew install tesseract`
# - In BetterTouchTool, create a trigger of your choice.
# (I recommend a Keyboard Shortcut with Cmd+Shift 6)
# - Add an Execute Shell Script / Task action
# - Paste this script.
# NOTE: You'll need to authorize BTT to the Screen Recording permission in Security and Privacy at System Preferences
tonetheman /
Created Sep 27, 2020
find a radio button to click on
URI = ""
from selenium.webdriver import Chrome, ChromeOptions
from import expected_conditions as EC
from import WebDriverWait
from import By
dnanto / geomid.R
Created Jun 25, 2020
Calculate the geographic midpoint given a list of geographic coordinates in R.
View geomid.R
geomid <- function(lat, lon)
lat <- lat * pi / 180
lon <- lon * pi / 180
x <- mean(sum(cos(lat) * cos(lon)))
y <- mean(sum(cos(lat) * sin(lon)))
z <- mean(sum(sin(lat)))
kix2mix2 /
Created Jan 27, 2020
K-Nearest Center of Gravity Graph (KNCG)
def get_kncg(df, K=4):
# df is a pandas dataframe with mandatory columns ['x','y']
graph = get_knntree(df, 1)
for node_a, row in df.iterrows():
if node_a % KK_prints == 0:
node_a_coord = list(row[:2])
ncns = []
TheCloudScout / dockerfile
Created Nov 4, 2019
View dockerfile
# escape=`
# Install .NET 4.8
RUN curl -fSLo dotnet-framework-installer.exe `
&& .\dotnet-framework-installer.exe /q `
&& del .\dotnet-framework-installer.exe `
&& powershell Remove-Item -Force -Recurse ${Env:TEMP}\*
nestukh /
Last active Aug 15, 2022
Install firefox-esr + geckodriver + selenium + python3 on raspberry pi 3 and above
pypcks="python3-pip python3 python3-all-dev python3-dev libffi-dev libssl-dev librtmp-dev python-dev python3 python3-doc python3-tk python3-setuptools tix xvfb python-bluez python-gobject python-dbus python cython python-doc python-tk python-numpy python-scipy python-qt4 python3-pyqt5 python3-pyqt5.q* python3-qtpy python-pyqt5.q* python-lxml fontconfig python-demjson qt5-default libqt5webkit5-dev build-essential libudev-dev python-lxml libxml2-dev libxslt-dev libpq-dev python-pyside python-distlib python-pip python-setuptools" # python-examples python3-examples python-vte
allgoodpcks="ca-certificates virtualenv autotools-dev cdbs git expect libnss3-tools util-linux xvfb curl bridge-utils chromium-browser chromium-chromedriver firefox-esr"
sudo apt-get install --reinstall -y $pypcks $allgoodpcks
if [[ ! -f /usr/lib/chromium-browser/chromedriver ]]; then
sudo ln -s /usr/bin/chromedriver /usr/lib/chromium-browser/chromedriver
jftuga / bufWrite.go
Created Sep 9, 2019
demonstrates how to either write to STDOUT or to a buffer in golang
View bufWrite.go
// demonstrates how to either write to STDOUT or to a buffer
package main
import (