Skip to content

Instantly share code, notes, and snippets.

@serinth
serinth / privateMethodTest.kt
Created July 23, 2021 06:39
Kotlin Test Private method
// buildVerifyEmailHTMLBody is the private method name. Takes on argument of String
val instance = SendGridEmailer(mock {})
val privateMethod = instance.javaClass.getDeclaredMethod("buildVerifyEmailHTMLBody", String::class.java)
privateMethod.isAccessible = true
val params = arrayOfNulls<Any>(1)
params[0] = "https://url/verify/token"
assertEquals(expected, privateMethod.invoke(instance, *params))
@serinth
serinth / keybase.md
Created April 15, 2021 21:00
keybase.md

Keybase proof

I hereby claim:

  • I am serinth on github.
  • I am serinth (https://keybase.io/serinth) on keybase.
  • I have a public key ASCHzjeabNzJyJ3Jr4s7HGg8HkCjvtfsTeLZDbV4n8F0AAo

To claim this, I am signing this object:

@serinth
serinth / miniapp.js
Last active April 4, 2020 03:32
MiniApp Framework Test
// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
parcelRequire = (function (modules, cache, entry, globalName) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
@serinth
serinth / BCGDV_Intern_submission_instructions.md
Last active June 23, 2021 01:56
BCGDV Intern Submission Instructions

BCGDV Internship Application Instructions

Thank you for your interest in Boston Consulting Group Digital Ventures!

To proceed with your application, do two of the following steps:

  • Generate an API key using the instructions below
  • Submit a POST request with your name and email address

Also please keep your code / how you did it on a public repo handy for the next interview process.

@serinth
serinth / git-config-override.sh
Created May 16, 2019 09:47
git ssh override with http token
git config --global url."https://oauth2:<TOKEN>@gitlab.com/<PROJECT>/<REPO>.git".insteadOf "https://gitlab.com/<PROJECT>/<REPO>.git"
@serinth
serinth / docker-compose.yml
Created May 9, 2019 08:56
MySQL and RabbitMQ Docker Compose
version: '3.7'
services:
rabbitmq:
image: heidiks/rabbitmq-delayed-message-exchange:3.7-management
environment:
- RABBITMQ_DEFAULT_USER=<USERNAME>
- RABBITMQ_DEFAULT_PASS=<PASSWORD>
ports:
- "15672:15672" #localhost:15672 for debugging UI
- "5672:5672"
@serinth
serinth / README.md
Last active April 3, 2019 09:17
Kubernetes new cluster config

Setup Credentials and add a kubeconfig entry

kubectl config set-credentials kubeuser/<project> --username=admin --password=<password>
kubectl config set-cluster <project> --insecure-skip-tls-verify=true --server=https://<IP>:<PORT>
kubectl config set-context default/<project>/admin --user=kubeuser/<project> --namespace=default --cluster=<project>
kubectl config get-contexts
kubectl use-context default/<project>/admin

Check if everything is okay: kubectl cluster-info.

@serinth
serinth / waitgroup-example.go
Created May 29, 2018 00:45
Wait Group Example - Wait for all Go Routines to Finish before resuming
errorChannel := make(chan error)
var wg sync.WaitGroup
funcsToRun := []func(ctx context.Context) error {
implementation.func1,
implementation.func2,
implementation.func3,
}
wg.Add(len(funcsToRun))
@serinth
serinth / gist:5f6e7724f30a69f6b5dcf23a03a8a140
Created May 21, 2018 05:28
grpc connect with insecure
func connect(clientURL string) *grpc.ClientConn {
var opts []grpc.DialOption
opts = append(opts, grpc.WithInsecure())
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()
con, err := grpc.DialContext(ctx, clientURL, opts...)
@serinth
serinth / go-xorm-sqlnull.md
Created April 29, 2018 23:30
Golang XORM mapping null values in response and in DB. Uses protocol buffers

model.proto file:

import "google/protobuf/wrappers.proto";

message Entity {
	google.protobuf.UInt32Value myField  = 1;
}