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
class Coord: | |
""" | |
Coordinates for the row / col / block indices in the puzzle | |
""" | |
def __init__(self, y, x): | |
self.y = y | |
self.x = x | |
self.blky = (int(self.y / 3) * 3) + int(self.x / 3) | |
self.blkx = ((self.y % 3) * 3) + (self.x % 3) | |
self.idx = (y * 9) + 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
def has_repeating(lst): | |
for i in range(1, 10): | |
if lst.count(i) > 1 or lst.count(str(i)) > 1: | |
return False | |
return True | |
def get_row(arr, row): | |
return arr[row] | |
def get_col(arr, col): |
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
class Part: | |
def __init__(self, c): | |
self.match = lambda x: False | |
self.many = False | |
self.literal = False | |
self.char = c | |
if c == ".": | |
self.match = lambda x: True |
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
#!/usr/bin/env python3 | |
from random import shuffle | |
import time | |
import sys | |
# the number of times to repeat the test functions | |
iterations = int(sys.argv[1]) if len(sys.argv) > 1 else 10_000 |
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
#!/usr/bin/env python3 | |
import argparse | |
import sys | |
""" | |
Generate a customized wordlist based on target words | |
Mutate a list of input words based on actions, suffixes and join strings | |
By: Dan Griffin |
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
#!/usr/bin/env python3 | |
import argparse | |
class RomanNumerals: | |
SYMBOLS = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000} | |
NUMBERS = {val: key for key, val in SYMBOLS.items()} |
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
#!/usr/bin/python3 | |
# Search for MAC addresses and vendor names in a sqlite database | |
# Download the database as a CSV here https://macaddress.io/database-download/csv | |
# Load the CSV into a sqlite DB table name oui | |
# You can use DB Browser for Sqlite https://sqlitebrowser.org/ | |
import sqlite3 |
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 math | |
""" | |
Test question attempt | |
Checks to see if gears will fit on a beam given a list of peg positions | |
""" | |
class Gears: |
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
class SBoard: | |
def __init__(self): | |
self.placed_tokens = 0 | |
self.grid = [["." for x in range(10)] for y in range(10)] | |
def getNumTokens(self): | |
return self.placed_tokens | |
def placeToken(self, y, x): | |
if y < 0 or y > 9 or x < 0 or x > 9 or self.grid[y][x] != ".": |