Skip to content

Instantly share code, notes, and snippets.

View blmarket's full-sized avatar

Jeong, Heon blmarket

  • Undisclosed company name
  • Vancouver BC, Canada
View GitHub Profile
@blmarket
blmarket / main.R
Created November 15, 2013 08:52
Render multiple png files using R
table <- read.csv('result.csv', head = FALSE)
vec <- as.vector(transform(t(table))[,1][2:1025])
png('result1-0.png', width=720, height=405)
barplot(sapply(vec[1:128], as.numeric), cex.names = 0.00001)
png('result1-1.png', width=720, height=405)
barplot(sapply(vec[1000:1025], as.numeric), cex.names = 0.00001)
vec <- as.vector(transform(t(table))[,5][2:1025])
png('result2-0.png', width=720, height=405)
barplot(sapply(vec[1:128], as.numeric), cex.names = 0.00001)
@blmarket
blmarket / Makefile
Last active December 27, 2015 17:59
Test case for thrift for nodejs.
test: gen-nodejs node_modules
`npm bin`/nodeunit test.js
gen-nodejs:
thrift --gen js:node user.thrift
node_modules:
npm install thrift nodeunit
@blmarket
blmarket / README.mkd
Last active December 3, 2017 16:23
HBase with thrift using node.js

HBase with thrift using node.js

Install (on Mac OS X)

homebrew

Trivial

hbase

@blmarket
blmarket / Gruntfile.coffee
Last active December 22, 2015 17:29
One-page app to display only your board comments
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffee: compile:
options: bare: true
files: 'dist/controller.js': './controller.coffee'
jade: compile:
options: pretty: true
files: 'dist/index.html': [ 'index.jade' ]
@blmarket
blmarket / Gruntfile.coffee
Last active December 22, 2015 08:39
D3 development environment
module.exports = (grunt) ->
grunt.initConfig {
pkg: grunt.file.readJSON('package.json')
coffee: {
compile: {
options: {
bare: false
}
files: {
'dist/app_nodep.js': 'app.coffee'
@blmarket
blmarket / rolling_restart.litcoffee
Created August 30, 2013 11:54
AWS autoscaling server rolling restart script. useful when you changed AMI.

Replacing API servers

API 서버들을 최신 버전으로 업데이트하는 스크립트.

기존 스크립트와의 차이는 다음과 같다.

  • 서버를 모두 새로 띄운다.
    기존 스크립트는 서버를 한대씩 멈추고 업데이트한 다음, 다시 실행하는 방식으로 작동하였는데, 2~3대의 서버가 있을 때 한대를 내리게 되면 잠시나마 서비스에 상당한
@blmarket
blmarket / autofont.py
Last active December 21, 2015 22:19
Terminator plugin which sets font size to 85% of config if window size is smaller than specified value(HARD-CODED)
import pango
from terminatorlib.util import dbg
import terminatorlib.plugin as plugin
# AVAILABLE must contain a list of all the classes that you want exposed
AVAILABLE = ['AutoFontSizePlugin']
class Resizer:
def __init__(self, term):
@blmarket
blmarket / main.coffee
Created August 27, 2013 05:18
node-hbase example. library is documented in http://www.adaltas.com/projects/node-hbase/ but I found it later. I personally tried hbase with curl and this node-hbase(with inspecting src)
util = require 'util'
hbase = require 'hbase'
inspect = (obj) -> util.inspect(obj, { colors: true, depth: null })
debug = (err, res) -> console.log err? && err || inspect(res)
client = hbase {
host: '--some-host--'
port: --some-port-number--
}
@blmarket
blmarket / harass.coffee
Last active December 21, 2015 16:59
Node.js: Experimenting http send response after closing server socket(no more accepts) It works as I expected. clients get response after server socket is closed.
request = require 'request'
url = 'http://localhost:4000'
i = 0
sendRequest = (id) ->
request.get url, (err, res, body) ->
return console.log err if err
console.log "#{id} : #{res.statusCode}"
@blmarket
blmarket / gist:6316088
Created August 23, 2013 06:20
Include only scala library in assembly. in this example, hadoop and hbase are already deployed, so I only need scala, not others.
import AssemblyKeys._
assemblySettings
name := "HelloWorld"
version := "0.0.1"
scalaVersion := "2.9.2"