This file contains 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 gist provides a web page (time.php) that contains an image that is updated hourly. | |
It is intended to be used with a directory of images with hashed filenames, generated by renameseq.py and shafile.py, and the event server timesse.php to make a "slow movie", rather like xkcd.com/time. | |
The php file are put on the web server, and the python files can be put somewhere that python will find them. They should work ok in python2. |
This file contains 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 | |
## Example of using the jqmath library. | |
import cgi | |
from multipletest import Quiz | |
mathsq= Quiz("Trig quiz") |
This file contains 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 | |
from socket import * | |
import sys | |
s = socket(AF_INET,SOCK_DGRAM) | |
try: | |
port = int(sys.argv[2]) | |
except ValueError: |
This file contains 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 | |
# Simulate church bell changes ringing. | |
# It requires six .wav files representing six bells. | |
# They should be less than five seconds long. | |
# You might try for bells pitched at C,D,E,G,A,C. | |
# | |
# The output is written to changes.wav | |
import random |
This file contains 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
#:kivy 1.0.0 | |
<Battle>: | |
hp_player: player_stam | |
hp_monster: monster_stam | |
sk_player: player_skill | |
sk_monster: monster_skill | |
GridLayout: |
This file contains 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 | |
import tkinter as tk | |
import numpy as np | |
from numpy import sin, cos, sqrt | |
G = 6.67384e-11 # m^3 kg-1 s-2 | |
DEG = np.pi / 180 | |
AU = 1.49597871e11 # for converting to meters | |
METRE = 1 / 1.49597871e11 # for converting to AU |
This file contains 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 | |
#Usbourne Computer Battlegames was a type-in computer games book | |
#from the 1980s. | |
#This is a version of "Battle at Traitors Castle" game. | |
#Original BASIC by Daniel Isaaman and Jenny Tyler | |
import curses |
This file contains 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 | |
# Usbourne Computer Space Games was a type-in computer games book | |
# from the 1980s. This is a version of "Moonlander" game. | |
# Original BASIC by Daniel Isaaman and Jenny Tyler | |
from time import sleep | |
print(chr(27) + "[2J") # Clear screen | |
print("Moonlander") | |
#Set the starting values |
This file contains 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 turtle as t | |
xstart = 3.2 | |
ystart = 0 | |
xend = 4 | |
yend = 1 | |
xstep = 0.5*(xend-xstart)/t.screensize()[0] | |
convergesteps = 100 |
This file contains 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 python | |
# -*- coding: utf-8 -*- | |
import datetime as dt | |
import numpy | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import matplotlib.dates as md | |
import locale | |
from functools import reduce | |
locale.setlocale(locale.LC_ALL, "") |
OlderNewer