This file contains 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 parse(grid): | |
''' Parses a Sudoku grid by converting it from xxx...x..xx....xx format to a friendly-looking grid. | |
Sample input: ...5.14582.14.28.1.99128.9..2....992...536..89.8....7.....1..9.93.3.9..219.....7. | |
Sample output: | |
. . . | 5 . 1 | 4 5 8 | |
2 . 1 | 4 . 2 | 8 . 1 | |
. 9 9 | 1 2 8 | . 9 . | |
- - - - - - - - - - - |
This file contains 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
# Written by: Assil Ksiksi | |
# Date: Decemeber 28th, 2011 | |
# A simple script that "slices" a Sudoku grid into 9 3x3 boxes. A similar method | |
# may be included in my Sudoku solver to determine whether or not a number can | |
# be placed in a certain cell. Should also be applicable to rows and columns. | |
from random import seed, choice | |
def create_grid(): |
This file contains 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
# Written by Assil Ksiksi | |
# Date: Thursday, December 29th, 3:12 am (GMT +4) | |
# I basically wrote this to determine whether or not a pattern exists in the products of the digits | |
# of all 5-digit numbers. Sadly, none exist, or at least I didn't see one. | |
# Runtime is fairly slow. It takes 1.05916786194s for all 5-digit numbers. I don't see how it | |
# can be optimized, so that should do the trick. | |
# References: |
This file contains 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 choice | |
types = [ | |
map(chr, range(97, 123)), | |
map(chr, range(65, 91)), | |
range(0, 10) | |
] | |
def password_gen(length): # Generates a random password | |
password = [] |
This file contains 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
# Uses httplib2 instead of urllib2 - runs faster | |
#import urllib2 | |
import httplib2 | |
import time | |
s = time.time() | |
game_console = {} |
This file contains 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 urllib2 | |
import time | |
s = time.time() | |
sources = {'week': 0, 'month': 0, 'year': 0} | |
for type in sources.iterkeys(): | |
response = urllib2.urlopen("http://www.goodreads.com/book/most_read?category=all&country=all&duration=" + type[0]) | |
sources[type] = response.read() |
This file contains 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
# Finds a root of a number using Newton's method. Outputs the first 5 approximations. | |
def newton(n, x): | |
x1 = x - (x*x-n)/(2*x*x) | |
return x1 | |
root = float(raw_input("Enter a number to approximate the square root of: ")) | |
approx = float(raw_input("Enter approximation for root: ")) | |
print '' |
This file contains 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
################################################################# | |
## Written by: Assil Ksiksi ## | |
## ## ## ## | |
## Scrapes IMDB for movie IDs, makes API requests, then writes ## | |
## the results to a database. ## | |
## ## ## ## | |
################################################################# | |
import re, requests, sqlite3, json, time |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
#!/usr/bin/python | |
''' | |
Outputs a Cadence ADE stimulus file for n input vectors. | |
Supports Python 2.x only. I created this for use on a RHEL | |
box running Cadence. | |
Global variables | |
SOURCE: the source type generated for each bit of the vectors. |
OlderNewer