This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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", ...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| echo "running playit with the config file under './playit_config/config.txt'" | |
| playit --config-file ./playit_config/config.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import gtts | |
| from gtts import gTTS | |
| from tqdm import tqdm | |
| from time import sleep | |
| from random import randrange | |
| from datetime import datetime | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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" |
NewerOlder