Skip to content

Instantly share code, notes, and snippets.

View hanpama's full-sized avatar
🎯
Focusing

Kyung-il Choi hanpama

🎯
Focusing
View GitHub Profile
@hanpama
hanpama / pgcc.go
Last active January 7, 2020 14:05
SQL implementation of Relay Cursor Connection
package pgcc
import (
"bytes"
"io"
"text/template"
)
// Options defines required and optional settings for building connection query
type Options struct {
@hanpama
hanpama / djargon2i.go
Created October 4, 2019 01:41
Django Argon2PasswordHasher compatible password hasher in Golang
package djargon2i
import (
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"errors"
"fmt"
"strings"
@hanpama
hanpama / multipart-client.ts
Last active December 17, 2018 14:53
NodeJS http client implementation of GraphQL multipart request
import * as http from 'http';
import FormData from 'form-data';
export class MultipartClient {
constructor(public requestOptions: { host: string, port: number } | { socketPath: string }) {}
async request(method: string, path: string, body?: any, headers: any = {}) {
return new Promise<{ res: http.IncomingMessage, body: Buffer }>((resolve, reject) => {
const req = http.request({
@hanpama
hanpama / docker-workspace.md
Created May 9, 2018 14:45
run specific version of node with docker
  1. cd into your workspace

  2. run:

docker run -it --rm -v $(pwd)/:/app node:9 bash
@hanpama
hanpama / how-to-run-blockchain-on-browser.md
Last active June 3, 2019 18:33
브라우저에서 블록체인 구현하기 (암호화폐)

브라우저에서 블록체인 구현하기 (암호화폐)

  • Nimiq (니믹)
  • JavaScript (browser / nodejs)
  • WebRTC, Websocket 기반 통신
  • 소스코드 살펴보기 https://github.com/nimiq-network/core/
    • 패키징이나 모듈화 방식은 표준적이지는 않음.
      • 브라우저 - 노드 네이티브 환경에서 모두 작동하도록 만드는 것이 주요 목적으로 보임
    • 코드 품질 상당히 좋음
    • 브라우저 위에서 돌리기 위해서인지 코드는 바닥부터 새로 작성됨
@hanpama
hanpama / su_group2kmz.md
Created November 16, 2017 08:17
스케치업에서 루트 레벨 그룹들을 따로 KMZ 파일로 익스포트합니다.

Sketchup Group2KMZ Script

사용 방법

  1. 스케치업의 상단 메뉴에 있는 Window > Ruby Console 항목을 클릭하여 루비 콘솔을 엽니다.
  2. 아래의 스크립트를 붙여 넣고 엔터를 입력 후, 파일들이 들어갈 폴더를 선택합니다.
  3. 폴더에 가보면 kmz 파일들이 생겨 있습니다.
groups = Sketchup.active_model.entities.grep(Sketchup::Group)
@hanpama
hanpama / DataCleanupUtils.rb
Created October 30, 2017 06:39
스케치업 도우미
def pick_one_surface()
model = Sketchup.active_model
faces = model.entities.grep(Sketchup::Face)
puts(faces.length)
return faces[0]
end
def groupify()
face = pick_one_surface()
@hanpama
hanpama / FontSelector.js
Created October 19, 2017 04:23
디자인 회의용 폰트 셀렉터
import { FormControl } from 'material-ui/Form';
import { MenuItem } from 'material-ui/Menu';
import Select from 'material-ui/Select';
import { withStyles } from 'material-ui/styles';
import Input, { InputLabel } from 'material-ui/Input';
import TextField from 'material-ui/TextField';
const ENG_FONTS = [
@hanpama
hanpama / bootstrap-grid-only.css
Created August 5, 2017 14:15
Bootstrap Grid Only
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
article,
aside,
details,
figcaption,
figure,
/**
* NodeJS에서의 비동기 작업 예제
*/
const fs = require('fs');
const util = require('util');
const readdir = util.promisify(fs.readdir);
const writeFile = util.promisify(fs.writeFile);
const readFile = util.promisify(fs.readFile);