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 / 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 / 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'])
)
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',
class A {
state = {
x: 0,
y: 1
}
constructor(initialState?: A) {
if (initialState) {
this.state = initialState
}
@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 / throttle-vs-debounce.js
Created June 9, 2018 20:14
throttle-does-not-guarantee-latest-call
import {throttle, debounce} from 'lodash'
const delay = () => new Promise(r => setTimeout(r, 100))
describe('throttle vs debouce', () => {
beforeEach(() => {
console.log = jest.fn()
})
it('throttle does not guarantee about execute latest call', async (done) => {
const i = throttle(x => console.log(x), 300)
let count = 0
@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),