Skip to content

Instantly share code, notes, and snippets.

@jermenkoo
jermenkoo / roshambo.py
Created September 29, 2013 07:16 — forked from sysr-q/roshambo.py
# -*- coding: utf-8 -*-
h = type("", (), {})
a = "__gt__"
c = type("Scissors", (h,), {a: lambda a,c: o(c,k)})
k = type("Paper", (h,), {a: lambda c,k: o(k,f)})
f = type("Rock", (h,), {a: lambda h,a: o(a,c)})
o = isinstance
r = {c.__name__.lower():c for c in h.__subclasses__()}
u = None
m = lambda r: __import__(r)
def get_candidate_boards(board):
boards = []
queen_locations = [(x, y) for x in range(len(board)) for y in range(len(board)) if board[x][y] == "Q"]
left_diagonals = [(x-y, 0) for (x, y) in queen_locations]
right_diagonals = [(x+y, 0) for (x, y) in queen_locations]
for x, y in ((x, y) for x in range(len(board)) for y in range(len(board)) if board[x][y] != "Q"):
temp_board = board[:x] + [board[x][:y] + ["Q"] + board[x][y+1:]] + board[x+1:]
valid_cols = all(col.count("Q") < 2 for col in temp_board)
valid_rows = all(row.count("Q") < 2 for row in zip(*temp_board))
@jermenkoo
jermenkoo / gist:3484125
Created August 26, 2012 22:58 — forked from ajvpot/gist:3115176
Minecraft Migrated Account Session Vulnerability
                  ████▓               
               ▓█▓▓▓▓▓██▒              
             ▒██▒▒▒▒▒▒▒▓█▓             
            ▓█▓▒▒▒▒▒▒▒▒▒▒██            
           ██▒▒▒▒▓███▓▒▒▒▒▓█▒          
         ▒█▓▒▓▓▓██▓░▓█▓▓▓▓▓▓█▓         
        ▓█▓▓▓▓▓██▓   ▒██▓▓▓▓▓██▒       
      ▒██▓▓▓▓███       ███▓▓▓▓██▓      
     ▓██▓█████▒         ▒█████████     

▒█████████ ▒▓▓▓▓▓▓▓▓▒▓█████████▒

@jermenkoo
jermenkoo / vulnerability.md
Created August 26, 2012 22:57 — forked from klange/vulnerability.md
Rack session secret vulnerability in Level 5 and Level 6 of Stripe CTF 2.0
$ openssl s_client -connect level06-2.stripe-ctf.com:443
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=Stripe, Inc./OU=Security Department/CN=*.stripe-ctf.com
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3
1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3