Skip to content

Instantly share code, notes, and snippets.

View jimmygle's full-sized avatar

Jimmy Gleason jimmygle

  • Spokane, WA
View GitHub Profile
@jimmygle
jimmygle / tamper_monkey_protonmail_remove_upgade_nagging.js
Created May 7, 2024 13:57
Removes nagging upgrade banners and buttons from the awesome protonmail web client, using Tampermonkey
// ==UserScript==
// @name Hides Protonmail upgrade nagging
// @namespace github.com/jimmygle
// @version 2024-06-07
// @description Removes nagging protonmail upgrade banners/images/buttons.
// @author Jimmy Gleason
// @match https://mail.proton.me/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @run-at document-end
@jimmygle
jimmygle / PHP-Recursive-Implosion.php
Last active March 29, 2024 21:47
PHP function to recursively implode multi-dimensional arrays.
<?php
/**
* Recursively implodes an array with optional key inclusion
*
* Example of $include_keys output: key, value, key, value, key, value
*
* @access public
* @param array $array multi-dimensional array to recursively implode
* @param string $glue value that glues elements together
@jimmygle
jimmygle / kb_backlight_toggle.sh
Created December 12, 2023 20:34
Bash script to toggle keyboard backlight on CMStorm keyboard
#!/bin/bash
ls /sys/class/leds | grep scrolllock | while read -r line ; do
onoff=`sudo brightnessctl --device="$line" get`
if [ $onoff -eq 0 ]; then
sudo brightnessctl --device="$line" set 1
else
sudo brightnessctl --device="$line" set 0
fi
done
@jimmygle
jimmygle / routes.php
Last active February 15, 2023 12:18
Basic Laravel 5.2 HTTP Proxy Server (with file upload support)
<?php
/**
* This is a really quick and dirty HTTP proxy server that supports GET and POST (with file upload) requests.
*
* Setup instructions:
* 1) Install Laravel 5.2
* 2) `composer require guzzlehttp/guzzle`
* 3) Add this to your laravel routes.php
* 4) `php artisan serve --host=[server_ip] --port=80`
@jimmygle
jimmygle / pci_reset.sh
Created July 2, 2021 19:36
Hot reset PCIe Device
#!/bin/bash
# Performs the function of resetting a PCI device
#
# Get PCI devices (grab the address in first column):
# lspci
#
# Usage:
# ./pci_reset.sh "86:00.0"
#
@jimmygle
jimmygle / osx_setup.sh
Last active June 9, 2021 22:58
Helps automatically setup/configure new OSX box.
#!/usr/bin/env bash
# Setup script for setting up a new macos machine
# Stolen from: https://medium.com/macoclock/automating-your-macos-setup-with-homebrew-and-cask-e2a103b51af1
echo "Starting setup"
# install xcode CLI
xcode-select --install
# Check for Homebrew to be present, install if it's missing
@jimmygle
jimmygle / multithreaded_http.rb
Created June 4, 2021 07:02
Sloppy demonstration of multithreaded http requests in ruby
require 'csv'
require 'thread'
require 'uri'
require 'net/http'
require 'json'
require 'pry' # binding.pry
##
## Sloppy script I threw together to demonstrate multithreaded http requests
##
@jimmygle
jimmygle / mp3_to_m4b.sh
Created June 1, 2021 23:15
Converts mp3's to m4b file
#!/usr/bin/env bash
# Jacked from here: https://gist.github.com/butuzov/fa7d456ebc3ec0493c0a10b73800bf42#gistcomment-2830778
abook() {
local DIR="${1}"
if [[ ! -d $DIR || -z $1 ]]; then
DIR=$(pwd)
fi
@jimmygle
jimmygle / wget_recursive_download.sh
Last active May 23, 2021 16:59
wget one liners and helper functions for doing mass file downloads
wget \
--mirror \ # Recursive download (infinite depth)
--no-parent \ # Don't ascend to parent directory
--continue \ # Resume partially downloaded files
--user-agent="thanks" \ # Sets user agent seen by server
--wait=2 \ # Wait n seconds between requests
--reject="index.html*" \ # Rejected file patterns
"URL"
# One Liner...
@jimmygle
jimmygle / yt2jf.sh
Last active May 5, 2021 21:14
Downloads youtube channel's most recent videos and renames files for JellyFin import.
# Download Newest Videos
youtube-dl \
--dateafter 20210323 \
--match-title 'Level1 News' \
--playlist-end 5 \
--write-all-thumbnails \
--all-subs \
--sub-format srt \
--download-archive ./.ytdl_downloaded \
--add-metadata \