Skip to content

Instantly share code, notes, and snippets.

View detain's full-sized avatar
💯
Da Vinci of Linux, Van Gogh of Code, [self proclaimed, but legit]

Joe Huss detain

💯
Da Vinci of Linux, Van Gogh of Code, [self proclaimed, but legit]
View GitHub Profile
@detain
detain / bash_shopt.md
Created May 4, 2024 00:09
BASH (shopt) Shell Options Explained

Bash Shel Options ( shopt ) Explained

I wasted time WTFM so RTFM

Enable OptionDisable OptionList Enabled OptionsEnabled Options Sample Output
shopt -s <opt>
shopt -u <opt>
echo $BASHOPTS
checkwinsize:cmdhist:complete_fullquote

This table illustrates the behavior of various shopt options in bash. By toggling these options, you can influence how the shell handles things like filename completion, history management, and error handling.

Option Description Disabled Enabled Example
@detain
detain / RestorePotPlayer.sh
Created March 6, 2024 12:21
Restore the most recently deleted media file from recycling bin and add to PotPlayer playlist after the current position.
# Create a Shell COM object
$shell = New-Object -ComObject Shell.Application
# Get the Recycling Bin folder
$recycleBin = $shell.Namespace(0xa)
# Get the items in the Recycling Bin
$recycleBinItems = $recycleBin.Items()
# Sort items by deletion date in descending order
$sortedItems = $recycleBinItems | Sort-Object { $_.ExtendedProperty('System.Recycle.DateDeleted') } -Descending
$potPlayerDir = "C:\Program Files\DAUM\PotPlayer"
$potPlayerFull = "C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe"
@detain
detain / mame.md
Last active February 13, 2024 19:42
MAME Notes on Setup with Multimedia/EXTRAs and mameinfo/highscores/history/etc

MAME

Setting up MAME

Create the ini files with the appropriate command:

mame -createconfig
@detain
detain / check_errors.sh
Created August 16, 2023 18:09
Run tsc/vue-tsc converting the output to brief/easy to read JSON
#!/bin/bash
npm i -g @aivenio/tsc-output-parser;
echo "Running vue-tsc and parsing output into errors.json";
npx vue-tsc --strict --noEmit | npx tsc-output-parser > errors.json;
echo "remapping errors.json";
echo '<?php
$errors = [];
$jsonOpts = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
$json = json_decode(file_get_contents("errors.json"),true);
foreach ($json as $row) {
@detain
detain / install_themes.ps1
Created June 1, 2023 01:36
Downlaods and installs a bunch of additional nice themes for Notepad++ installer in powershell and bash flavors.
$programFilesThemesDir = "$env:PROGRAMFILES\Notepad++\themes\"
$appDataThemesDir = "$env:APPDATA\Notepad++\themes\"
# Check if both directories exist
$programFilesThemesExist = Test-Path -Path $programFilesThemesDir
$appDataThemesExist = Test-Path -Path $appDataThemesDir
# Prompt the user to select the installation directory
if ($programFilesThemesExist -and $appDataThemesExist) {
$installToProgramFiles = Read-Host "Both 'Program Files' and 'AppData' themes directories exist. Where do you want to install the themes? Enter 'P' for Program Files or 'A' for AppData."
$installToProgramFiles = $installToProgramFiles.ToUpper()
} elseif ($programFilesThemesExist) {
@detain
detain / mtl_obj.md
Created May 12, 2023 19:13
three.js noters and stuff

To create a three.js page that loads a 3D model, you'll need to do the following steps:

  1. Create an HTML file that includes the necessary scripts and libraries.
<!DOCTYPE html>
<html>
  <head>
    <title>Three.js Model Loader</title>
    <meta charset="UTF-8">
@detain
detain / response1.md
Created May 12, 2023 16:42
adding keyboard movement to three.js

To add WASD keyboard movement support to the webgl_loader_fbx.html file from the Three.js GitHub repository, you can make the following changes:

  1. First, add a controls variable to the JavaScript code near the top of the file, to store the instance of the THREE.OrbitControls object:
var camera, controls;
  1. Next, locate the init() function and add the following code after the camera variable is defined, to instantiate the OrbitControls object and set some initial values:
@detain
detain / response1.md
Created May 12, 2023 16:14
adding keyboard movement to three.js

To add WASD keyboard movement support to the webgl_loader_fbx.html file from the Three.js GitHub repository, you can make the following changes:

  1. First, add a controls variable to the JavaScript code near the top of the file, to store the instance of the THREE.OrbitControls object:
var camera, controls;
  1. Next, locate the init() function and add the following code after the camera variable is defined, to instantiate the OrbitControls object and set some initial values:
@detain
detain / gauge1.md
Created April 4, 2023 21:51
ipmi gauge chatgpt outputs

1 / 1

generate appropriate gauges using gaugeJS and these sensor readings: ``` [ {"label": "CPU1 Temp", "scale": "degrees C", "status": "ok", "current": 37, "lower_critical": 0, "upper_critical": 90, "lower_non_critical": 0, "upper_non_critical": 85, "lower_non_recoverable": 0, "upper_non_recoverable": 90}, {"label": "FAN1", "scale": "RPM", "status": "ok", "current": 3900, "lower_critical": 500, "upper_critical": 25400, "lower_non_critical": 700, "upper_non_critical": 25300, "lower_non_recoverable": 300, "upper_non_recoverable": 25500}, {"label": "12V", "scale": "Volts", "status": "ok", "current": 12.189, "lower_critical": 10.299, "upper_critical": 13.26, "lower_non_critical": 10.74, "upper_non_critical": 12.945, "lower_non_recoverable": 10.173, "upper_non_recoverable": 13.386}, {"label": "Chassis Intru", "scale": "discrete", "status": "0x0000", "current": "0x0", "lower_critical": "na", "upper_critical": "na", "lower_non_critical": "na", "upper_non_critical": "na