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/bash | |
[[ "$1" == --help ]] && SHOWHELP=1 | |
(( SHOWHELP )) && { | |
echo "usage: install-emojis [/path/to/instance]" | |
echo | |
echo "Installs emojis at the system level for use by mintty." | |
echo "The brand of emoji installed are the Noto emojis from https://github.com/googlefonts/noto-emoji.git" | |
exit |
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
# Quick snip for injecting ANSI colors into bash scripts. Best used inside cat heredoc. | |
# | |
# Usage examples: | |
# cat << BOOKENDS | |
# ${blue}${bold}${underlined}Getting Started Guide:${nocolor} | |
# BOOKENDS | |
nocolor='[m' |
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
# FIRST VERSION - Outputs UTS formatted timestamp. | |
# ------------------------------------------------------------------------------------- | |
# handy pipe redirect that appends a datestamp to every line of output. Just paste this into | |
# the top of a typical BASH script. Note that it outputs localtime due to limitations in | |
# BASH printf (whichis used for speed reasons). Automated runner processes as a rule of thumb | |
# should be set to UTC anyways, so it seems not a significant limitation. | |
s_datestamp() { | |
while IFS= read -r line; do |
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
@echo off | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
:: Caveats: | |
:: * bash.exe in the PATH is often "bogus" -- a few apps, chocolately installers in particular, install stripped-down | |
:: non-functional versions of bash.exe into the PATH just so they can glob files (making them equivalent to malware imo) | |
:: | |
:: * No way to know where MSYS2 is installed, so impose a requirement that it be c:\msys64\ | |
:: | |
:: * GIT Bash usually sets up an sh_auto_file association that allows sh files to be run directly. But sometimes it's |
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
#pragma once | |
// ENABLE_PRINTF_VERIFY_CHECK_ON_MSVC | |
// | |
// Microsoft doesn't provide a way to annoate custom-rolled user printf() functions for static analysis. | |
// Well, ok -- it does provide _Printf_format_string_ but that's only effective when using the Code Analysis | |
// tool which is both incrediously slow and generates a hundred false positives for every valid issue. In | |
// other words, useless. | |
// | |
// The upside is MSVC does perform automatic lightweight static analysis on printf() builtin functions as part |
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
// Summary | |
// Disables Editor Keyboard Behavior when Unity Player has focus, so your game can handle CTRL and | |
// without corrupting your scene. | |
// | |
// Usage | |
// * Download or copy/paste and attach this component to a scene management object in your scene. | |
// * Create a new shortcut profile using Edit->Shortcuts (tedious, you need to pretty much click every | |
// button and remove every keystroke, one by one). | |
// | |
// Remarks |
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/bash | |
# | |
# Uses lazy for-loop instead of the while construct, which is made possible by assuming ONLY the | |
# modern POSIX CLI switch assignments, eg. --lvalue=rvalue | |
# | |
# No consideration for shorthand switches is made here. This idiom is most commonly used for rapid | |
# internal tool development where longhand switches are preferred. | |
POSITIONAL=( ) | |
for item; do |
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
#include <chrono> | |
// Use some clever syntax to allow GetProcessTimeInSeconds() to work from pre-main() initalizers. | |
// (in some cases the OS might init s_ProcessStartTimeSecs as 0 prior to invoking the runtime initializer | |
// that gives it a real value... but probably not. Almost all operating systems will init the boolean | |
// to zero prior to init() however, so that's what I do this little juggle). | |
bool s_ProcessStartInit = 0; | |
double s_ProcessStartTimeSecs = ((s_ProcessStartInit=1), std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::high_resolution_clock::now().time_since_epoch()).count()); | |
double GetProcessTimeInSeconds() |
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
#pragma once | |
///////////////////////////////////////////////////////////////////////////////////////////////// | |
// CaseReturnString( caseName ) | |
// | |
// Neat! Returns the case option as a string matching precisely the case label. Useful for logging | |
// hardware registers and for converting sparse enumerations into strings (enums where simple char* | |
// arrays fail). | |
// | |
#define CaseReturnString(caseName) case caseName: return # caseName |
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
#pragma once | |
#include <functional> | |
// ----------------------------------------------------------------------------------------------- | |
// Defer (macro) / Defer_t (struct) | |
// | |
// Inspired by Golang's 'defer' keyword. Allows binding a lambda to be executed when the current | |
// scope of the deferral's creation is left. This still differs from Golang `defer`: | |
// |
NewerOlder