Skip to content

Instantly share code, notes, and snippets.

View zxh's full-sized avatar
🎈

zxh zxh

🎈
  • AWS, Amazon
  • Beijing
View GitHub Profile
@zxh
zxh / Setting trackpoint for Linux
Created December 23, 2012 10:22
Linux下设置trackpoint的属性
小红帽是tp的一大利器。在ubuntu下速度慢。
先查看一下设备的属性:
udevadm test /sys/devices/platform/i8042/serio1/serio2
在最后有:
ACTION=add
DEVPATH=/devices/platform/i8042/serio1/serio2
DRIVER=psmouse
MODALIAS=serio:ty05pr00id00ex00
SERIO_EXTRA=00
SERIO_ID=00
@zxh
zxh / goagent for Ubuntu
Created December 23, 2012 14:34
在Ubuntu下使用goagent
在win下如何使用goagent,google看看。哦,对了,百度查吧,用google搜索会断开链接!
在ubuntu下,使用goagent,下面的过程不是在win下都需要的。当然也需要google的appid。
首先在 http://appengine.google.com 注册Google App Engine账号(Gmail账号通用)。
然后创建Google App Engine的ID,顺利登录后,点击Creat an Application。
Ubuntu需要下载并安装goagent和Google AppEngine SDK。
goagent下载地址:http://code.google.com/p/goagent/
Google AppEngine SDK下载地址:https://code.google.com/intl/zh-CN/appengine/downloads.html
下载Google AppEngine SDK for Python版本(linux)。
然后,goagent解压goagent到google_appengine目录下。
@zxh
zxh / gist:7280252
Created November 2, 2013 15:47
What is Daemon thread in java
I answered it on stackoverflow.com:
http://stackoverflow.com/questions/2213340/what-is-daemon-thread-in-java/18428894#18428894
Java has a special kind of thread called daemon thread.
Very low priority.
Only executes when no other thread of the same program is running.
JVM ends the program finishing these threads, when daemon threads are the only threads running in a program.
What does daemon thread used for?

词的分类

  • 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
  • 虚词:副词、介词、连词、助词、拟声词、叹词。

ICTPOS3.0词性标记集

n 名词

nr 人名

@zxh
zxh / List pattern matching last element in Scala.md
Last active May 2, 2017 05:37
List pattern matching last element in Scala.

Scala pattern matching 太强大了,但是想匹配一个 list 的最后一个元素,有些蛋疼。 本来想尝试 case (List(_* ,last)) => ... 但是居然编译都报错,原来 _* 只能扔到最后去。 如果用

(1 to 9).toList match {
  case _ :: 9 :: Nil=> "no way"
}
@zxh
zxh / getip.go
Created February 9, 2018 07:43
golang get ip address
func getIp() (net.IP, error) {
interfaces, e := net.Interfaces()
if e != nil {
return nil, errors.New("get Interfaces error")
}
for _, i := range interfaces {
// the flags value maybe 'pointtopoint', it also has a ip, filter it.
if !strings.Contains(i.Flags.String(), "broadcast") {
continue
}
@zxh
zxh / format.go
Created March 17, 2018 06:19
Convert CamelCase to underscore in golang
// Camelcase to underscore style.
func ToUnderScore(name string) string {
l := len(name)
ss := strings.Split(name, "")
// we just care about the key of idx map,
// the value of map is meaningless
idx := make(map[int]int, 1)
var rs []rune
@zxh
zxh / url_query_escape.go
Created March 28, 2018 10:03
goalng url encode, query param encode, path escape, query escape, space escape
package main
import (
"fmt"
"net/url"
)
func main() {
fmt.Println("Path参数中对空格的转义:"+url.PathEscape("hello world"))
fmt.Println("Query参数中对空格的转义:"+url.QueryEscape("hello world"))
@zxh
zxh / Java.md
Last active June 1, 2018 09:37 — forked from JeOam/Java.md
Install Java 8 on OS X

on El Capitan, after installing the brew...

$ brew update
$ brew tap caskroom/cask
$ brew install Caskroom/cask/java

And Java 8 will be installed at /Library/Java/JavaVirtualMachines/jdk1.8.xxx.jdk/

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
@zxh
zxh / change_scala_version.sh
Created June 21, 2018 09:39
change scala version via brew
# show all scala versions
brew search scala
# install specific version, maybe scala 2.11
brew install scala@2.11
# unlink current scala version
brew unlink scala
# link new scala version