Skip to content

Instantly share code, notes, and snippets.

View deptno's full-sized avatar
:octocat:
midnight coding

Bonggyun Lee deptno

:octocat:
midnight coding
View GitHub Profile
@deptno
deptno / cwlog-oneline.js
Last active May 25, 2018 08:22
aws-cwlog cloudwatch log transform oneline format
// aws-cwlog trnasform script <https://www.npmjs.com/package/aws-cwlog>
// CloudWatch Log to oneline format eg."2018-05-25T04:41:58 log message"
map(
pipe(
dissoc('ingestionTime'),
over(
lensProp('timestamp'),
pipe(
x => new Date(x).toISOString(),
slice(0, -5),
@deptno
deptno / jq-cheatsheet.md
Last active April 2, 2018 11:46
cheatsheet: jq vs javascript comparison

collection

find

{
  "data": {
    "people": [
      {
 "name": "deptno"
@deptno
deptno / strong-typed-redux-thunk-action.ts
Last active June 22, 2018 17:00
strong typed redux thunk action with [email protected]
import {ThunkAction} from 'redux-thunk'
export const thunks: ThunkActionCreators = {
thunkA: () => {
return (dispatch, getState, extraArgs) => {
setTimeout(function useTimeoutBecauseImThunk() {
dispatch(actions.actionA())
}, 1000)
}
},
@deptno
deptno / strong-typed-redux-action.ts
Last active April 22, 2020 17:46
strong typed redux action with [email protected]
function createAction<A extends ActionTypes>(type: A): TypedAction<A>
function createAction<A extends ActionTypes, P>(type: A, payload: P): TypePayloadAction<A, P>
function createAction(type, payload?) {
return payload !== undefined ? {type, payload} : {type}
}
enum ActionTypes {
ACTION_1 = 'action 1',
ACTION_2 = 'action 2'
}
@deptno
deptno / nodemon.json
Created February 14, 2018 17:14
golang for nodemon.json
{
"verbose": false,
"ignore": [
"*.test.go"
],
"execMap": {
"go": "go run"
}
}
@deptno
deptno / currency-emoji-to-slack.yaml
Created February 8, 2018 06:28
add crypto currency imoji to slack yam
title: crypto-currency-icons
emojis:
- name: act
src: https://github.com/cjdowner/cryptocurrency-icons/raw/master/32@2x/icon/[email protected]
- name: ada
src: https://github.com/cjdowner/cryptocurrency-icons/raw/master/32@2x/icon/[email protected]
- name: adx
src: https://github.com/cjdowner/cryptocurrency-icons/raw/master/32@2x/icon/[email protected]
- name: ae
src: https://github.com/cjdowner/cryptocurrency-icons/raw/master/32@2x/icon/[email protected]
@deptno
deptno / circleci-awscli-ecr.yml
Last active February 14, 2018 15:01
circleci awscli ecr
version: 2
jobs:
build:
branches:
only:
- master
docker:
- image: circleci/node:8-stretch
working_directory: ~/repo
@deptno
deptno / send-codebuild-result-to-slack.sh
Last active July 13, 2019 11:54
notify codebuild result to slack
echo ${CODEBUILD_BUILD_ID} | awk '{ print "{\"text\": \"빌드로그 <https://ap-northeast-2.console.aws.amazon.com/codebuild/home\?region\=ap-northeast-2\#/builds/" $1 "/view/new|" $1 ">\"}"}' | curl -H "Content-Type: application/json" -X POST -d @- https://api.dev.googit.co/common/send-to-channel-labs
console.table(
Array
.from(document.querySelectorAll('.ty04 tr'))
.map(
tr => Array
.from(tr.querySelectorAll('th,td'))
.map(td => td.textContent)
)
)
@deptno
deptno / mongo-db-sync.ts
Last active October 7, 2017 18:35
redux middleware - db sync
import {Middleware} from 'redux'
import {CollectionInsertManyOptions, CollectionInsertOneOptions, MongoClient} from 'mongodb'
export interface Argument {
mongoDbUrl: string
dbCollectionPrefix: string
insertOneOptions?: CollectionInsertOneOptions
insertManyOptions?: CollectionInsertManyOptions
}