Skip to content

Instantly share code, notes, and snippets.

View JakeGads's full-sized avatar
🏠
Working from home

Jake Gadaleta JakeGads

🏠
Working from home
  • airline hydraulics
  • Philly
  • 16:19 (UTC -04:00)
  • Bluesky @jakedot.com
View GitHub Profile
@JakeGads
JakeGads / day6.rs
Created December 6, 2024 17:46
Advent of Code 2024 Day 6
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();
@JakeGads
JakeGads / day5.rs
Created December 5, 2024 17:35
Advent of Code 2024 Day 5
#[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![];
@JakeGads
JakeGads / day4.rs
Last active December 5, 2024 00:30
Advent of Code 2024 Day 4 (Rust)
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());
}
@JakeGads
JakeGads / mdcombiner2
Created September 9, 2020 17:36
Goes throught markdown files in subfolders and generates readme for them (for class to consolidate notes)
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
@JakeGads
JakeGads / win_program_graber.py
Created September 7, 2020 16:02
Windows Program Lister
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 = []
#!/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")
#!/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")
@JakeGads
JakeGads / _resize.py
Created February 14, 2020 17:42
Directory Resizing for ubuntu systems
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/*")
@JakeGads
JakeGads / fontLoader.py
Last active February 5, 2020 14:13
Linux Font Loader
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")
@JakeGads
JakeGads / hallmark_plot_generator.py
Created December 24, 2019 17:31
Generates the plot of a hallmark Christmas movie
# 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"]
]