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 / Dockerfile-github-actions-self-hosted-runner-ubuntu-20.04
Created December 11, 2020 17:37
github actions - self hosted runner ubuntu 20.04
FROM ubuntu:20.04
SHELL ["/bin/bash", "-c"]
ENV RUNNER_ALLOW_RUNASROOT=true
ARG DEBIAN_FRONTEND=noninteractive
RUN sed -i 's/kr.archive.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list
RUN apt update
RUN apt install -y git dnsutils bison brotli bzip2 curl dbus dpkg fakeroot file flex ftp gnupg2 iproute2 iputils-ping jq lib32z1 libc++-dev libc++abi-dev libcurl4 libgbm-dev libgconf-2-4 libgtk-3-0 libsecret-1-dev libsqlite3-dev libunwind8 libxkbfile-dev libxss1 locales m4 netcat openssh-client parallel patchelf pkg-config python-is-python3 rpm rsync shellcheck sqlite3 ssh sudo telnet texinfo time tk tzdata unzip upx wget xorriso xvfb xz-utils zip zstd zsync
@deptno
deptno / fragment.ts
Created June 25, 2018 02:53
graphql-tag fragment example
import gql from 'graphql-tag'
const FRAGMENT_REPOSITORY = gql`
fragment repository on Repository {
name
url
createdAt
description
descriptionHTML
labels {
@deptno
deptno / rtx3080.js
Last active November 4, 2020 11:55
rtx3080
const rog = 'http://www.11st.co.kr/products/3126107080?trTypeCd=03&trCtgrNo=2046005'
const tuf = 'http://www.11st.co.kr/products/3052905270?trTypeCd=03&trCtgrNo=2046005'
const puppeteer = require('puppeteer')
const vulcan = 'http://www.11st.co.kr/products/3136907976?xfrom=&xzone=&ts=1604400314021'
const cases = 'http://www.11st.co.kr/products/2314458619'
async function main(url) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
@deptno
deptno / strong-typed-redux-action.ts
Last active April 22, 2020 17:46
strong typed redux action with typescript@2.8
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 / dynamodb-inflate.js
Created November 2, 2019 17:44
read gzipped base64
const zlib = require('zlib')
const R = require('ramda')
const unzip = R.compose(
JSON.parse,
zlib.inflateSync,
R.partialRight(Buffer.from, ['base64'])
)
@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
const dataSelectHandler = (data) => {
console.log('data', data)
}
const graph = new Chart(ref.current, {
data : {
labels : Array(30).fill(0).map((_, i) => i + 1 + ''),
datasets: [
{
values,
chartType: 'line',
@deptno
deptno / debug-line-number.js
Created October 30, 2018 04:00
extract line number sample
const stack = new Error().stack!.split('\n').slice(3)[0]
const regexp = /\((\S+)\)/
const match = stack.match(regexp)![1]
const line = `${path.basename(path.dirname(match))}/${path.basename(match)}`
@deptno
deptno / serverless-next-exporter.js
Created October 22, 2018 09:03
Serverless next.js export hack
import loadConfig from 'next/dist/server/config'
import {PHASE_EXPORT} from 'next/constants'
import exporter from 'next/dist/export'
export const exports = async (event, context, callback) => {
const dir = '.'
const result = await exporter(dir,
{
silent: false,
outdir: 'out',
@deptno
deptno / export-path.map.js
Last active August 2, 2018 12:24
next.js@3 static export utility
const root = `${__dirname}/pages`
const path = require('path')
const tree = require('directory-tree')
module.exports.exportPathMap = () => files(tree(root).children)
.reduce((ret, file) => {
ret[file] = {page: file}
return ret
}, {'/': {page: '/index'}})