Skip to content

Instantly share code, notes, and snippets.

@Engelshell
Engelshell / usm_to_opus.py
Created April 4, 2024 15:23
usm_to_opus.py
from subprocess import Popen, PIPE
from pathlib import Path
bitrate = "256k" #imperceptible quality
track_num = "1" #gets vocal track for my .usm's. Change as needed.
#-apply_phase_inv 0 for vocal tracks because they are mono. Set to 1 for stereo/surround
ffmeg_conv_cmd = ["-map", f"a:{track_num}?", "-c:a", "libopus", "-b:a", bitrate,
"-application", "audio", "-apply_phase_inv", "0"]
for file in (f for f in Path.cwd().iterdir() if f.is_file() and not f.is_symlink()
@Engelshell
Engelshell / bankers.py
Created March 11, 2024 05:02
Bankers Algorithm Example
import sys
class BankersAlg:
def __init__(self, available, maximum):
self.NUMBER_OF_CUSTOMERS:int = 5
self.NUMBER_OF_RESOURCES:int = 4
# the available amount of each resource */
self.available:list[int] = [0,0,0,0]
self.available = available[:]
@Engelshell
Engelshell / installgit.ps1
Created August 10, 2023 16:52
Silent Git SCM Setup Windows
#Config for silent git setup for user
#https://github.com/git-for-windows/git/wiki/Silent-or-Unattended-Installation
#https://jrsoftware.org/ishelp/index.php?topic=setupcmdline
$gitSetupExe = "Git-2.41.0.3-64-bit.exe"
#Dir="expand:{userpf}\Git" installs to users AppData/Local/Programs/Git folder
#EditorOption=VisualStudioCode uses vscode for git text/review
#UseCredentialManager=Enabled uses git credential manager.
#Users have to login to commit/push code to most online repos.
@Engelshell
Engelshell / gist:3a6f32fdd2e9285514612bd4660f5d5a
Created August 3, 2023 19:54
Windows Server 2022 Docker Setup
#Sets up a Microsoft SQL Server 2022 instance in Ubuntu
#https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver16&pivots=cs1-bash
docker pull mcr.microsoft.com/mssql/server:2022-latest
docker run
-e “ACCEPT_EULA=y” \
—hostname=mssql2022 \
—user-mysql \
—name=mssql2022 \
<?php
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if ($conn->connect_error) {
die($conn->connect_error);
}
$pstmt = $conn->prepare(
"UPDATE table
@Engelshell
Engelshell / eclipse_install.ps1
Created March 8, 2023 23:35
Install eclipse unattended from powershell
$ErrorActionPreference = "Stop"
#Match version to zip downloaded
$eclipseVersion = "2022-12"
#zip archive from https://www.eclipse.org/downloads/packages/release/2022-12/r/eclipse-ide-java-developers
$eclipseSrcZip = "./eclipse-java-$eclipseVersion-R-win32-x86_64.zip"
#Extract zip to users eclipse/java-2022-12 folder, same as GUI installer
$eclipseDestinationFolder = "~/eclipse/java-$eclipseVersion"
#path for shortcut to eclipse
$eclipseShortcutPath = "$Home\Desktop\Eclipse IDE for Java Developers - $eclipseVersion.lnk"
@Engelshell
Engelshell / unzipping.js
Created January 14, 2023 19:36
Unzip archive with jszip nodejs
/*
Read a .zip archive of multiple files, decompress and write to filesystem.
*/
'use strict';
const fs = require('fs');
const JSZip = require('jszip');
async function example() {
@Engelshell
Engelshell / MatrixMultiplication.java
Created October 11, 2022 17:12
Matrix Multiplication Assignment 1
/* Multiplication of two matrixes with simple iterative algorithm
* References: https://en.wikipedia.org/wiki/Matrix_multiplication_algorithm
*
* @author Shelby Engels
*/
public class MatrixMultiplication {
/**