Skip to content

Instantly share code, notes, and snippets.

View tdulcet's full-sized avatar

Teal Dulcet tdulcet

View GitHub Profile
@tdulcet
tdulcet / autoconfig.py
Last active April 24, 2025 20:15
Check an ISP database (ISPDB) to see if the configurations are provided directly by the provider. Supports Python 3.6+.
#!/usr/bin/env python3
# Copyright © Teal Dulcet
# Check an ISP database (ISPDB) to see if the configurations are provided directly by the provider
# Run: python3 autoconfig.py <path to config directory>
# # Check the Mozilla ISPDB:
# git clone https://github.com/thunderbird/autoconfig.git
# python3 autoconfig.py autoconfig/ispdb/
@tdulcet
tdulcet / validate.py
Last active April 24, 2025 20:12
Validate an ISP database (ISPDB) of mail (IMAP, POP, SMTP), contacts sync (CardDAV), calendar sync (CalDAV) and file storage (WebDAV) server configurations, such as the Mozilla ISPDB. Supports Python 3.6+.
#!/usr/bin/env python3
# Copyright © Teal Dulcet
# Validate an ISP database (ISPDB) of mail (IMAP, POP, SMTP), contacts sync (CardDAV), calendar sync (CalDAV) and file storage (WebDAV) server configurations
# Run: python3 validate.py <path to config directory>
# # Validate the Mozilla ISPDB:
# git clone https://github.com/thunderbird/autoconfig.git
# python3 validate.py autoconfig/ispdb/
@tdulcet
tdulcet / is_prime.py
Last active December 21, 2024 16:41
Benchmark 34 variations of an is_prime function in Python. Implements the wheel factorization, Miller–Rabin and Baillie–PSW primality tests, among other algorithms. Supports both Python 2 and 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Teal Dulcet
# python3 -OO prime.py <number>
# python2 -OO prime.py <number>
# pypy3 -OO prime.py <number>
# pypy -OO prime.py <number>
from __future__ import division, print_function, unicode_literals
@tdulcet
tdulcet / watch.py
Last active May 29, 2025 09:58
Watch for when new results are added to the `results.txt` file and when new proof files are added to the `proof` directory on Windows, macOS and Linux.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © Teal Dulcet
# Run: python3 -X dev watch.py
from __future__ import division, print_function, unicode_literals
import ctypes
import logging
@tdulcet
tdulcet / autofix.py
Last active April 1, 2025 12:03
Interactively apply Ruff autofixes per rule and optionally commit the changes.
#!/usr/bin/env python3
# Copyright © Teal Dulcet
# Interactively apply Ruff autofixes per rule and optionally commit the changes
# Also see: https://github.com/astral-sh/ruff/issues/4361
# Run: python3 autofix.py [Ruff args]...
import json
import os
@tdulcet
tdulcet / makemake.sh
Last active October 22, 2023 15:55
Ernst W. Mayer's makemake.sh script for Mlucas v21 posthumously released. Includes support for building Mfactor.
#!/bin/bash
# EWM: This is a makefile-only cutdown of Teal Dulcet's much more extensive Mlucas install/build/tune
# script, available at https://raw.github.com/tdulcet/Distributed-Computing-Scripts/master/mlucas.sh ;
# he does not explicitly use the GPL boilerplate as below, but assures me his version is GPL-covered.
################################################################################
# #
# (C) 2021 by Ernst W. Mayer and Teal Dulcet. #
# #
@tdulcet
tdulcet / gimps_status.py
Last active October 7, 2024 12:56
Read Prime95/MPrime, Mlucas, GpuOwl/PRPLL, CUDALucas, CUDAPm1, mfaktc and mfakto save/checkpoint and proof files, and display status of them. Supports both Python 2 and 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Read Prime95/MPrime, Mlucas, GpuOwl/PRPLL, CUDALucas, CUDAPm1, mfaktc and mfakto save/checkpoint and proof files, and display status of them."""
# Adapted from: https://github.com/sethtroisi/prime95/blob/py_status_report/prime95_status.py
# Copyright (c) 2021-2024 Seth Troisi and Teal Dulcet
#
# This program is free software: you can redistribute it and/or modify
@tdulcet
tdulcet / factor.py
Last active November 29, 2024 11:41
Python port of the factor command from GNU Coreutils. Supports both Python 2 and 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Teal Dulcet
# Run: python3 -OO factor.py <number(s)>...
# Run: python2 -OO factor.py <number(s)>...
# Run: pypy3 -OO factor.py <number(s)>...
# Run: pypy -OO factor.py <number(s)>...
# python3 -X dev factor.py {2..100}
@tdulcet
tdulcet / google.py
Last active May 9, 2023 10:59
Generate word list from Google Ngram data for 1-grams. Saves results to a TSV file.
#!/usr/bin/env python3
# Teal Dulcet
# Run: python3 google.py <input TSV file(s)>... <output TSV file>
# export LC_ALL=C.UTF-8
# sudo apt update
# sudo apt install hunspell-tools
@tdulcet
tdulcet / wiktionary.py
Last active May 9, 2023 10:55
Generate word list from Wiktionary JSON extraction. Saves results to a TSV file.
#!/usr/bin/env python3
# Teal Dulcet
# Run: python3 wiktionary.py <input JSON file> <output TSV file>
# export LC_ALL=C.UTF-8
# sudo apt update
# sudo apt install hunspell-tools