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.coffee
Created July 17, 2013 13:07
Head First node.js zookeeper 클라이언트 샘플 코드.
zookeeper = require 'node-zookeeper-client'
client = zookeeper.createClient '__your__zookeeper__host__with:port__'
listChildren = (client, path) ->
client.getChildren(
path
(err, children, stat) ->
console.log err, children
)
@blmarket
blmarket / service.conf
Last active December 20, 2015 06:39
Node.js daemon configuration using upstart
# upstart config
author "blmarket"
description "service-admin daemon upstart for ubuntu"
start on runlevel[2345]
stop on runlevel[!2345]
respawn # restart task if failed
respawn limit 5 20 # respawn up to 5 times if failed(with 20 sec of interval)
@blmarket
blmarket / HBaseNoob.scala
Last active April 30, 2023 06:15
Scala+HBase bootstrap project includes sbt and HelloWorld file.
// run this with sbt run
import org.apache.hadoop.hbase._
import org.apache.hadoop.hbase.client._
import org.apache.hadoop.hbase.util._
import org.apache.hadoop.hbase.client.{HBaseAdmin,Scan,Result}
import org.apache.hadoop.hbase.mapreduce.{TableMapper,TableMapReduceUtil}
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
@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"
@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 / 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 / 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 / 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 / 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 / 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' ]