Skip to content

Instantly share code, notes, and snippets.

View iamgoangle's full-sized avatar
:octocat:
Focusing

Teerapong Singthong iamgoangle

:octocat:
Focusing
View GitHub Profile
@iamgoangle
iamgoangle / .eslintrc
Created August 21, 2017 13:01
my-eslint-react
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
@iamgoangle
iamgoangle / server.js
Last active December 16, 2017 15:58
Perf express
const express = require('express');
const morgan = require('morgan');
const moment = require('moment');
const app = express();
app.use(morgan('dev'));
const sleep = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
rabbitmq:
image: rabbitmq:management-alpine
tty: true
environment
# RABBITMQ_DEFAULT_USER: 'admin'
# RABBITMQ_DEFAULT_PASS: 'admin'
RABBITMQ_DEFAULT_VHOST: '/'
ports:
- '15672:15672'
- '5672:5672'
// Do not use this code on your production
const q = 'Customer created event'
const amqp = require('amqplib').connect('amqp://localhost')
async function customerService(msg) {
console.time('customerService')
console.log(`%s Launch publisher...`, '🚁')
try {
const conn = await amqp
const ch = await conn.createChannel()
// Do not use this code on your production
const q = 'Customer created event'
const amqp = require('amqplib/callback_api')
async function loyaltyService() {
const conn = amqp.connect(
'amqp://localhost',
(err, conn) => {
conn.createChannel((err, ch) => {
var ex = 'Customer created event'
@iamgoangle
iamgoangle / golf.go
Last active January 25, 2019 11:16
golf experiment - gorilla mux
package main
import (
"log"
"net/http"
"time"
"github.com/gorilla/mux"
)
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentdconf
namespace: kube-system
data:
fluent.conf: |
<match fluent.**>
@type null
@iamgoangle
iamgoangle / flex_message_preview.sh
Created February 2, 2019 15:49
Flex Message Preview
curl -X POST \
https://developers.line.biz/api/v1/fx/render \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-GB,en;q=0.9,th;q=0.8,en-US;q=0.7' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: ldsuid=5fc6f37aa577adf4d3ed84f86d98ece6; ses=V/0AiYfkLg6eoyk8HCbilr0Ek7clI8kNvbesFikgu7+uvKGWZIfxrBuosE0IJZNEmMF6BzyS8up76BPj0OOZ4QyPE9KY+9nQ28YBor8SaGfX8xU+vHIf5qCfaUa2454qyNzWcfdZkOY6lFfiN1LYSTfWdVeVhylnOFB40zfuIspjW1KI/OhYHvDacFXMsgTLEcBOkuma684qtqP/aHS0jvf1jtC3oVkenGd0fqxgDKJuNP1u5idZMt/cAj4j8/Dav9JGjTJTA0aDixVaxmCVXJKN6FbpsImRXShAPVD0jwwVEbnW+EXXXP8hpexovJ4JkmF+kS6yczEMJPtqvrcuJ5jIWIajc/sw63hsFMpffoGuFdMAVZRNQLtt9cAd7T8mfioT8kOz9fU0YAytYhNL8Q==' \
-H 'Origin: https://developers.line.biz' \
@iamgoangle
iamgoangle / flex_message_preview.go
Created February 2, 2019 15:49
Flex Message in GO
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
@iamgoangle
iamgoangle / basic_auth.go
Created February 13, 2019 16:10
Basic Auth Example
import (
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
// bpAdmin higher order function to perform basic authentication
// username and password must be stored in k8s secret
// this is just example for guide line.