Skip to content

Instantly share code, notes, and snippets.

View krzysztof-miemiec's full-sized avatar

Krzysztof Miemiec krzysztof-miemiec

View GitHub Profile
@krzysztof-miemiec
krzysztof-miemiec / database.service.ts
Created July 15, 2020 21:44
Sample DatabaseService which supports credential rotation
import { Connection, EntitySchema, getConnectionManager } from 'typeorm';
import { Observable, Subscription } from 'rxjs';
import { distinctUntilChanged, first, map, skip } from 'rxjs/operators';
import { Injectable, OnApplicationShutdown, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
import { ConfigurationEntity } from '../configuration/infractructure/entity/configuration.entity';
import { OfferEntity } from '../offer/infrastructure/entity/offer.entity';
import { UserEntity } from '../status/infrastructure/entity/user.entity';
import { DatabaseLogger } from '../shared/logger/database.logger';
import { LoggerService } from '../shared/logger/logger.service';
@krzysztof-miemiec
krzysztof-miemiec / test-run.log
Last active June 6, 2020 14:29
Helm Provider acceptance tests run - fix: avoid concurrent read/write in metadata (#494)
TF_ACC=1 go test "./helm" -v -timeout 120m -parallel=4
=== RUN TestAccDataRepository_basic
--- PASS: TestAccDataRepository_basic (18.55s)
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestAccResourceRelease_basic
=== PAUSE TestAccResourceRelease_basic
=== RUN TestAccResourceRelease_import
=== PAUSE TestAccResourceRelease_import
=== RUN TestAccResourceRelease_multiple_charts
@krzysztof-miemiec
krzysztof-miemiec / stack-trace.log
Created May 11, 2020 10:14
Helm Provider v1.2.1 / Terraform v0.12.24 Concurrency Error
2020-05-11T11:36:08.360+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4: fatal error: concurrent map read and map write
2020-05-11T11:36:08.363+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4:
2020-05-11T11:36:08.364+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4: goroutine 31 [running]:
2020-05-11T11:36:08.364+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4: runtime.throw(0x2c94295, 0x21)
2020-05-11T11:36:08.364+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4: /opt/goenv/versions/1.13.7/src/runtime/panic.go:774 +0x72 fp=0xc000aa7020 sp=0xc000aa6ff0 pc=0x102e112
2020-05-11T11:36:08.364+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4: runtime.mapaccess2_faststr(0x2957ac0, 0xc0002aa360, 0xc000432700, 0x1b, 0x1, 0xc000432700)
2020-05-11T11:36:08.364+0200 [DEBUG] plugin.terraform-provider-helm_v1.2.1_x4: /opt/goenv/versions/1.13.7/src/runtime/map_faststr.go:116 +0x48f fp=0xc000aa7090 sp=0xc000aa7020 pc=0x1012bdf
2020-05-11T11:36:08.364+0200 [DEBUG] plugin.terraform-provider
@krzysztof-miemiec
krzysztof-miemiec / serverless.js
Created March 26, 2020 10:45
Some kind of stages stub to be able to use serverless-next.js in order to deploy to multiple envs
// serverless/stages/serverless.js
const { Component } = require('@serverless/core');
const required = (name) => {
throw new Error(`An argument "${name}" is required.`);
};
const processRef = (value, data) => {
for (const key in data) {

Keybase proof

I hereby claim:

  • I am krzysztof-miemiec on github.
  • I am krzysztofmiemiec (https://keybase.io/krzysztofmiemiec) on keybase.
  • I have a public key ASBka3bo_ka1sFaTeKsysffVfxaFwCJR8dWO1dujYXYgYAo

To claim this, I am signing this object:

@krzysztof-miemiec
krzysztof-miemiec / actionsUnion.util.tsx
Last active September 3, 2019 22:18
TypeScript Redux Actions
type FunctionType = (...args: any[]) => any;
type ActionCreatorsMapObject = { [actionCreator: string]: FunctionType & { type?: string } };
export type ActionsUnion<A extends ActionCreatorsMapObject> = ReturnType<A[keyof A]>;
@krzysztof-miemiec
krzysztof-miemiec / slack.sh
Created October 26, 2018 07:38
Simple Slack notifications sample that can be used in GitLab, when you want to send notifications under certain conditions
#!/usr/bin/env bash
# Simple Slack notifications that can be used in GitLab, when you want to send notifications under certain conditions
#
# SLACK_HOOK - url to slack IncomingWebhook
# ENVIRONMENT - app name
# CI_* - env vars from GitLab
#
# --error flag sends the error message.
set -e
@krzysztof-miemiec
krzysztof-miemiec / Usage.ts
Created June 11, 2017 14:22
Simple wrapper for TypeORM's QueryBuilder.
// Not 100% sure if everything works, but you should be able to do something like this:
// Find guys named john, bob or mark, that work in Boring Company or have family members working there.
// Include their addresses, company and family members in results.
const results = await Query.forEntity(db.manager, Person, 'person')
.deepPopulate('person', [
'worksAt.company',
'address',
'family.worksAt.company'
])
@krzysztof-miemiec
krzysztof-miemiec / Album.java
Last active March 5, 2019 11:34
List parsing done with LoganSquare and Realm database.
/**
* Sample class showing how to use type converter in this gist.
*
* @author Krzysztof Miemiec
*/
@JsonObject
public class Album extends RealmObject {
@PrimaryKey
@JsonField