Skip to content

Instantly share code, notes, and snippets.

View suryakencana007's full-sized avatar
🛴
Never End Learning

Nanang Suryadi suryakencana007

🛴
Never End Learning
View GitHub Profile
#!/bin/bash
docker-machine create --driver generic --generic-ip-address=<ip-vps> --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user=ubuntu node-neo-01
@suryakencana007
suryakencana007 / README.md
Created July 18, 2020 19:57 — forked from mattupstate/README.md
An example of how to setup streaming replication for PostgreSQL with Docker.

PostgreSQL Streaming Replication With Docker

The *.txt files here hold user and database parameters. Specifically, replication.txt contains the user/role and password to use for replication. Whereas database.txt contains an initial database, user/role and password to create on the master.

Run the master:

$ fig run -d master

Wait for it to start up completely. Start the slave:

CLI

$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
$ sudo apt update
$ sudo apt install docker-ce
$ sudo usermod -aG docker ${USER}
@suryakencana007
suryakencana007 / docker-run
Last active April 28, 2019 05:54
Getting Started Kong Docker
--- Kong with postgres container
--- Step 1 Migration Database
docker run --rm \
--network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=postgresql-local" \
-e "KONG_PG_DATABASE=kong-database" \
-e "KONG_PG_USER=root" \
-e "KONG_PG_PASSWORD=root" \
kong:latest kong migrations bootstrap
@suryakencana007
suryakencana007 / monthly-date.sql
Last active April 27, 2019 22:48
Get Date Series Monthly
SELECT
DATE(date) AS date_order,
EXTRACT(MONTH FROM DATE(date)) AS month_of
FROM
GENERATE_SERIES(DATE_TRUNC('year', CURRENT_TIMESTAMP + INTERVAL '7 hour'),
DATE_TRUNC('month', CURRENT_TIMESTAMP + INTERVAL '7 hour'),
INTERVAL '1 month') AS date
Results: [
@suryakencana007
suryakencana007 / notes.ini
Last active March 5, 2019 16:34
Artikel CQRS-About
https://github.com/barryosull/the-projectionist
https://barryosull.com/blog/projection-building-blocks-what-you-ll-need-to-build-projections
https://www.erikheemskerk.nl/event-sourcing-cqrs-querying-read-models/
https://github.com/andrewwebber/cqrs
https://medium.com/@pierreprinetti/event-sourcing-in-go-the-event-handler-29f9438c58f0
https://eventstore.org/docs/event-sourcing-basics/index.html
https://medium.com/@eulerfx/scaling-event-sourcing-at-jet-9c873cac33b8
// penting!!!
https://abdullin.com/post/event-sourcing-projections/
@suryakencana007
suryakencana007 / Caller.go
Created December 12, 2018 13:00
Generic Invoke Method in Golang
package reflection
import "reflect"
func CallMethod(i interface{}, methodName string, args ...interface{}) interface{} {
// check for method on pointer
method := reflect.ValueOf(i).MethodByName(methodName)
if method.IsValid() {
var in []reflect.Value
@suryakencana007
suryakencana007 / go-testing.sh
Last active October 8, 2018 06:58
Go Unit Test Tool
# One major new feature of go test is that it can now compute and, with help from a new, separately installed "go tool cover" program, display test coverage results.
# The cover tool is part of the go.tools subrepository. It can be installed by running
go get golang.org/x/tools/cmd/cover
# The cover tool does two things.
# First, when "go test" is given the -cover flag, it is run automatically to rewrite the source for the package and
# insert instrumentation statements.
# The test is then compiled and run as usual, and basic coverage statistics are reported:
go test -coverprofile fmt
@suryakencana007
suryakencana007 / project-go-skeleton.md
Last active September 11, 2018 17:10
project-go-skeleton
.
+-- api
   ├── swagger-iam.json
   ├── swagger-activity-log.json
+-- configs
   ├── app.dev.yaml
   ├── app.yaml.dist
+-- cmd
 ├── app
SELECT
count(1),
m.name AS menu_name
FROM authorizations a
INNER JOIN menus AS m
ON m.menu_id = a.menu_id
HAVING menu_name LIKE '%Group%'
SELECT
authorization_id,