Skip to content

Instantly share code, notes, and snippets.

@gamesguru
gamesguru / rateMyProfessorsDeptAvg.js
Last active May 26, 2025 15:57
Script to load all professors and calculate a department's weighted average for ratings and difficulties.
/** SCORES (RESULTS)
Average rating at Oakland University: 3.12
Average difficulty at Oakland University: 3.56
Based on 123 professors and 4636 ratings in the Mathematics department.
https://www.ratemyprofessors.com/search/professors/716?q=*&did=38
Average rating at Oakland Community College: 3.44
Average difficulty at Oakland Community College: 3.35
Based on 14 professors and 132 ratings in the Mathematics department.
https://www.ratemyprofessors.com/search/professors/11931?q=*&did=38
@gamesguru
gamesguru / khaled-amazon-reading-book-chapters.cpp
Last active December 29, 2025 14:04
Solution to reading a book of chapters within given number of days
#include <bits/stdc++.h>
using namespace std;
int solution(vector<int> arr, int days_til_exam) {
// number of chapters
int n_chaps = arr.size();
// longest chapter
int m = *max_element(arr.begin(), arr.end());
@gamesguru
gamesguru / .screenrc
Created March 17, 2022 18:15
From Chris
defshell -bash
hardstatus alwayslastline
hardstatus string '%{= kw}%-w%{= BW}%50>%n %t%{= kw}%+w%<'
shelltitle ""
multiuser off
vbell_msg "Beep!"
startup_message off
defscrollback 40000
#terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
@gamesguru
gamesguru / .bash_profile
Created March 5, 2021 19:53
bash profile (macOS)
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
[[ -r "/usr/local/etc/bash_completion.d/python-argcomplete" ]] && . "/usr/local/etc/bash_completion.d/python-argcomplete"
_ssh()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
@gamesguru
gamesguru / sol.py
Created January 15, 2021 18:19
Python printing: family-tree
class Node:
def __init__(self, parent_id, id, name):
self.id = id
self.parent_id = parent_id
self.name = name
self.children = []
def printChildren(node, level=1):
for c in node.children:
.headers on
.mode column
PRAGMA foreign_keys = 1;
@gamesguru
gamesguru / cpu_info.py
Created September 8, 2020 17:53
Gets CPU/MoBo/HDD info on Linux
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 11 13:55:12 2018
@author: shane
"""
import os, sys
import subprocess
[
{
"vendor":0,
"path":[
[
-97.743,
30.284
],
[
-97.743,
@gamesguru
gamesguru / sup.sh
Last active December 29, 2025 14:02
Software updating script for Ubuntu/Debian (apt-based systems)
#!/bin/bash
# A script for updating apt-based Linux distros
# ... put it in ~/.local/bin, /usr/local/bin, or anywhere in your $PATH
# exit on error
set -e
# Function Definitions
function exec_red {
printf "\\n\e[1;31m%s\e[0m\\n" "$*"