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
# | |
# py_rac.py | |
# | |
# Copyright 2020, Paul McGuire | |
# | |
names = ("Voltaire|Samuel Johnson|Valery|Dante|" | |
"Nietzsche|Kant|Lao Tzu|Macchiavelli|Einstein|" | |
"Russell|Leonardo|Plato|Aristotle|Socrates|Diderot|" | |
"Descartes|Thomas Aquinas|Hawking|Emerson|Faulkner|" |
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
# | |
# rcu.py | |
# | |
# Paul McGuire - November, 2020 | |
# | |
from contextlib import contextmanager | |
import copy | |
import threading | |
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 PROBLEM | |
# | |
# create a generator and list out its items | |
a = (n**2 for n in range(10)) | |
print(list(a)) | |
# listing it out again creates an empty list because the generator has been consumed; | |
# generators in this state will continue to raise StopIteration, but caller will take |
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
""" | |
bmp.py - module for constructing simple BMP graphics files | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: |
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
def ๐๐ฎ๐๐๐(): | |
try: | |
๐ฅe๐ ๐๐๏ธด = "Hello" | |
๐จ๐ฌr๐ตแต๏น = "World" | |
แต๐๐ข๐ฏ๐ฝ(f"{๐ต๏ฝ ๐ต๐ฉยบ_}, {๐โ๐lโ ๏ธด}!") | |
except ๐ฃ๐ชแต๏ฝ ๐ค๐ฟแตฃ๐๐ as โ ๐c: | |
๐rโนโโ("failed: {}".๐๐ผสณแตยช๏ฝ(แต๐ฑ๐ฌ)) | |
# snippet from unittest/util.py |
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 rich.progress | |
import rich.spinner | |
import time | |
import random | |
class RandomChars(rich.progress.ProgressColumn): | |
"""Simulation of computer 'thinking' by displaying random characters | |
Args: | |
chars (str): characters from which to choose for display. Defaults to 0-9A-F. |
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
<html> | |
<head> | |
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
<py-env> | |
- pyparsing==3.0.9 | |
- railroad-diagrams | |
- jinja2 | |
</py-env> | |
<py-script> |
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
<html> | |
<head> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
</head> | |
<body> | |
<table cellpadding=30 border=2> | |
<tr> | |
<td> |
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
<html> | |
<head> | |
<script defer src="https://pyscript.net/alpha/pyscript.min.js"></script> | |
<py-env> | |
- littletable | |
</py-env> | |
</head> | |
<body> | |
<h2>Iris data</h2> |
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
<html> | |
<head> | |
<title>Plusminus Dice Roller</title> | |
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
<py-env> | |
- plusminus | |
</py-env> | |
</head> |