Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

riz automaticalldramatic

🎯
Focusing
Block or report user

Report or block automaticalldramatic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@automaticalldramatic
automaticalldramatic / postgres-brew.md
Created Nov 11, 2019 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)
View postgres-brew.md

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@automaticalldramatic
automaticalldramatic / app.yaml
Last active Sep 6, 2019
A cloudbuild that works for me with private packages
View app.yaml
env: flex
runtime: go1.12
main: cmd/some-service-name/main.go
@automaticalldramatic
automaticalldramatic / golang-nuts.go
Last active Sep 3, 2019 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
View golang-nuts.go
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@automaticalldramatic
automaticalldramatic / list-struct.go
Last active Aug 21, 2019
List out all the values in a struct
View list-struct.go
// testing output
reflectedStruct := reflect.ValueOf(event)
// in case you want to list all values stored at the location of this pointer to a struct
if reflectedStruct.Kind() == reflect.Ptr {
reflectedStruct = reflectedStruct.Elem()
}
@automaticalldramatic
automaticalldramatic / channel_demo.go
Last active Aug 18, 2019 — forked from JensRantil/channel_demo.go
Simplification of sample code at https://blog.gopheracademy.com/advent-2015/automi-stream-processing-over-go-channels/ Best practise is 1) to inject channels and 2) avoid concurrency in APIs.
View channel_demo.go
func ingest(out <-chan []string) {
out <- []string{"aaaa", "bbb"}
out <- []string{"cccccc", "dddddd"}
out <- []string{"e", "fffff", "g"}
close(out)
}
func process(in <-chan []string, out <-chan int) {
for data := range in {
for _, word := range data {
@automaticalldramatic
automaticalldramatic / k8s-cronjob-trigger-manually.md
Created Aug 8, 2019
How to trigger a Kubernetes cronjob manually
View k8s-cronjob-trigger-manually.md
kubectl create job --from=cronjob/<name of cronjob> <name of job>
@automaticalldramatic
automaticalldramatic / 20140316-205912.go
Created Jul 19, 2019 — forked from ryochack/20140316-205912.go
golang reflection: interface of array
View 20140316-205912.go
package main
import (
"fmt"
"reflect"
)
func dump_interface_array(args interface{}) {
val := reflect.ValueOf(args)
fmt.Println(val.Kind())
@automaticalldramatic
automaticalldramatic / dump.go
Created Jul 19, 2019 — forked from ahmdrz/dump.go
Golang Reflection Example of an array.
View dump.go
package main
import (
"fmt"
"reflect"
)
type Test struct {
Name string
}
View class_decorator.ts
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@automaticalldramatic
automaticalldramatic / create-self-signed-crt.sh
Created Nov 26, 2018
Generating self signed certificates
View create-self-signed-crt.sh
!/bin/bash
# Inspired from: https://github.com/grpc/grpc-java/tree/master/examples#generating-self-signed-certificates-for-use-with-grpc
# Output files
# ca.key: Certificate Authority private key file (this shouldn't be shared in real-life)
# ca.crt: Certificate Authority trust certificate (this should be shared with users in real-life)
# server.key: Server private key, password protected (this shouldn't be shared)
# server.csr: Server certificate signing request (this should be shared with the CA owner)
# server.crt: Server certificate signed by the CA (this would be sent back by the CA owner) - keep on server
# server.pem: Conversion of server.key into a format gRPC likes (this shouldn't be shared)
You can’t perform that action at this time.