Skip to content

Instantly share code, notes, and snippets.

View michaelmrose's full-sized avatar
💭
Available to hire

Michael Rose michaelmrose

💭
Available to hire
View GitHub Profile
@michaelmrose
michaelmrose / trident-update
Created November 1, 2024 16:08
System update script from the now defunct project trident
#!/bin/bash
# Script to automate the installation of system updates with appropriate safeguards from ZFS boot environments
#temporary log files and state flags
_checklog="/tmp/trident-update-check.log"
_uplog="/tmp/trident-update.log"
showUsage(){
echo "Usage:
trident-update <-update | -check>
#!/bin/bash
# Get the list of connected monitors
connected_monitors=$(xrandr --query | grep " connected" | awk '{print $1}')
declare -A monitor_max_res
for monitor in $connected_monitors; do
# Get the preferred mode for this monitor
preferred_mode=$(xrandr --query | sed -n "/^$monitor connected/,/^[^ ]/p" | grep -Eo '[0-9]+x[0-9]+\s+\S+\s+\*' | head -n1 | awk '{print $1}')
@michaelmrose
michaelmrose / rickroll.lua
Created September 24, 2024 20:08
script when placed in ~/.config/mpv/scripts rick rolls user every time they play a video
local intro_video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
local has_prepended = false -- A flag to prevent repeated prepending
mp.register_event("file-loaded", function()
-- Check if we've already prepended the URL
if not has_prepended then
-- Insert the YouTube video at the beginning of the playlist
mp.commandv("loadfile", intro_video_url, "append-play")
-- Wait for the video to be properly appended
@michaelmrose
michaelmrose / lessgreen
Created May 16, 2024 00:49
less green assumes one monitor make executable
#!/bin/bash
# Get the initial gamma values for red, green, and blue
initial_gamma=$(xrandr --verbose | grep -m 1 'Gamma:' | awk '{print $2}')
initial_red=$(echo $initial_gamma | cut -d: -f1)
initial_green=$(echo $initial_gamma | cut -d: -f2)
initial_blue=$(echo $initial_gamma | cut -d: -f3)
# Define the display output, omitting the header "Monitors: 3"
output=$(xrandr --listmonitors | grep -v "Monitors:" | awk '{print $4}' | head -n 1)
@michaelmrose
michaelmrose / guide
Created April 15, 2024 17:15
brightness service
Create a new systemd service file:
sudo nano /etc/systemd/system/brightness.service
Add the following to the file:
================================
[Unit]
#tabbrowser-tabs { visibility: collapse !important; }
#nav-bar {
background-color: black !important;
color: white !important;
}
#nav-bar toolbarbutton .toolbarbutton-icon {
fill: white !important; /* Change icon color */
background-color: black !important; /* Change background color */
}
#urlbar {
@michaelmrose
michaelmrose / colors.conf
Created February 6, 2024 23:02
hexchat colors
color_0 = ffff ffff ffff
color_1 = 4e4e 4e4e 4e4e
color_2 = a8a8 ffff 6060
color_3 = ffff 7373 fdfd
color_4 = 9696 cbcb fefe
color_5 = 7777 5454 3e3e
color_6 = 94bc 5925 ffff
color_7 = eaea 9595 1f1f
color_8 = ffff ffff b6b6
color_9 = a6a6 e2e2 2e2e
@michaelmrose
michaelmrose / script.sh
Created January 24, 2024 06:15
bash script
#!/usr/bin/env bash
cd /some/cool/directory
./executable
# This is a comment its not run
# this too
# now chmod +x /full/path/to/me
# free -h
total used free shared buff/cache available
Mem: 39Gi 23Gi 15Gi 866Mi 1.4Gi 15Gi
# Inxi -mxxx
Memory:
System RAM: total: 80 GiB available: 39.11 GiB used: 23.94 GiB (61.2%)
Array-1: capacity: 128 GiB slots: 4 modules: 4 EC: None
@michaelmrose
michaelmrose / rshift.sh
Last active October 8, 2023 22:52
basic redshift like implimentation with bash
#!/bin/bash
monitors=$(xrandr --listactivemonitors | tail -n +2 | awk '{print $4}')
# Get the current hour
if [ "$#" -eq 1 ]; then
current_hour="$1"
else