Skip to content

Instantly share code, notes, and snippets.

@jpsutton
jpsutton / explainshell.sh
Last active August 25, 2022 15:55
CLI interface to explainshell.com
#!/usr/bin/env sh
#
# Explain a given shell command using explanation from explainshell.com
#
# Usage: explainshell <command>
#
# Credit: Derived from https://github.com/benjamine/explain.sh
# License: MIT
URL="$*"
@jpsutton
jpsutton / springframework_scanner.py
Created April 1, 2022 16:03
This python application scans all fixed-disk filesystems (or the root fs on non-windows systems) for jar/war files and reports any with "spring" in the file name or with "springframework" inside of them
#!/usr/bin/env python
import os
import sys
import platform
import tempfile
from zipfile import ZipFile
if platform.system() == "Windows":
import win32api, win32con, win32process
@jpsutton
jpsutton / decorate_private.py
Created May 9, 2019 14:22
Decorate a method to provide it similar "private" semantics as other languages (e.g., C++)
from functools import wraps
import inspect
# This defines a decorator that can be used on an instance method, to stop it from being inherited by child classes
class _private_method(object):
def __init__(self, decorated):
self._decorated = decorated
def __set_name__(self, owner, name):
@wraps(self._decorated)