Skip to content

Instantly share code, notes, and snippets.

View vitamin's full-sized avatar

David Wang vitamin

  • Beijing
View GitHub Profile
# 导入数据
text <- readLines('d:\\honglou.txt',encoding='UTF-8')
library(ggplot2)
library(rmmseg4j)
library(tm)
library(MASS)
library(proxy)
#去除空白行
@leemars
leemars / sync.sh
Created July 5, 2012 02:50
Git -> SVN sync script
#!/bin/bash
if [[ $# != 1 && $# != 2 ]]
then
echo "$0 <path to git repository> [tree-ish]"
exit 1
fi
msg() {
echo -e -n "\e[32;1m==>\e[0m "
@leemars
leemars / product.md
Last active March 7, 2016 12:30
万熊家的后山洞 亲友团

最后更新时间: 2014.1.19 | 点击 这里 前往店铺

熊, 听说你创业出来开淘宝店了?

我是出来折腾创业了, 但不是开淘宝店啊... 淘宝店哪里有这么好开!! 根本养不活自己的好吗!!

  • 因为工作原因, 需要对淘宝卖家工具进行测试, 所以开了店铺
  • 因为开了店铺以后需要往店里填充点宝贝才能测试, 所以做了分销
  • 因为自己是个吃货, 所以挑了零食的分销, 给自己买点便宜零食吃
  • 既然可以给自己买, 不如搞个亲友团, 给大家提供点便宜零食也不错的感觉, 乐于助人嘛
@sadikovi
sadikovi / udf.scala
Created July 28, 2017 00:03
Spark SQL UDF for StructType
import org.apache.spark.sql._
import org.apache.spark.sql.types._
import org.apache.spark.sql.expressions._
val df = Seq(
("str", 1, 0.2)
).toDF("a", "b", "c").
withColumn("struct", struct($"a", $"b", $"c"))
// UDF for struct
@sadikovi
sadikovi / code.scala
Created July 28, 2017 00:04
Spark SQL window functions + collect_list for custom processing
val df = Seq(
(System.currentTimeMillis, "user1", 0.3, Seq(0.1, 0.2)),
(System.currentTimeMillis + 1000000L, "user1", 0.5, Seq(0.1, 0.2)),
(System.currentTimeMillis + 2000000L, "user1", 0.2, Seq(0.1, 0.2)),
(System.currentTimeMillis + 3000000L, "user1", 0.1, Seq(0.1, 0.2)),
(System.currentTimeMillis + 4000000L, "user1", 1.3, Seq(0.1, 0.2)),
(System.currentTimeMillis + 5000000L, "user1", 2.3, Seq(0.1, 0.2)),
(System.currentTimeMillis + 6000000L, "user2", 2.3, Seq(0.1, 0.2))
).toDF("t", "u", "s", "l")