Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
#!/usr/bin/env python3 | |
''' Substring palindromes | |
Find the number of ways a string can be split in a non-overlapping way | |
such that p+q is a palindrome string. Two pairs (p,q) and (p',q') are | |
treated as different iff p is chosen from different position from p' or | |
q is chosen from diff position of q' . | |
For example, take the string abba. The possible substrings which are |
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
#!/usr/bin/env python3 | |
''' Create a closed track from cubic Bezier curves, and animate a circle | |
following the track at constant speed. | |
https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B%C3%A9zier_curves | |
https://gist.github.com/PM2Ring/d6a19f5062b39467ac669a4fb4715779 | |
Press the Add button to add black control dots to the Canvas. The first |
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
#!/usr/bin/env python3 | |
""" Use .after to run several named counters in parallel. | |
Each counter prints its name and value to the terminal, | |
once per second. | |
When the 'New counter' button is clicked, a new | |
counter is created, using the name in `name_entry`, and | |
a 'Stop' button with the same name is added to the GUI. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
#! /usr/bin/env python3 | |
''' Generalization of the 'Fitch' Cheney card trick | |
Written by PM 2Ring 2003.02.13 | |
Converted to Python 2018.06.27 | |
''' | |
import sys | |
import readline |