This will have examples in a file grouped by topic. These are FAQs from co-workers, etc.
This file contains 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/bash | |
# Docker Foundry Updater | |
# This script is used to download the Foundry ZIP file so it can be picked up by the Foundry container | |
# By felddy (felddy/foundryvtt:release) | |
# USAGE | |
# ./foundry_update.sh TIMED_URL (PATH_TO_CONTAINER_CACHE_FOLDER) | |
This file contains 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 | |
for dirname, _, filenames in os.walk('.'): | |
for filename in filenames: | |
print(os.path.join(dirname, filename)) |
This file contains 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
// Taken from | |
// https://advancedweb.hu/how-to-use-async-functions-with-array-filter-in-javascript/ | |
// and | |
// https://patrickmuff.ch/blog/async-filter-array-typescript/ | |
/** | |
* @param {Array} array The array to perform the map on | |
* @param {Function} callback to be performed on each array element | |
* @return {Promise} Which returns an array of the results, in order. | |
*/ |
This file contains 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
// Flesh Warp Targeter Macro | |
// for The Occultist | |
// Whispers player and GM which Defense should be used for each targeted enemy for quicker play when you've taken the Flesh Warp Talent. | |
// Set up some vars | |
const gmID = game.users.entities.filter(u => u.isGM).map(u => u._id)[0]; | |
const mdLower = []; | |
const pdLower = []; | |
// Figure out what each target should be |
On the server, put this snippet in ~/.bashrc to automatically open tmux on ssh
# Open Tmux Session immediately on SSH and exit SSH Session when exiting tmux
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux;
exit;
fi
This file contains 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
# vars | |
NOT_CONNECTED=1 | |
COUNT=0 | |
#... | |
# run server, etc. | |
#... | |
echo "Attempting to connect to SQL SERVER..."; | |
while [ "$NOT_CONNECTED" != "0" ]; do | |
# Specifically for the MSSQL docker container. Run and try to do a query. Dump all output to /dev/null | |
/opt/mssql-tools/bin/sqlcmd -e -S "$DB_ADDR" -U "$DB_USER" -P "$SA_PASSWORD" -b -Q "SELECT * FROM sys.databases;" 2>&1 > /dev/null |
This file contains 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
// Expected (and actual) output: | |
// "first done" | |
// "hello world!" | |
let reassigned = Promise.resolve(); | |
reassigned = reassigned.then(() => new Promise((resolve, reject) => { setTimeout(() => {console.log('first done'); return resolve("hello")}, 3000);}) ); | |
reassigned.then((x) => new Promise((resolve, reject) => { console.log(`${x} world!`); resolve(`${x} world!`);})); |
This file contains 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
# Throw this in your .zshrc (.bashrc may work too) | |
safe_sudo() { | |
cmd="${@: 1}" | |
if [ "" = "$cmd" ]; then | |
echo "Missing parameters!"; | |
return 1 | |
fi | |
sudo ${@: 1}; | |
sudo -k; |
This file contains 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
D/StatusBar.NetworkController( 914): dumpIcon[(gone) stat_sys_5signal_2|null stat_sys_wifi_signal_in_4 (gone) F] | |
W/RecipientPreferenceDatabase(31082): Muted until: 0 | |
W/PhoneNumberFormatter(31082): Got local CC: CA | |
W/TextSecureSessionStore(31082): No existing session information found. | |
W/RecipientPreferenceDatabase(31082): Muted until: 0 |
NewerOlder