Skip to content

Instantly share code, notes, and snippets.

View TheNerdMan's full-sized avatar

Alex Wilson TheNerdMan

View GitHub Profile
@TheNerdMan
TheNerdMan / nightbot-weighted-random.js
Last active September 22, 2024 16:10
A command night bot to output a random value but weight those values so some are rarer
/** @author=TheNerdMan */
/**
* Creates an array of shape [{outputStr: string, weight: number}]
*
* @param stringArray An array of strings, strings should be formated as such "\<String To Ouput\>, \<weight\>"
* an example is ["Foo, 0.5", "Bar, 0.25", "FooBar, 0.25"].
*
* Weights must add up to 1.0.
*/
@TheNerdMan
TheNerdMan / safe_pip
Created April 28, 2024 00:07
Safe pip, for when some pip installs are broken for some reason
#!/bin/bash
safe_pip() {
if [ -f "./requirements.txt" ]; then
echo "Safely installing each pip in this dir's requirements.txt";
cat requirements.txt | sed -e '/^\s*#.*$/d' -e '/^\s*$/d' | xargs -n 1 pip install;
else
echo "no requirements.txt found!"
fi
}
@TheNerdMan
TheNerdMan / cloudSettings
Created November 26, 2020 09:35
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-11-26T09:35:18.660Z","extensionVersion":"v3.4.3"}