Skip to content

Instantly share code, notes, and snippets.

View wubin1989's full-sized avatar

武斌 wubin1989

View GitHub Profile
@wubin1989
wubin1989 / app.js
Created January 8, 2016 05:26 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@wubin1989
wubin1989 / gist:7429885ca9790775557f844b5b82b737
Created August 18, 2016 02:34 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@wubin1989
wubin1989 / Add_in_hadoop-env.sh
Created September 5, 2016 02:09 — forked from faustineinsun/Add_in_hadoop-env.sh
Solve Problem: “Unable to load realm info from SCDynamicStore” (Hadoop 2.2.0, Java 1.6, OS X Mavericks) http://faustineinsun.blogspot.com/2014/01/solve-problem-unable-to-load-realm-info.html
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
...
export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk"
@wubin1989
wubin1989 / ApacheHadoopSpark_LZO.adoc
Created October 14, 2016 11:04 — forked from zedar/ApacheHadoopSpark_LZO.adoc
Add LZO compression codecs to the Apache Hadoop and Spark

Add LZO compresssion codecs to the Apache Hadoop and Spark

LZO is a splittable compression format for files stored in Hadoop’s HDFS. It has valuable combination of speed and compression size. Thanks to hadoop-lzo the .lzo files could be splittable too.

  • Install lzo and lzop codes [OSX].

$ brew install lzo lzop
  • Find where the headers and libraries are installed

@wubin1989
wubin1989 / map.js
Created October 17, 2016 03:39 — forked from Jxck/map.js
Hadoop Streaming with Node.js
#!/usr/bin/env node
var stdin = process.openStdin();
var stdout = process.stdout;
var input = '';
stdin.setEncoding('utf8');
stdin.on('data', function(data) {
if (data) {
input += data;
@wubin1989
wubin1989 / .babelrc
Created November 9, 2016 03:28 — forked from thejmazz/.babelrc
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}
@wubin1989
wubin1989 / gist:41214303a6727b2659461628c600ca0e
Created November 18, 2016 06:15 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb
@wubin1989
wubin1989 / elasticsearch.yml
Created November 21, 2016 10:22 — forked from evanwong/elasticsearch.yml
elasticsearch.yml with defined analysis
##################### Elasticsearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# Elasticsearch comes with reasonable defaults for most settings,
@wubin1989
wubin1989 / app-1.spec.ts
Created December 28, 2016 05:04 — forked from wkwiatek/app-1.spec.ts
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
@wubin1989
wubin1989 / get_random_documents.py
Created January 5, 2017 07:18 — forked from bkersbergen/get_random_documents.py
get some random documents from elasticsearch
from elasticsearch import Elasticsearch
es = Elasticsearch(["node001.bol.com", "node002.bol.com"],
sniff_on_start=True,
# refresh nodes after a node fails to respond
sniff_on_connection_fail=True,
# and also every xxx seconds
sniffer_timeout=300
)
# retrieve 2 random documents from index