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 datetime | |
def fib(a): | |
if (a>2): | |
return fib(a-1) + fib (a-2) | |
elif (a==1 or a==2): | |
return 1 | |
elif (a<1): | |
return 0 |
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
while (document.body.childNodes.length>0) { | |
document.body.childNodes[0].remove(); | |
} | |
var can=document.createElement("CANVAS"); | |
can.width=1500; | |
can.height=1000; | |
can.id="t1000_500"; | |
document.body.appendChild(can); | |
var ctx=can.getContext("2d"); |
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
from java.awt import Color | |
from javax.swing import JFrame | |
from java.awt.image import BufferedImage | |
from java.util import Random | |
from java.lang import Thread | |
def getBackground(WIDTH,HEIGHT,size): | |
rand=Random() | |
background = BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB) |
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>Canvas tutorial</title> | |
</head> | |
<body> | |
<canvas id="tutorial" width="1000" height="700"></canvas> | |
<script type="text/javascript"> | |
var can=document.getElementById("tutorial"); |
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 java.awt.*; | |
import javax.swing.*; | |
import java.awt.image.*; | |
import java.awt.event.*; | |
import java.awt.geom.*; | |
import java.util.Random; | |
public class Static extends JFrame | |
{ | |
static int HEIGHT; |
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 java.awt.*; | |
import javax.swing.*; | |
import java.awt.image.*; | |
import java.awt.event.*; | |
import java.awt.geom.*; | |
import java.util.Random; | |
public class AShape | |
{ | |
public int scale; |
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 time, random, sys, pygame | |
from pygame.locals import * | |
i=0 | |
rows=600 | |
cols=1200 | |
def getBackground(r,c,size): |
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 time, random, sys | |
myrules = [2, # <2 life->death, >=2 life->life | |
4, # <=4 life->life, >4 life-> death | |
3] # =3 death->life (REPRODUCE) | |
conwayrules = [2,3,3] | |
rules = conwayrules | |
startprob = float(sys.argv[1]) # a random selection of all cells will begin alive |
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 time | |
def st(a): | |
return "".join([str(k).replace("0","-").replace("1","X") for k in a]) | |
def iter(a,r): | |
x=zeroes(width) | |
ww=width-1 |
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
FROM = 'default from address' | |
SERVER = 'default mailer server' | |
######################################################################################################################## | |
# begin mailer.py | |
""" | |
mailer module | |
Simple front end to the smtplib and email modules, | |
to simplify sending email. |