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 | |
| # credits to https://gist.github.com/sfwn/7453e78be0374b3d53f1e44f5bb8beef | |
| # TODO replace ghead with head for non-macos | |
| # TODO provide DOCKER_LOGIN and DOCKER_PASSWORD as arguments | |
| DOCKER_REGISTRY="https://docker.example.com/v2" | |
| DOCKER_LOGIN="xxx" | |
| DOCKER_PASSWORD="yyy" |
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 { Client, ServiceError, Metadata, CallOptions, ClientUnaryCall } from '@grpc/grpc-js'; | |
| import { Message } from 'google-protobuf'; | |
| type OriginalCall<T, U> = (request: T, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError, res: U) => void) => ClientUnaryCall; | |
| type PromisifiedCall<T, U> = ((request: T, metadata?: Metadata, options?: Partial<CallOptions>) => Promise<U>); | |
| export type Promisified<C> = { $: C; } & { | |
| [prop in Exclude<keyof C, keyof Client>]: (C[prop] extends OriginalCall<infer T, infer U> ? PromisifiedCall<T, U> : never); | |
| } |
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 globalCache = new WeakMap(); | |
| export function Memoize() { | |
| return (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<any>) => { | |
| if (descriptor.value != null) { | |
| descriptor.value = getNewFunction(descriptor.value); | |
| } else if (descriptor.get != null) { | |
| descriptor.get = getNewFunction(descriptor.get); | |
| } else { | |
| throw new Error('Only put a Memoize decorator on a method or get accessor.'); |
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
| open $(git config remote.origin.url | sed -E 's/[^:]+:\/\/([^@]*@){0,1}([^:\/]+)([:0-9]*)(\/.+)\.git/https:\/\/\2\4/') |
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
| # see https://fonts.google.com/attribution for licensing | |
| curl -o f.zip "https://google-webfonts-helper.herokuapp.com/api/fonts/roboto?download=zip&subsets=latin,latin-ext&variants=regular,700" \ | |
| && unzip f.zip \ | |
| && rm f.zip |