Skip to content

Instantly share code, notes, and snippets.

View rsheldiii's full-sized avatar

Bob rsheldiii

View GitHub Profile
@rsheldiii
rsheldiii / rasterizer.py
Created August 24, 2012 18:58
walkaround rasterizer. Supports raster directions to image and most image formats (L,P,RGB,RGBA) to raster directions
import Image,sys,struct,time,os
BLACK,WHITE = 0,1
def rasterToImg(name,width,height,directions):
name,ext = os.path.splitext(name)
arr = [WHITE for j in range(0,width*height)]
x,y = 0,0
size = width,height
dic = {"N":(0,-1), "S" : (0,1) , "E" : (1,0), "W" : (-1,0)}
@rsheldiii
rsheldiii / adfgvx.py
Created June 27, 2012 00:27
adfgvx brute force decryptor. decryption based on wordlist and caesar shift of the alphabet, using the fact that space will be the most prevalent letter
def encodingDict(scrambledAlphabet):
adfgvxIndex = ['A','D','F','G','V','X']
encodeDict = {}
for i in range(0,6):
for j in range(0,6):
encodeDict[scrambledAlphabet[i*6+j]] = adfgvxIndex[i]+adfgvxIndex[j]
return encodeDict
def DecryptOnSpace(encryptedString,codeWord):
@rsheldiii
rsheldiii / adfgvx.py
Created June 26, 2012 19:23
adfgvx encryptor/decryptor
def normalize(plainString,scrambledAlphabet):
plainString = plainString.upper().replace("J","I")
for letter in plainString:
if letter not in scrambledAlphabet:
plainString = plainString.replace(letter,'')
#print(plainString)
return plainString
@rsheldiii
rsheldiii / chess.py
Created June 26, 2012 04:07
chess program for python
"""CONVENTIONS:
positions are done row-column from the bottom left and are both numbers. This corresponds to the alpha-number system in traditional chess while being computationally useful. they are specified as tuples
"""
import itertools
WHITE = "white"
BLACK = "black"
@rsheldiii
rsheldiii / mandelbrot.py
Created June 2, 2012 22:16
pygame mandelbrot
from __future__ import division
import sys, pygame, time
import numpy as N
import pygame.surfarray as surfarray
pygame.init()
size = width, height = 1024,768
xlength,xoffset = 3.5, -2.5