Skip to content

Instantly share code, notes, and snippets.

View zsarge's full-sized avatar

Zack Sargent zsarge

View GitHub Profile
@zsarge
zsarge / install_nodejs_without_admin.ps1
Last active June 20, 2021 23:16
This PowerShell script installs Node.JS v16.3.0 on Windows 10 without admin privileges.
# This powershell script installs Node.JS v16.3.0 without admin on Windows 10.
# See https://nodejs.org/en/download/ for direct download.
# A temporary path is created on your desktop called "DELETE_ME".
# Node is actually installed to %USERPROFILE%\node-v16.3.0-win-x64\
# Written by Zack Sargent on June 20th, 2021
$DesktopPath = [Environment]::GetFolderPath("Desktop")
$WorkPath = "$DesktopPath\DELETE_ME"
@zsarge
zsarge / google_tts.py
Created February 16, 2022 21:52
Convert lots of text files to mp3s using Google Text to Speech
import os
import gtts
from gtts import gTTS
from tqdm import tqdm
from time import sleep
from random import randrange
from datetime import datetime
"""
@zsarge
zsarge / make_slideshow.sh
Created April 10, 2022 16:35
Make slideshow from videos from Google Photos Album
#!/usr/bin/bash
# The goal of this script is to take a series of videos
# from an album export from Google Photos
# and append them all together to make one long video.
# For example, if the videos folder contained:
# ./videos
# - a.mp4
@zsarge
zsarge / make_server_public.sh
Created April 29, 2022 17:51
Run Minecraft server with playit.gg tunnel
#!/bin/sh
echo "running playit with the config file under './playit_config/config.txt'"
playit --config-file ./playit_config/config.txt
@zsarge
zsarge / backup_npp.rb
Created June 25, 2022 04:48
Back up save data (nprofile) for the game N++
#!/usr/bin/ruby
# This script backs up the save data for the game N++.
# It is only tested on Fedora Workstation 36.
#
# There is a rare bug in the game where save data gets corrupted,
# but the game is so long that many people still encounter it.
#
# I recommend running this script on a regular interval with cron.
#
@zsarge
zsarge / irb.rb
Last active August 7, 2023 16:51
A quick hacky function to see the classes necessary to create an ActiveRecord object.
# A quick hacky function to see the other ActiveRecord objects necessary to create an ActiveRecord object.
# There might be a better way to do this natively.
# these are both one line so they can be quickly found with Ctrl+R
def _needs(obj) = (if obj.nil? then return obj end; props = obj.class.columns.map(&:name).filter{_1.ends_with?("_id") && _1 != "reference_id"}.map{_1.gsub('_id', '')}; if props.nil? || props.size == 0 then return obj else return [obj, props.map{_needs(obj.send(_1.to_sym))}.reject{_1.nil?}].compact end)
def needs(obj) = _needs(obj).flatten.map(&:class).map(&:name).uniq
# Usage:
needs User.last # => ["User", "AccountType", "WhateverOtherClass", ...]
@zsarge
zsarge / install_vms.sh
Last active October 31, 2023 03:08
Install OWASP PyGoat and WebGoat VM from OneDrive
#!/bin/bash
set -e
# contains no hidden info, fyi
YOUR_ONEDRIVE_SHARE_LINK="https://mymailnku-my.sharepoint.com/:u:/g/personal/sargentz1_mymail_nku_edu/EVMxZ0hCDfZMnKpeqHpVpZQB-utsXsOBxYgVWtQuhyLUig?e=hPj1Zq&download=1"
install_path="/tmp/install_pygoat"
mkdir -p "$install_path"
cd "$install_path"
#!/bin/bash
set -e
# this script:
# 1. downloads downloads drivers for USB to UART (requires GUI input)
# 2. installs Xcode command line tools with homebrew
# 3. installs Arduino IDE and adds it to the dock
# 4. downloads Arduino CLI
# 5. adds board support for ESP32s
#
@zsarge
zsarge / install_fedora_software.sh
Created April 5, 2024 01:55
Bash script to install all of the software I frequently need on Fedora
#!/bin/bash
# These are all of the things that I install on Fedora linux.
set -e # exit on first error
sudo dnf update --refresh
# install chrome
sudo dnf install fedora-workstation-repositories