Skip to content

Instantly share code, notes, and snippets.

View chy168's full-sized avatar
🤠

Hung-Yen chy168

🤠
  • Taiwan
View GitHub Profile
@chy168
chy168 / riemann.js
Last active August 29, 2015 13:59 — forked from sentinelleader/riemann.js
riemann for StatsD backend
/*
*
* To enable this backend, include './backends/riemann' in the backends
* configuration array:
*
* Requires Riemann Node client
*
* backends: ['./backends/riemann']
*
*/
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\{\1\}/'
}
if [ "$WINDOW" == "" ] ; then
# PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]{\A}\[\e[0m\]\\$ "
# PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]\$(parse_git_branch)\[\e[0m\]\\$ "
# PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]\$(parse_git_branch)\[\e[0m\]\e[\nm\]\e[30;48;5;105m\\$\e[m "
#export GOPATH="$JENKINS_HOME/workspace/project"
ls -alh $WORKSPACE
export GOPATH="$WORKSPACE"
export PATH="$PATH:$GOPATH/bin"
#go get github.com/ant0ine/go-json-rest/rest
# Build Binary
go get github.com/tools/godep
@chy168
chy168 / server.go
Last active August 29, 2015 14:16
Go HTTP Server Cookie Example
package main
import (
"io"
"log"
)
import "net/http"
func indexHandler(w http.ResponseWriter, req *http.Request) {
//expire := time.Now().AddDate(0, 0, 1)
@chy168
chy168 / main.go
Created June 13, 2015 17:54
test see log trace depth (go-json-rest)
package main
import (
"fmt"
"net/http"
"github.com/ant0ine/go-json-rest/rest"
log "github.com/cihub/seelog"
)
@chy168
chy168 / main.go
Created June 13, 2015 18:02
test see log trace depth
package main
import (
"fmt"
"io"
"net/http"
log "github.com/cihub/seelog"
)
@chy168
chy168 / .gitignore
Created November 2, 2011 07:29 — forked from karmi/.gitignore
Donut Chart from ElasticSearch Terms Facet
.DS_Store
tmp/
@chy168
chy168 / README
Last active December 3, 2015 13:32
Spark-redis example
./bin/spark-shell -packages redis.clients:jedis:2.7.2,com.redislabs:spark-redis:0.5.1 --repositories https://raw.github.com/RedisLabs/spark-redis/mvn-repo/
bad option: '-packages'
@chy168
chy168 / mule
Last active December 24, 2015 16:19 — forked from rhoegg/mule
Mule init script. puppet can detect status to ensure service status.
#!/bin/bash
# Modify from: https://gist.github.com/rhoegg/5681446
# RHEL Mule Init Script
#
# chkconfig: 2345 65 64
# description: Mule ESB service
. /etc/init.d/functions
#
if [ -f /etc/sysconfig/mule ]; then
@chy168
chy168 / gist:c599a2b2f85697a942e6
Created March 5, 2016 03:24
Spark Mllib K-means example
// k-mean
import org.apache.spark.mllib.clustering.{KMeans, KMeansModel}
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.regression.LabeledPoint
case class Data(userId: String, videoId: String, isKid: String)
val raw_data = sc.textFile("/Users/zzchen/Downloads/locked_video_up5.csv").map { line =>
val f = line.split(",")
Data(f(0),f(1).split("=")(1),f(5))