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
| # Pick a location to save your environment details | |
| PROXY_FILE=$HOME/.my-env/proxies | |
| # Source it so that new bash instances will pick up | |
| # the current environment settings. | |
| touch $PROXY_FILE | |
| source <(cat $PROXY_FILE) | |
| # Over-write the env file and soure it to ensure this window | |
| # picks up the changes. |
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
| env-az-setup() { | |
| echo "Setting Subscription: dev" | |
| az account set --subscription umbrellaCorp-crankshaft-dev; | |
| echo "Getting Kubectl Creds: dev" | |
| az aks get-credentials --resource-group crankshaft-aks-dev-rg --name crankshaft-aks-dev; | |
| # Just a helper to make sure everything got setup correctly | |
| helm list; | |
| } |
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
| # AZ_SUB_ENV => the azure subscription env suffix | |
| # AZ_AKS_ENV => the azure kubernetes service env suffix | |
| env-az-setup() { | |
| echo "Setting Subscription: $AZ_SUB_ENV" | |
| az account set --subscription umbrellaCorp-crankshaft-$AZ_SUB_ENV; | |
| echo "Getting Kubectl Creds: dev" | |
| az aks get-credentials --resource-group crankshaft-aks-$AZ_AKS_ENV-rg --name crankshaft-aks-$AZ_AKS_ENV; | |
| helm list; | |
| } |
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
| env-az() { | |
| # Display the current entry | |
| echo -n "az subscription env ($AZ_SUB_ENV): " | |
| # Read the user input into a new local var | |
| read az_sub_env; | |
| # If the user input was NOT empty then.. | |
| if [ ! -z "$az_sub_env" ]; then; | |
| # Save the value as the new env var | |
| export AZ_SUB_ENV=$az_sub_env; |
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
| AZ_ENV_FILE=$HOME/.my-env/umbrella-corp-env-az | |
| touch $AZ_ENV_FILE | |
| source <(cat $AZ_ENV_FILE) | |
| env-az() { | |
| # | |
| # ... all read-from-user code that we previously wrote | |
| # | |
| # Can run this before calling the env-az-setup command |
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
| function humanReadable(seconds) { | |
| var pad = function(x) { return (x < 10) ? "0"+x : x; } | |
| return pad(parseInt(seconds / (60*60))) + ":" + | |
| pad(parseInt(seconds / 60 % 60)) + ":" + | |
| pad(seconds % 60) | |
| } |
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
| function humanReadable(seconds) { | |
| let hours = getHours(seconds) | |
| let mins = getMins(seconds - (hours * 60 * 60)) | |
| let sec = seconds - (mins * 60) - (hours * 60 * 60) | |
| return [hours, mins, sec].map(padZerosToTensPlace).join(':') | |
| } | |
| function getHours(seconds) { | |
| return Math.floor((seconds / (60 * 60))) | |
| } |
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
| it("#getUsername() should get the username", () => { | |
| // TBD | |
| }) |
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
| class UserModel { | |
| async getUsername() { | |
| return "Mullen"; | |
| } | |
| } | |
| it("#getUsername() should get the username", async () => { | |
| const user = new UserModel(); | |
| const username = user.getUsername(); | |
| expect(username).toBeDefined(); | |
| }); |
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
| // Logger.ts | |
| export const LogLevel = { | |
| INFO: 30, | |
| DEBUG: 20, | |
| }; | |
| export class Logger { | |
| // default log level | |
| level = LogLevel.INFO; |
OlderNewer