Skip to content

Instantly share code, notes, and snippets.

View Broderick-Westrope's full-sized avatar
🍝
eating spaghetti code

Broderick Westrope Broderick-Westrope

🍝
eating spaghetti code
View GitHub Profile
@keraf
keraf / Hangman.md
Last active March 16, 2025 00:38
Simple hangman game written in C# (.NET 6). This was done as an example for a friend who's learning programming.

Hangman

This is a simple hangman game written in C# (.NET 6). This was done as an example for a friend who's learning programming. Hopefully this can be useful to others as well.

How it works

  1. A word is selected from the list of words (value assigned to choosenWord).
  2. We initialize an empty array that will contain all the letters that have been submitted. This array is called letters.
  3. We also store a count of how many lives are left. This variable is called lives.
  4. The main game loop runs as long as the lives have not reached 0.
  5. Inside the loop, the following happens:
  6. We loop through each letter of the choosen word.
@maratori
maratori / .golangci.yml
Last active May 5, 2025 12:24
Golden config for golangci-lint
# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2021-2025 Marat Reymers
## Golden config for golangci-lint v2.1.6
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt it to suit your needs.
# If this config helps you, please consider keeping a link to this file (see the next comment).
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active May 8, 2025 15:51
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Take a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@qpwo
qpwo / monte_carlo_tree_search.py
Last active May 8, 2025 09:44
Monte Carlo tree search (MCTS) minimal implementation in Python 3, with a tic-tac-toe example gameplay
"""
A minimal implementation of Monte Carlo tree search (MCTS) in Python 3
Luke Harold Miles, July 2019, Public Domain Dedication
See also https://en.wikipedia.org/wiki/Monte_Carlo_tree_search
https://gist.github.com/qpwo/c538c6f73727e254fdc7fab81024f6e1
"""
from abc import ABC, abstractmethod
from collections import defaultdict
import math
@EppuHeilimo
EppuHeilimo / hill.py
Last active October 9, 2022 09:09
Hill cipher in python
import numpy as np
def encrypt(msg):
# Replace spaces with nothing
msg = msg.replace(" ", "")
# Ask for keyword and get encryption matrix
C = make_key()
# Append zero if the messsage isn't divisble by 2
len_check = len(msg) % 2 == 0
// ==UserScript==
// @name EmuParadise Download Workaround - 1.1.1
// @version 1.1.2
// @description Replaces the download button link with a working one
// @author Eptun
// @match https://www.emuparadise.me/*/*/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==
@MikeMKH
MikeMKH / setup.cs
Last active March 25, 2024 08:33
How to live with a circular reference with AutoFixture
[TestInitialize]
public void BeforeEach()
{
_fixture = new Fixture();
// client has a circular reference from AutoFixture point of view
_fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
_fixture.Behaviors.Add(new OmitOnRecursionBehavior());
}
@geocachecs
geocachecs / chess.cpp
Created October 22, 2015 21:53
2 Player Chess Game C++
#include "chess.h"
Square::Square()
{
piece = EMPTY;
color = NONE;
}
void Square::setSpace(Square* space)
@cowdinosaur
cowdinosaur / monoalphabetic.py
Last active August 8, 2022 10:45
Monoalphabetic Cipher
# Simple Substitution Cipher
# http://inventwithpython.com/hacking (BSD Licensed)
import sys, random
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def main():
myMessage = 'When you do the common things in life in an uncommon way, you will command the attention of the world'
myKey = 'QWERTYUIOPASDFGHJKLZXCVBNM'
@goldsborough
goldsborough / sm.cpp
Created January 20, 2015 22:01
Square-and-multiply algorithm for efficient exponentiation
long squareAndMultiply(long base, unsigned short power)
{
// x^0 = 1
if (! power) return 1;
// x^1 = x
if (power == 1) return base;
// if power is odd
if (power % 2)