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
#! python | |
# encoding=utf-8 | |
""" | |
SendBig | |
Send bigger files than the email limit. | |
""" | |
import sys | |
import os |
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
# coding: utf-8 | |
""" | |
check_windows_locked.py | |
Copyright: (c) Steve Barnes 2024 | |
Author: Steve Barnes <[email protected]> | |
Check if a windows system is screen locked. | |
""" | |
import sys |
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
""" | |
Importable get called from file & location. | |
Based on a tweet by Ned Batchelder @nedbat | |
""" | |
import inspect | |
def where_am_i(): | |
""" Return the current filename and line number. """ | |
bf = inspect.currentframe().f_back | |
return (bf.f_globals.get("__file__", "interactive"), bf.f_lineno) |
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
# coding: utf-8 | |
# Originally from a tweet by Ned Batchelder @nedbat | |
import inspect | |
def __line__(): | |
""" Return the current line number. """ | |
return inspect.currentframe().f_back.f_lineno | |
if __name__ == "__main__": | |
print(f"At {__line__()} of {__file__}") |
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
#!/usr/bin/env python | |
""" | |
This script is based on https://cgi.tutorial.codepoint.net/file-upload but with changes as needed. | |
To use: | |
- Download the web page to be debugged. | |
- Edit it to replace `action="/cgi-bin/cgi-post"` with `action="/cgi-bin/cgi-post.py"` (on Windows on Linux you can simply rename this file to not have .py at the end. | |
- place in a cgi-bin subdirectory of the one where you saved the web page | |
- start a simple web server with ` python -m http.server 8001 --bind localhost --cgi` |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import pkg_resources | |
def get_pkg_license(pkgname): | |
""" | |
Given a package reference (as from requirements.txt), |
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
Set-ItemProperty Registry::HKEY_CLASSES_ROOT\.py -Name PerceivedType -Value text | |
Set-ItemProperty Registry::HKEY_CLASSES_ROOT\.pyw -Name PerceivedType -Value text | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/usr/bin/env python | |
# encoding utf-8 | |
""" | |
If you set your PYTHONSTARTUP environment variable to point to this file | |
with an absolute path then it will change your python 2 prompt to countdown | |
to the End Of Life of Python 2. | |
Copyright Steve Barnes <[email protected]> 2017 | |
License: Creative Commons | |
""" |
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
from distutils.version import LooseVersion | |
if LooseVersion(requests.__version__) <= LooseVersion('2.2.0'): | |
raise SystemExit("This program requires Python requests 2.2.0 or later.") | |
NewerOlder