Skip to content

Instantly share code, notes, and snippets.

@bloo
bloo / keybase.md
Last active December 10, 2015 22:56

Keybase proof

I hereby claim:

  • I am bloo on github.
  • I am bloo (https://keybase.io/bloo) on keybase.
  • I have a public key whose fingerprint is 1850 75DF F031 D8F1 8DFC 7C8B 3BCE A2F0 EF10 B88A

To claim this, I am signing this object:

#!/bin/sh
if [[ -z ${TAG_MAJOR} ]]; then
echo "TAG_MAJOR env var needs to be set!" > /dev/stderr
exit 1
fi
TAG_MINOR=$(git tag | grep v${TAG_MAJOR} | cut -d"." -f2 | sort -n | tail -1 | xargs expr 1 +)
if [[ -z ${TAG_MINOR} ]]; then TAG_MINOR=0; fi
@bloo
bloo / msa_updater.md
Last active October 22, 2018 15:46
Microservices Architecture for Updater
Terraform v0.11.3
Configuring remote state backend...
Initializing Terraform configuration...
2018/02/06 16:41:21 [INFO] Terraform version: 0.11.3 3802b14260603f90c7a1faf55994dcc8933e2069
2018/02/06 16:41:21 [INFO] Go runtime version: go1.9.1
2018/02/06 16:41:21 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan", "-out", "/terraform/terraform.tfplan", "-detailed-exitcode", "-module-depth=-1", "-parallelism=10"}
2018/02/06 16:41:21 Loading CLI configuration from /tmp/cli.tfrc
2018/02/06 16:41:21 [INFO] CLI command args: []string{"plan", "-out", "/terraform/terraform.tfplan", "-detailed-exitcode", "-module-depth=-1", "-parallelism=10"}
2018/02/06 16:41:21 [TRACE] module source: "../../modules/elasticache-redis.aws"
@bloo
bloo / update_cluster.sh
Last active March 20, 2018 21:13
Upgrade an entire Docker Swarm cluster's `docker.service` settings
#!/bin/sh
pem=${1}
shift
nodes="${@}"
if [ -z ${pem} ] || [ -z "${nodes}" ]; then
echo "Usage `basename ${0}` <pem-file> <ip1> <ip2> .."
exit 1
fi
@bloo
bloo / Resilient Tech Blog - Code-first GraphQL with Nexus - prisma.schema
Last active April 7, 2021 15:00
Resilient Tech Blog - Code-first GraphQL with Nexus - prisma.schema
// prisma.schema
generator prisma_client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
@bloo
bloo / Resilient Tech Blog - Code-first GraphQL with Nexus - Prisma Import Example.ts
Last active April 7, 2021 15:02
Resilient Tech Blog - Code-first GraphQL with Nexus - Prisma Import Example.ts
// example.ts
// files you need to reference the type in your database
import type { Nonprofit, Budget, NonprofitType } from '@prisma/client'
@bloo
bloo / Resilient Tech Blog - Code-first GraphQL with Nexus - typeDefs.ts
Last active April 7, 2021 15:01
Resilient Tech Blog - Code-first GraphQL with Nexus - typeDefs.ts
// typeDefs.ts
import { objectType, extendType, enumType } from 'nexus'
import { NonprofitType } from '@prisma/client'
const NONPROFIT = 'Nonprofit'
const BUDGET = 'Budget'
const NONPROFIT_TYPE = 'NonprofitType'
export const nonprofit = objectType({
@bloo
bloo / Resilient Tech Blog - Code-first GraphQL with Nexus - typegen-nexus import example.ts
Last active April 7, 2021 15:01
Resilient Tech Blog - Code-first GraphQL with Nexus - typegen-nexus import example.ts
import type { NexusGenAllTypes, NexusGenFieldTypes } from 'typegen-nexus'
type Nonprofit = NexusGenAllTypes['Nonprofit']
type GetAllNonprofit = NexusGenFieldTypes['Query']['getAllNonprofit']
@bloo
bloo / Resilient Tech Blog - Code-first GraphQL with Nexus - budget objectType.ts
Created April 7, 2021 15:01
Resilient Tech Blog - Code-first GraphQL with Nexus - budget objectType.ts
export const budget = objectType({
name: BUDGET,
definition(t) {
t.model.id()
t.model.name()
t.model.amount()
t.model.fiscalYearStart()
t.model.fiscalYearEnd()
},
})