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 __future__ import division | |
| def gcd(a, b): | |
| if a == 0: | |
| return 1 | |
| while b != 0: | |
| t = b | |
| b = a % b | |
| a = t |
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 random | |
| size = 20 | |
| #on = [(1,1),(1,2),(1,3)] #Blinker | |
| #on = [(1,0),(2,1),(0,2),(1,2),(2,2)] #Glider | |
| on = [(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(9,2),(10,2),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(9,3),(10,3),(9,4),(10,4),(2,5),(3,5),(9,5),(10,5),(2,6),(3,6),(9,6),(10,6),(2,7),(3,7),(9,7),(10,7),(2,8),(3,8),(2,9),(3,9),(5,9),(6,9),(7,9),(8,9),(9,9),(10,9),(2,10),(3,10),(5,10),(6,10),(7,10),(8,10),(9,10),(10,10)] | |
| #^ Galaxy | |
| #on = [(24, 0), (22, 1), (24, 1), (12, 2), (13, 2), (20, 2), (21, 2), (34, 2), (35, 2), (11, 3), (15, 3), (20, 3), (21, 3), (34, 3), (35, 3), (0, 4), (1, 4), (10, 4), (16, 4), (20, 4), (21, 4), (0, 5), (1, 5), (10, 5), (14, 5), (16, 5), (17, 5), (22, 5), (24, 5), (10, 6), (16, 6), (24, 6), (11, 7), (15, 7), (12, 8), (13, 8)] | |
| #^Glider gun, 60 iters (start at 60) | |
| #on = [(random.randint(0,size),random.randint(0,size)) for _ in range(random.randint(1,size**2))] #Random |
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
| Level 1: | |
| set url to https://xss-game.appspot.com/level1/frame?query=<script>alert(1)</script> | |
| Level 2: | |
| post <img src="x" onerror="alert(1)" /> in message box | |
| Level 3: | |
| set url to https://xss-game.appspot.com/level3/frame#x' onerror='alert(1)' /> | |
| Level 4: | |
| set url to https://xss-game.appspot.com/level4/frame?timer=3');+alert(1);+// | |
| Level 5: | |
| set url to https://xss-game.appspot.com/level5/frame/signup?next=javascript:alert(1) and click Next >> |
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 random import randrange | |
| from PIL import Image | |
| colortrans = [ | |
| (255,0,0), | |
| (255,127,0), | |
| (255,255,0), | |
| (127,255,0), | |
| (0,255,0), | |
| (0,255,127), |
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 math import floor as fl | |
| from math import sqrt | |
| from random import randint | |
| def ctuple(z): | |
| return z.real, z.imag | |
| def floor(x): | |
| if x < 0: | |
| return -fl(-x) |
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
| # -*- coding: utf-8 -*- | |
| from PIL import Image | |
| import sys | |
| THRESH = int(sys.argv[2]) if len(sys.argv) > 2 else 200 | |
| col = Image.open(sys.argv[1]) | |
| col.thumbnail((128, 128), Image.ANTIALIAS) | |
| w, h = col.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
| from __future__ import division | |
| import pygame | |
| import sys | |
| import os | |
| pygame.init() | |
| scr = pygame.display.set_mode((200,200)) | |
| psx = -2 | |
| psy = -2 |
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 __future__ import division | |
| import pygame | |
| import sys | |
| import os | |
| import math | |
| pygame.init() | |
| scr = pygame.display.set_mode((200,200)) | |
| psx = -2 |
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 turtle | |
| import random | |
| t = turtle.Turtle() | |
| s = turtle.Screen() | |
| n = 30 # width of board, in cells, must be even | |
| width = 10 # width of cell, in turtle units | |
| dot_size = 0 # dot 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
| o=w=0;s=" ";b=[s]*9 | |
| while 1: | |
| print"\n".join(["".join(b[x:x+3])for x in 0,3,6]) | |
| if w:break | |
| h=~-input();z=b[h]==s;b[h]=[b[h],"XO"[o]][z];o=[o,2+~o][z] | |
| for i in range(8): | |
| e,f,g=map(int,`0x341a4a6fa990a9ee254e`[i*3:][:3]);w|=(b[e]==b[f]==b[g]!=s) |