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
import { randomBytes } from 'crypto' | |
const initCircularBuffer = (buffer: Buffer) => { | |
let index = 0; | |
return (): number => { | |
if (index >= buffer.length) { | |
index = 0; | |
} |
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
┌──────────────┬────────────────────────────────────────┐ | |
│ (index) │ Values │ | |
├──────────────┼────────────────────────────────────────┤ | |
│ timestamp │ 1678742260622 │ | |
│ uuid │ 'f0df59ea-bfe2-43a8-98d4-8213348daeb6' │ | |
│ ulid │ '01GVEDC2WE8EM9HN422CT8VBNP' │ | |
│ decodedTime │ 1678742260622 │ | |
│ originalUuid │ '0186DCD6-0B8E-43A8-98D4-8213348DAEB6' │ | |
└──────────────┴────────────────────────────────────────┘ |
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
import { DateTime, DateTimeUnit, DurationLike } from "luxon"; | |
import { deburr, kebabCase } from "lodash"; | |
import { marshall, unmarshall } from "@aws-sdk/util-dynamodb"; | |
import { | |
ConditionalCheckFailedException, | |
DynamoDBClient, | |
UpdateItemCommand, | |
} from "@aws-sdk/client-dynamodb"; | |
const client = new DynamoDBClient({ region: 'sa-east-1' }) |
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
version: '3' | |
services: | |
flink-jobmanager: | |
image: flink:1.7 | |
platform: linux/x86_64 | |
container_name: flink-jobmanager | |
command: | |
- "jobmanager" | |
ports: |
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
const sleep = async (timeout: number = 1000) => | |
// tslint:disable-next-line:no-string-based-set-timeout | |
new Promise((res) => setTimeout(res, timeout)); | |
/** | |
* A test-only utility that executes a function until a given condition is met. | |
* Useful to wait for asynchronous operations to complete on integration tests. | |
* If the condition is never met (`condition` never returns `true`) then tests will eventually timeout accordin to | |
* the test framework timeout settings. | |
* @param task Asynchronous function that will be repeatedly executed until the the desired `condition` is met. |
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
import { isUndefined } from "lodash"; | |
export abstract class Cloneable<T> { | |
public clone(newValues: Partial<T> = {}): T { | |
const clone = new (this.constructor as new () => T)(); | |
const newValuesWithNestedClones = Object.getOwnPropertyNames(clone) | |
.reduce((partial, propertyName) => { | |
const property = Object.getOwnPropertyDescriptor(clone, propertyName) as PropertyDescriptor; | |
const isCloneable = property.value instanceof Cloneable; | |
const isNotProvided = isUndefined( |
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
version: 2 | |
jobs: | |
validate_terraform: | |
docker: | |
- image: hashicorp/terraform | |
steps: | |
- checkout | |
- run: | |
name: Validate Terraform Formatting |
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
const className = 'StateId' | |
const interfaceName = 'StateIdInterface' | |
const data = ` state: string; | |
value: string; | |
isActive: boolean; | |
toJSON(): { [key: string]: any };` | |
const members = data | |
.replace(/\n/g, '') | |
.split(';') |
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
interface ObjectInterface { | |
[key: string]: any; | |
} | |
function initCache<T>(obj: any): T { | |
const cache = {}; | |
return new Proxy(obj, { | |
get(target: ObjectInterface, methodKey: string) { | |
const originalMethod = target[methodKey]; |
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
interface ObjectInterface { | |
[key: string]: any; | |
} | |
function initCache<T>(obj: any): T { | |
const cache = {}; | |
return new Proxy(obj, { | |
get(target: ObjectInterface, methodKey: string) { | |
const originalMethod = target[methodKey]; |