Skip to content

Instantly share code, notes, and snippets.

View ohgyun's full-sized avatar

Ohgyun Ahn ohgyun

View GitHub Profile
@ohgyun
ohgyun / oh.py
Last active June 18, 2019 06:21
꿀벌개발일지 검색 알프레드
#!/usr/bin/python
# encoding: utf-8
import sys
import os
from workflow import Workflow3, web
reload(sys)
sys.setdefaultencoding("utf-8")
@ohgyun
ohgyun / Makefile
Created April 25, 2019 13:28 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@ohgyun
ohgyun / notebook.tpl
Created September 28, 2018 16:13
Jupyter notebook template
{%- extends 'basic.tpl' -%}
{%- block header -%}
<!DOCTYPE html>
<html>
<head>
{%- block html_head -%}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,target-densitydpi=medium-dpi,viewport-fit=cover">
<meta name="format-detection" content="telephone=no,address=no,email=no"/>
@ohgyun
ohgyun / webpack.config.js
Created February 3, 2018 18:35 — forked from ayastreb/webpack.config.js
Build Chrome Extension with React using Webpack
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
// Entry files for our popup and background pages
entry: {
popup: './src/popup.js',
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
@ohgyun
ohgyun / promises-error-handling
Last active January 3, 2016 10:39
Promises Error Handling
var p = function () {
var d = Q.defer();
d.reject();
return d.promise;
};
# Case 1
p()
.then(function () {
console.log('A');
/**
* 데이터 타입을 미리 정의하고, 전달받은 데이터에서 타입에 맞는 값을 받아 설정한다.
* 타입 정의는 JSON 형태로 하며, 객체에 설정한 키값을 {{ }} 안에 dot으로 패스를 구분해 넣는다.
* {
* '전달받을 데이터의 키': '{{dot으로 구분한 키값}}',
* }
*
* @param {Object} context
* @param {Object} data
* @param {Object} typeDef
@ohgyun
ohgyun / hexstr2binstr.js
Last active December 17, 2015 22:39
Convert hex strings to binary strings.
var str = '0x48 0x65 0x6c 0x6c 0x6f'; // Hello
hexstr2binstr(str); //--> '0100 1000 0110 0101 0110 1100 0110 1100 0110 1111'
function hexstr2binstr(hexstr) {
return hexstr.split(' ').map(function (v) {
var bins = Number(v).toString(2).split('');
while (bins.length < 8) {
bins.unshift('0'); // left padding with '0'
}
@ohgyun
ohgyun / Gruntfile.js
Last active December 16, 2015 13:29
Gruntfile for a JavaScript library.
module.exports = function (grunt) {
// Code snippets for livereload
// https://github.com/gruntjs/grunt-contrib-livereload
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
@ohgyun
ohgyun / Gruntfile-buildjs.js
Created April 11, 2013 08:01
Gruntfile for compress javascript.
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: '/*! <%= pkg.name %> - <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n\n',
separator: '\n'
},