Skip to content

Instantly share code, notes, and snippets.

View angadn's full-sized avatar

Angad Nadkarni angadn

View GitHub Profile
@cb109
cb109 / yup_array_oneOfSchemas.js
Last active June 5, 2023 11:30
YUP: Validate that items in an Array match one of multiple allowed Schemas
/**
* The yup library has no builtin way to check if items in an array
* match one or more defined shapes, we can only check against a set of
* whitelisted values using yup.array().oneOf([..]).
*
* Using yup.addMethod() and yup.mixed().test() however we can pretty
* much add any custom validation we want. The function below allows to
* make validation pass for array items of different shapes.
*/
@mofelee
mofelee / k8s-create-deployment.go
Created November 9, 2017 06:31 — forked from ffledgling/k8s-create-deployment.go
kubernetes client-go example: Create a Deployment based on json
package main
import (
"encoding/json"
"log"
"os"
// We use pretty instead of the common go-spew or pretty-printing because,
// go-spew is vendored in client-go and causes problems
"github.com/kr/pretty"
@bingo347
bingo347 / send_fd__to_node.go
Created January 10, 2017 17:14
send file descriptor from golang to nodejs
package main
import (
"net"
"fmt"
"syscall"
)
func main() {
addr, err := net.ResolveTCPAddr("tcp", "localhost:8090")
@simonswine
simonswine / copy-k8s-resources-across-namespaces.sh
Created August 2, 2016 13:40
Copying kubernetes resources accross namespaces
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create-f -
@vasanthk
vasanthk / System Design.md
Last active November 17, 2024 05:38
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@tristanjahier
tristanjahier / README.md
Last active May 7, 2019 05:26
A script to mass delete Twilio recordings using the Node.js helper library

Twilio recordings mass delete script

This is a Node.js script, written in CoffeeScript. Of course you'll need Node.js and NPM. Additionally, it requires the Coffee Script compiler/interpreter and the Twilio package.

npm install -g coffee-script
npm install twilio

Once everything is ready, you can run the script like that:

@polbins
polbins / README.md
Last active February 29, 2024 09:58
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

@lucacesari
lucacesari / obfuscate.gradle
Created September 19, 2014 06:55
Obfuscate a jar with Gradle
ext {
mainClassName = "foo.bar.buz.mainClass"
basename = "fooBar"
version = "42.0"
}
task obfuscate(type: proguard.gradle.ProGuardTask) {
injars "./build/libs/${basename}-${version}.jar"
outjars "./build/libs/${basename}-${version}-obf.jar"
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@thom-nic
thom-nic / Dockerfile
Created June 18, 2014 15:15
Node.js Dockerfile based on ubuntu 14.04. This is a little smaller than dockerfile/nodejs which depends on python
# Node.js app Docker file
FROM ubuntu:14.04
MAINTAINER Thom Nichols "[email protected]"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -qq update
RUN apt-get install -y nodejs npm