Skip to content

Instantly share code, notes, and snippets.

@Radcliffe
Radcliffe / covid19report.py
Created March 17, 2020 18:41
Python script to display a Covid-19 report
# This Python 3 script displays a Covid-19 report.
#
# Usage: Type the following command in a terminal window.
# python3 covidreport.py
#
# Author: David Radcliffe ([email protected])
# License: Public domain
# Date: 17 March 2020
from datetime import datetime
@Radcliffe
Radcliffe / check-security-updates.sh
Created November 28, 2020 05:15
Check for security updates on an Ubuntu server and send email notifications via Sendgrid
#!/bin/bash
# Script to send an email notification via Sendgrid when there are security updates pending for an Ubuntu server.
# Sendgrid API reference
# https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html
# Bash Guide on if-statements
# https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
@Radcliffe
Radcliffe / a049463.py
Last active August 2, 2021 04:11
Python script for sequence A049463, Number of basic interval orders of length n.
# See https://oeis.org/A049463
from functools import lru_cache
@lru_cache(maxsize = None)
def binom(n, k):
return 1 if k == 0 else n * binom(n - 1, k - 1) // k
@Radcliffe
Radcliffe / umn-open-textbook-library.json
Created August 10, 2021 04:02
UMN Open Textbook Library
This file has been truncated, but you can view the full file.
[
{
"category": "Business",
"description": [
"Principles of Accounting is designed to meet the scope and sequence requirements of a two-semester accounting course that covers the fundamentals of financial and managerial accounting. Due to the comprehensive nature of the material, we are offering the book in two volumes. This book is specifically designed to appeal to both accounting and non-accounting majors, exposing students to the core concepts of accounting in familiar ways to build a strong foundation that can be applied across business fields. Each chapter opens with a relatable real-life scenario for today\u2019s college student. Thoughtfully designed examples are presented throughout each chapter, allowing students to build on emerging accounting knowledge. Concepts are further reinforced through applicable connections to more detailed business processes. Students are immersed in the \u201cwhy\u201d as well as the \u201chow\u201d aspects of accounting in order to reinfo
@Radcliffe
Radcliffe / million-digits-of-e-factorial-number-system.txt
Created August 11, 2021 13:26
A million digits of e in the factorial number system
This file has been truncated, but you can view the full file.
10.1111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
1111111111 1111111111 1111111111 1
@Radcliffe
Radcliffe / banned-books-krause-tx.csv
Last active February 10, 2022 22:57
List of books targeted by TX Rep Matt Krause because they could make students feel uneasy - https://www.npr.org/2021/10/28/1050013664/texas-lawmaker-matt-krause-launches-inquiry-into-850-books
Id Title Author Published
1 2020 Black Lives Matter marches Markovics, Joyce L. 2021
2 A complicated love story set in space Hutchinson, Shaun David 2021
3 A lesson in vengeance Lee, Victoria 2021
4 As far as you'll take me Stamper, Phil 2021
5 Be dazzled La Sala, Ryan 2021
6 Black Lives Matter: from hashtag to the streets Tyner, Artika R. 2021
7 Can't take that away Salvatore, Steven 2021
8 Follow your arrow Verdi, Jessica 2021
9 Have I ever told you Black lives matter King, Shani M. 2021
@Radcliffe
Radcliffe / wordle_github.py
Created April 9, 2022 21:32
Python script to determine the optimal starting guess for Wordle using Shannon information entropy.
# This Python script calculates the Shannon information entropy
# for each initial guess in Wordle. Words with high entropy are
# good starting guesses for Wordle.
import numpy as np
import requests
from collections import Counter
row_no word entropy common
1 aahed 4.362783642191669 0
2 aalii 3.771990047586309 0
3 aargh 4.238290773544474 0
4 aarti 4.721152554643121 0
5 abaca 3.1609708082638783 0
6 abaci 3.8954555305197296 0
7 aback 3.5158731254520146 1
8 abacs 3.9283319916149892 0
9 abaft 3.8007453818790453 0
We can't make this file beautiful and searchable because it's too large.
Plate_name
00018V
0007KEN
001M
001RAM
001VVVV
00360MV
00567MF
007BOND
007DIVA
@Radcliffe
Radcliffe / square_and_cube_have_all_digits.py
Created December 13, 2022 21:47
Python script to solve a math puzzle related to 69
"""
The number 69 has a remarkable property: it is the only number whose square and cube together
contain every digit exactly once.
Is an AI agent able to write a program to solve this problem? I gave the following prompt to ChatGPT:
"Write a Python script to find a two-digit number whose square and cube together contain all 10 digits."
Here is the code that it produced. The code is well-written, and it actually works!
"""