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 / 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 / Git-repo-diff-generator.sh
Last active August 29, 2015 14:07
Generates a diff between two commit hashes after a build process (ie grunt, npm install, etc)
#!/bin/bash
# Static config
CMD_GIT="/usr/bin/git";
CMD_NPMPRUNE="/usr/bin/npm prune";
CMD_NPMCACHECLEAN="/usr/bin/npm cache clean";
CMD_NPMINSTALL="/usr/bin/npm install";
CMD_GRUNT="/usr/bin/grunt";
DIR_A="a";
DIR_B="b";
@jimmygle
jimmygle / Git-ignore-changes-to-file-saved-in-repo
Last active August 29, 2015 14:17
Git - Ignore changes made to a file already in the repo
# This is useful if you want to commit an initial version of a file and
# then ignore any updates to it (ie config files).
# Ignores any changes to the file
git update-index --assume-unchanged <file>
# Undo ignore any changes to the file
git update-index --no-assume-unchanged <file>
@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 / win10_setup.txt
Created January 24, 2021 21:18
Windows 10 Setup
BLOAT:
https://github.com/Sycnex/Windows10Debloater
SECURITY:
choco install avastfreeantivirus
choco install malwarebytes
choco install ccleaner
UTILITIES:
choco install 7zip.install
@jimmygle
jimmygle / anytime_fitness_reservations.rb
Last active March 2, 2021 03:51
Creates and shows reservations for the anytime fitness reserver tool at reserve.anytimefitness.com. It takes too long, so this is a simple ruby script to do it via CLI.
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
require 'thor'
require 'date'
require 'pry'
ENV['THOR_SILENCE_DEPRECATION'] = '1'
@jimmygle
jimmygle / jt-dmounter
Last active April 28, 2021 20:08
Bash script for managing the mount state of external drives.
#!/bin/bash
# Helps mount/unmount disks
#
# Author: Jimmy Gleason <github.com/jimmygle
#
# The goal of this script is to provide a helper for faciliating the un/mounting
# of drives. It's useful for mounting external drives for doing automated backups,
# or when frequently transferring data via external drives to/from a NAS.
#
@jimmygle
jimmygle / jt-dtester
Created April 28, 2021 20:10
Facilitate running tests on a drive to verify integrity.
#!/bin/bash
# NOTE: THIS IS A WORK IN PROGRESS
LOG_DIR="~/scripts/logs"
text_header() {
cat <<- EOHT
JIMMYS.TECH DRIVE TESTER KIT
@jimmygle
jimmygle / drive_performance_tests.sh
Last active April 29, 2021 03:58
Helpful one liners for testing drive performance
#!/bin/bash
# Writes zeroes to a drive and reports transfer rate
# From here: https://linuxhint.com/benchmark_hard_disks_linux/
cd /mnt/drive
dd if=/dev/zero of=benchfile bs=4k count=200000 && sync; rm benchfile
# Write & read performance
# Writes 1.6GB file to drive and then copies the file to another drive (should be SSD)
cd /mnt/drive
@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 \