This file contains hidden or 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
(defun multiple-value-plist (properties func &rest args) | |
"Wrap a function call, binding each return value to properties specified in `properties. Returns a plist. | |
For example: | |
(multiple-value-plist '(:return-arg1 :return-arg2) #'func args) | |
would return a plist with properties `return-arg1` and `return-arg2` bound to the first and second values returned from `#'func`." | |
(let ((return-vals (multiple-value-list (apply func args)))) | |
; thanks to copilot for this: |
This file contains hidden or 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
--- /old/_header_value_parser.py 2023-10-26 15:58:17.000000000 -0700 | |
+++ /opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/email/_header_value_parser.py 2023-10-26 15:58:29.000000000 -0700 | |
@@ -1513,6 +1513,9 @@ | |
raise | |
token, value = get_cfws(value) | |
obs_local_part.append(token) | |
+ if not obs_local_part: | |
+ return obs_local_part, value | |
+ | |
if (obs_local_part[0].token_type == 'dot' or |
This file contains hidden or 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
# This finds org-mode links that have slashes in them. I used this to find URLs that needed | |
# org-mode "escaping" with ='s around them (e.g. example.com/this/that/ --> =example.com/this/that/= ) | |
# close ARGV if eof resets $. (the line number) | |
perl -lne 'print "$ARGV $.: $1" if m|(\[https:[^\]]+\]\[[^\]]+/.*?\])|; close ARGV if eof;' * |
This file contains hidden or 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 | |
URL=$1 | |
if [ "x$URL" == "x" ] | |
then | |
echo "Run as: $0 url" | |
exit 1 | |
fi |
This file contains hidden or 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 below code will connect to a very old and insecure MySQL database. Do not use this for anything important! | |
No warranty is expressed or implied. | |
You must use Python ≤3.9 to be able to connect with OpenSSL 1.0 | |
""" | |
ctx = ssl.create_default_context() | |
# https://stackoverflow.com/a/69457639/14068848 | |
ctx.set_ciphers('ALL:@SECLEVEL=0') | |
# https://stackoverflow.com/a/33770290/14068848 |
This file contains hidden or 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
--- unpatched.py 2023-01-05 11:07:46.000000000 -0800 | |
+++ email/_header_value_parser.py 2023-01-05 11:07:06.000000000 -0800 | |
@@ -1485,6 +1485,8 @@ | |
""" | |
obs_local_part = ObsLocalPart() | |
last_non_ws_was_dot = False | |
+ if len(value) >= 3 and value[0]=='[' and value[-2]==']': | |
+ value = value[1:-2] + value[-1] | |
while value and (value[0]=='\\' or value[0] not in PHRASE_ENDS): | |
if value[0] == '.': |
This file contains hidden or 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 logging | |
import os | |
if os.environ.get('DEBUG', False): | |
logging.basicConfig(level=logging.DEBUG) | |
else: | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger() |
This file contains hidden or 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
(browse-url (concat "https://drive.google.com/drive/search?q=type:document%20after:" | |
(format-time-string "%Y-%m-%d" | |
(time-subtract (current-time) (days-to-time 14))))) |
This file contains hidden or 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
# per https://linuxhint.com/extend-xfs-filesystem-linux-without-lvm/ | |
# this assumes there's only one partition, which is true for me with Vagrant+CentOS 7 | |
sudo yum install cloud-utils-growpart gdisk | |
growpart /dev/sda 1 | |
xfs_growfs / |
This file contains hidden or 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 https://hmarr.com/2010/jan/19/making-virtualenv-play-nice-with-git/: | |
# | |
# Automatically activate Git projects' virtual environments based on the | |
# directory name of the project. Virtual environment name can be overridden | |
# by placing a .venv file in the project root with a virtualenv name in it | |
function workon_cwd { | |
# Check that this is a Git repo | |
GIT_DIR=`git rev-parse --git-dir 2> /dev/null` | |
if [ $? == 0 ]; then | |
# Find the repo root and check for virtualenv name override |
NewerOlder