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
use std::collections::HashSet; | |
struct Guard{ | |
current_pos: (i32, i32), // current x,y position of the guard | |
current_dir: (i32, i32), // direction is going to -1 - 1 with one always being 0 | |
has_visited: HashSet<(i32, i32)>, // stores everywhere that has been visited | |
} | |
impl Guard { | |
fn new(start_x: i32, start_y: i32) -> Guard { | |
let mut has_visited = HashSet::new(); |
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
#[derive(Clone)] | |
struct Rule{ | |
before: i32, | |
after: i32, | |
} | |
pub fn part1(input: String) -> Vec<Vec<i32>> { | |
let (rules, processes) = generate_rules_and_processes(input); | |
// going to add all the non-good to a Vec for the next part | |
let mut failing_processes = vec![]; |
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
use regex::Regex; | |
pub fn part1(input: String) { | |
// translate the input into vertical and diagonal strings horizontal is already given | |
let vertical = translate_vertical(input.clone()).join("\n"); | |
let diagonal = translate_diagonal(input.clone()).join("\n"); | |
let mut count = 0; | |
for i in [input.clone(), vertical.clone(), diagonal.clone()].iter() { | |
count += search(i.to_string()); | |
} |
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 os | |
# Using os.walk() | |
prime_dirs = [] | |
for dirpath, dirs, files in os.walk(os.getcwd()): | |
for filename in files: | |
if '.md' in filename: | |
if prime_dirs == []: | |
prime_dirs = dirs |
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 winreg | |
def grab_program(hive, flag): | |
aReg = winreg.ConnectRegistry(None, hive) | |
aKey = winreg.OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", | |
0, winreg.KEY_READ | flag) | |
count_subkey = winreg.QueryInfoKey(aKey)[0] | |
software_list = [] |
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 | |
from os import system as t | |
t("sudo apt update") | |
t("sudo apt upgrade") | |
t("sudo apt install ") | |
t("sudo apt install python3 python3-pip nodejs") | |
t("sudo systemctl start snapd") | |
t("sudo snap install spotify") |
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 | |
from os import system as t | |
t("sudo apt update") | |
t("sudo apt upgrade") | |
t("sudo apt install code snapd firefox git gitkraken discord") | |
t("sudo apt install python3 python3-pip node") | |
t("sudo systemctl start snapd") | |
t("sudo snap install spotify") |
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 os | |
os.system("sudo apt update") | |
os.system("sudo apt upgrade") | |
os.system("sudo apt install imagemagick -y") | |
from glob import glob | |
files = glob("Images/*") |
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 os | |
from subprocess import call | |
from glob import glob | |
import platform | |
if platform.system() != "Windows": | |
try: | |
os.system("mkdir -p ~/.local/share/fonts") | |
except: | |
print("Folder Already Generated") |
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
# sause : https://www.theodysseyonline.com/create-your-own-hallmark-christmas-movie | |
from random import randrange as r | |
sub_inputs = [ | |
["library", "toy factory", "carousel in the park", "music program at the local elementary school", "town Christmas parade/holiday festival", "local bakery", "inn", "diner", "school musical", "Christmas tree farm."], | |
["in her home town", "at the airport", "in the most Christmassy town in America", "in a strange city far from home"], | |
["library", "candy store", "carousel", "elementary school music program", "town Christmas parade", "town holiday festival", "local bakery", "inn", "restaurant", "oak tree", "childhood farm"], | |
["cookie decorating", "ice carving", "gingerbread house making", "ice skating", "caroling", "dance", "snowman building","snowboarding", "lawn decorating", "feast cooking", "costume competition"], | |
["lodge", "inn", "café", "gas station", "mechanic’s house", "department store"] | |
] |
NewerOlder