Skip to content

Instantly share code, notes, and snippets.

View matthewdeanmartin's full-sized avatar
🦥
Gotta upgrade the packages

Matthew Martin matthewdeanmartin

🦥
Gotta upgrade the packages
View GitHub Profile
@matthewdeanmartin
matthewdeanmartin / war.py
Created April 3, 2021 16:08
War card game as a coding kata
# remove the input (dependency injection here)
# prefer returns over prints (I'm violating that here)
# for each ~5 lines of code, break into functions
# start with good names
# start adding assertions and then unit tests to clean up the bugs (also violated here)
# until I do that last part, I'm not really sure if this really works.
import random
def games(input):
@matthewdeanmartin
matthewdeanmartin / things.py
Last active April 17, 2021 02:19
Patching two things
from module import fallback
from module import send_email
def email_report():
try:
# mocks just fine, if I mock just one thing
send_email()
except:
# hard to mock, tried many, many things.
fallback()
PROJECT := src
tests:
# run those tests
pytest $(PROJECT) --doctest-modules
lint:
# pick ones that match target generator & syntax
# can't figure out how to enable just doc related
# pylint pydoc_fork --disable=all --enable=basic,spelling

Keybase proof

I hereby claim:

  • I am matthewdeanmartin on github.
  • I am matthewmartin (https://keybase.io/matthewmartin) on keybase.
  • I have a public key whose fingerprint is B872 7483 FE04 D5DF 646F FE24 C9BF 8F64 F7C8 3FA8

To claim this, I am signing this object:

@matthewdeanmartin
matthewdeanmartin / evileliza.py
Created December 2, 2022 21:48
gptchat generated evil eliza
# Define the EvilEliza chat bot
class EvilEliza:
# Define the possible EvilEliza responses
responses = [
"I don't think you're ready to face the truth.",
"You're just making excuses for your own failure.",
"Your problems are all in your head. You need to snap out of it.",
"You're not really trying to get better, are you?",
"Why do you bother talking to me if you don't want to change?",
]
@matthewdeanmartin
matthewdeanmartin / paper_scissor_rock.sh
Created December 3, 2022 21:01
ChatGPT generated paper scissors rock in BASH!! Clean code. Just insane
# Set the initial values for the game
player_score=0
computer_score=0
# Define the function for playing a round of the game
play_round () {
# Ask the player for their choice
echo "Choose one: paper, scissors, rock"
read player_choice
@matthewdeanmartin
matthewdeanmartin / fizzbuzz.tf
Created December 4, 2022 00:18
fizzbuzz in HCL/terraform chatgpt
# Define a variable to hold the upper limit of the numbers to print
variable "upper_limit" {
default = 100
}
# Define a local value to hold the current number
locals {
current_number = 1
}
# Import the pygame module
import pygame
# Initialize the game
pygame.init()
# Set the screen size and caption
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Pac-Man")
@matthewdeanmartin
matthewdeanmartin / convert_wiki_to_md.py
Created December 5, 2022 15:58
ChatGpt Convert markdown to mediawiki
def markdown_to_mediawiki(input_string: str) -> str:
# Initialize the output string
output_string = input_string
# Convert bold and italic text
output_string = output_string.replace('**', "'''")
output_string = output_string.replace('__', "''")
output_string = output_string.replace('*', "''")
# Convert heading levels
@matthewdeanmartin
matthewdeanmartin / oregon.py
Created December 5, 2022 17:57
ChatGPT oregon trail clone
# Define a function that represents the game
def play_oregon_trail():
# Initialize the game variables
distance_traveled = 0
supplies = 100
health = 100
weather = "sunny"
# Print the game introduction
print("Welcome to the Oregon Trail! You are a pioneer traveling west in search of a new life.\n")