Skip to content

Instantly share code, notes, and snippets.

View JL-Cox's full-sized avatar

JL Cox JL-Cox

  • Think3 Solutions
  • Houston, TX
View GitHub Profile
from datetime import datetime
start_time = datetime.now()
starting_fish = [int(i) for i in open("AoC_2021_D6.txt", "r").read().split(',')]
total = 0
# Counts how many fish have the same days left till spawn
current_states = {
0: starting_fish.count(0),
1: starting_fish.count(1),
@JL-Cox
JL-Cox / CW_TTTChecker.py
Created December 5, 2019 00:35
CodeWars.com - Tic-Tac-Toe Checker
def isSolved(board):
print(board)
def check_rows(game_board):
for i in range(len(game_board)):
row = (game_board[i][0], game_board[i][1], game_board[i][2])
if (len([i for i in row if i == 1]) == 3):
@JL-Cox
JL-Cox / AdventOfCode_2019_d4p2.py
Created December 4, 2019 16:07
Advent Of Code - 2019 - Day4 Puzzle2
"""However, they do remember a few key facts about the password:
It is a six-digit number.
The value is within the range given in your puzzle input.
Two adjacent digits are the same (like 22 in 122345).
Going from left to right, the digits never decrease; they only ever increase or stay the same (like 111123 or 135679).
Other than the range rule, the following are true:
111111 meets these criteria (double 11, never decreases).
223450 does not meet these criteria (decreasing pair of digits 50).
@JL-Cox
JL-Cox / AdventOfCode_2019_d4p1.py
Created December 4, 2019 15:28
Advent Of Code - 2019 - Day4 Puzzle1
"""However, they do remember a few key facts about the password:
It is a six-digit number.
The value is within the range given in your puzzle input.
Two adjacent digits are the same (like 22 in 122345).
Going from left to right, the digits never decrease; they only ever increase or stay the same (like 111123 or 135679).
Other than the range rule, the following are true:
111111 meets these criteria (double 11, never decreases).
223450 does not meet these criteria (decreasing pair of digits 50).
@JL-Cox
JL-Cox / AdventOfCode_2019_d3p2.py
Last active December 4, 2019 01:28
Advent Of Code - 2019 - Day3 Puzzle2 (Complete)
import os
import re
from time import sleep
class bc:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
@JL-Cox
JL-Cox / AdventOfCode_2019_d3p1.py
Last active December 3, 2019 23:47
Advent Of Code - 2019 - Day3 Puzzle1 (Complete)
import os
import re
from time import sleep
class bc:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
@JL-Cox
JL-Cox / SystemStatistics.py
Last active November 5, 2019 21:46
Custom system resource analyser built on/for the RPi
import os # Allows access to system statistics
import psutil # Allows access to virtual memor stats
from pyspectator.processor import Cpu # Python library for access resource stats (CPU)
from pyspectator.network import NetworkInterface # Library for access resource stats (NIC)
from pythonping import ping # Library used for the simplified running of network commands
import re # Regex for detecting patterns in strings
import subprocess # Library for running terminal commands through Python
from time import sleep # Pauses code exection. Time passed to method in 'seconds'
import tkinter as tk # Library used to create the GUI and its widgets
from tkinter import *
@JL-Cox
JL-Cox / StringMix.cs
Last active January 9, 2019 19:13
String Mix
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StringMix
{
class Program
@JL-Cox
JL-Cox / TexasHoldem.cs
Last active December 28, 2018 20:45
CodeWars.com Kata (Ranking Poker Hands)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
namespace TexasHoldem
{
public class Program
{
@JL-Cox
JL-Cox / RangeExtraction.cs
Created November 7, 2018 21:38
CodeKata - RangeExtraction
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// https://www.codewars.com/kata/51ba717bb08c1cd60f00002f
/// </summary>