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
/* | |
* Returns calendar dates along with their next working date for the last 2 years. | |
* Non working days are either weekends or "hardcoded" holidays. | |
* Author: Jenya Y. | |
*/ | |
SELECT | |
CAST(calendar_date AS DATE) AS calendar_date, | |
MIN(working_days.working_date) AS next_working_day | |
FROM | |
( |
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
/** | |
* Returns a modified array of transactions where each categorized based on similarity. | |
*/ | |
const categorizeSimilarTransactions = (transactions) => { | |
if (transactions.length < 2) { | |
return transactions; | |
} | |
// Since each transaction can be matched | |
// only to transaction that has category, |
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
/** | |
* Calculates the balance in a specific category within the specified time period. | |
*/ | |
const getBalanceByCategoryInPeriod = ( | |
transactions, | |
categories, | |
start, | |
end | |
) => { | |
// Implementation notes: |
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
/** | |
* Converts object with flat structure, where key contains a full path to each leaf, | |
* into regular POJO. | |
* | |
* @example | |
* // input: | |
* { | |
'recipients[0].name': 'is required', | |
'recipients[0].email': ['is required', 'invalid format'], | |
'subject': 'is required', |
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 * as crypto from 'crypto'; | |
import { CipherGCMTypes } from 'crypto'; | |
// defaults source: https://stackoverflow.com/a/53573115/2307459 | |
const BLOCK_CIPHER: CipherGCMTypes = 'aes-256-gcm'; | |
const AUTH_TAG_BYTE_LEN = 16; | |
const IV_BYTE_LEN = 12; | |
const KEY_BYTE_LEN = 32; | |
export class SymmetricCrypto { |
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
export class Deferred<T = void> { | |
public resolve!: (value?: T | PromiseLike<T>) => void; | |
public reject!: (reason?: any) => void; | |
public readonly promise: Promise<T>; | |
private isFulfilled = false; | |
constructor() { | |
this.promise = new Promise( | |
(resolve, reject) => { | |
this.resolve = resolve; |
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 | |
while [ 1 ] | |
do | |
rsync \ | |
--progress \ | |
--partial \ | |
--append \ | |
--timeout=30 \ | |
-vz \ |
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
/** | |
* Performs operation and retries it in case either thrown | |
* exception or an optional `success` checker returns `false`. | |
* @param work The operation that need to perform | |
* @param checker Optional delegate to test whether the outcome of `work()` was successful operation | |
* @param retries An amount of retries to perform | |
* @param delayBetween An amount of milliseconds to wait between retries | |
*/ | |
export default async <TResult>( | |
work: () => TResult | Promise<TResult>, |
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
# configurations | |
$workingDirectory = "$(System.DefaultWorkingDirectory)" | |
$sourceArtifact = "ZIP_FILE_THAT_HAS_YOUR_AAPLICATION_(PRODUCED_BY_BUILD)" | |
$entryPointDll = "FILE_THAT_HAS_STATIC_VOID_MAIN.dll" | |
$webJobName = "THE_NAME_OF_THE_WEBJOB" | |
$jobType = "continuous" | |
$appName = "THE_NAME_OF_AZURE_WEB_APP_THAT_WILL_HOST_JOB" | |
$resourceGroupName = "GROUP_NAME" | |
Write-Host "Validating artifact file" |
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 | |
set -e | |
command -v aws >/dev/null 2>&1 || { echo >&2 "AWS CLI required. Please install from https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html"; exit 1; } | |
# get the name of EC2 instance from 1st argument | |
if [ -z "$1" ] | |
then | |
echo "Instance name is required" | |
exit 1 |
NewerOlder