Skip to content

Instantly share code, notes, and snippets.

View hailiang-wang's full-sized avatar
🌴
On vacation

Hai Liang W. hailiang-wang

🌴
On vacation
View GitHub Profile
@hailiang-wang
hailiang-wang / clusterdump.sh
Created October 24, 2017 10:10 — forked from zviri/clusterdump.sh
Mahout cheat-sheet
mahout clusterdump \
-dt sequencefile \ # format: {Integer => String}
-d reuters-vectors/dictionary.file-* \ # dictionary: {id => word}
-i reuters-kmeans-clusters/clusters-3-final \ # input
-o clusters.txt \ # output (local filesystem)
-b 10 \ # format length
-n 10 # number of top terms to print
--distanceMeasure org.apache.mahout.common.distance.CosineDistanceMeasure # default is euclidean distance
@hailiang-wang
hailiang-wang / pom.xml
Created October 23, 2017 11:54 — forked from daniel-perry/pom.xml
This mahout example: https://cwiki.apache.org/confluence/display/MAHOUT/Quick+tour+of+text+analysis+using+the+Mahout+command+line assumes you know how to use maven to run apache lucene on some text.. which I didn't. This gist is a pom.xml file that will allow you to run the indicated maven command on the reuters text dataset, cobbled together fr…
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dataproj.maven</groupId>
<artifactId>running-lucene-with-maven</artifactId>
<packaging>war</packaging>
<version>0.1</version>
<profiles>
<!-- Add profile configuration here -->
</profiles>
@hailiang-wang
hailiang-wang / gist:497cc491989046309ced8467b4a31df4
Created July 26, 2017 09:11 — forked from carlosmcevilly/gist:2221249
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
@hailiang-wang
hailiang-wang / gist:c7f16239c55f25656c1059a7baf16b33
Created June 24, 2017 06:26 — forked from ttezel/gist:4138642
Natural Language Processing Notes

#A Collection of NLP notes

##N-grams

###Calculating unigram probabilities:

P( wi ) = count ( wi ) ) / count ( total number of words )

In english..

@hailiang-wang
hailiang-wang / pandoc.template.zh.tex
Created June 21, 2017 05:15 — forked from farawayboat/pandoc.template.zh.tex
Chinese LaTeX template (using Ctex) for pandoc.
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{euler}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use microtype if available
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
@hailiang-wang
hailiang-wang / example.cs
Created May 17, 2017 17:24 — forked from brandonmwest/example.cs
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@hailiang-wang
hailiang-wang / index.html
Created March 22, 2017 08:45 — forked from anonymous/index.html
React wrapper for Ace.js
<div id="app"></div>
@hailiang-wang
hailiang-wang / _service.md
Last active February 22, 2017 15:21 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@hailiang-wang
hailiang-wang / Gulp_Typescript_React_JSX_Browserify_Livereload_Nodemon
Created October 9, 2016 06:10
Fullstack solution with GULP 4 - Gulp+Typescript+React+Browserify+Nodemon
// LAST EDIT: 30/11/2015
//GULP 4
var gulp = require('gulp');
var merge = require('merge2');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var uglify = require("gulp-uglify");
var buffer = require('vinyl-buffer');
var notify = require('gulp-notify');
var nodemon = require('gulp-nodemon');
@hailiang-wang
hailiang-wang / mesos-ubuntu-install.sh
Created January 16, 2016 11:10 — forked from crosbymichael/mesos-ubuntu-install.sh
Install mesos on ubuntu 14.04
#!/bin/bash
set -e
apt-get install -y curl python-setuptools python-pip python-dev python-protobuf
# zookeeper
apt-get install -y zookeeperd
echo 1 | dd of=/var/lib/zookeeper/myid