Skip to content

Instantly share code, notes, and snippets.

View erickguan's full-sized avatar

Erick Guan erickguan

View GitHub Profile
瑞典
中瑞典大学
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@erickguan
erickguan / tcp-lab3-plot-generator.py
Created October 30, 2015 22:17
A python script generate bit rate plot based on csv exported from Wireshark
import csv
import numpy as np
import matplotlib.pyplot as plt
start_time = 45.0
tick = 1
end_time = start_time + 60.0 * 2
protocol = 'TCP'
with open('hls2.csv', newline='') as csvfile:
@erickguan
erickguan / web.china.template.yml
Created March 15, 2016 12:33
展示一下 CA 证书的配置情况
hooks:
before_web:
- exec:
cmd:
- curl -o /shared/cacerts.pem https://curl.haxx.se/ca/cacert.pem
- export SSL_CERT_FILE=/shared/cacerts.pem
- cat -n /shared/cacerts.pem
- ls -alh /shared
- gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
library("class")
iris <- read.csv("/Users/fantasticfears/Downloads/iris.csv", header=FALSE)
irisShuffled <- iris[sample(nrow(iris)),]
irisShuffledRaw <- irisShuffled[,1:4]
train <- irisShuffledRaw[1:100,]
test <- irisShuffledRaw[101:nrow(iris),]
cl <- factor(as.array(irisShuffled[1:100,5]))
predicted <- knn(train, test, cl, prob=TRUE)
@erickguan
erickguan / PRC_natural_reserves.csv
Created May 21, 2017 17:07
CSV exports from P.R.C. national natural reserves via Tabula. PDF from: http://sts.mep.gov.cn/zrbhq/zrbhq/201611/P020161125559865886359.pdf
序号 保护区名称 行政区域 面积 主要保护对象 类型 级别 始建时间 主管部
京01 百花山 北京市门头沟区 21743.1 温带次生林 森林生态 国家级 19850401 林业
京02 拒马河 北京市房山区 1125 大鲵等水生野生动物 野生动物 省级 19961121 农业
京03 蒲洼 北京市房山区 5396.5 森林生态系统 森林生态 省级 20050404 林业
京04 石花洞 北京市房山区 3650 岩溶洞穴 地质遗迹 省级 20001226 国土
京05 汉石桥湿地 北京市顺义区 1615 湿地生态系统及野生动植物 内陆湿地 省级 20050404 林业
京06 怀沙河、怀九河 北京市怀柔区 111 大鲵、中华九刺鱼、鸳鸯等野生动物 野生动物 省级 19961121 农业
京07 喇叭沟门 北京市怀柔区 18482.5 森林生态系统 森林生态 省级 19991213 林业
京08 四座楼 北京市平谷区 19997 森林生态系统 森林生态 省级 20021229 林业
京09 密云雾灵山 密云县 4152.4 森林生态系统及金钱豹等珍稀动植物 森林生态 省级 20001226 林业
@erickguan
erickguan / 2015_PRC_natural_reserves.csv
Created May 21, 2017 17:09
2015 CSV exports from P.R.C. national natural reserves via Tabula. PDF from: http://sts.mep.gov.cn/zrbhq/zrbhq/201611/P020161125559865886359.pdf
京01 百花山 北京市门头沟区 21743.1 温带次生林 森林生态 国家级 19850401 林业
京02 拒马河 北京市房山区 1125 大鲵等水生野生动物 野生动物 省级 19961121 农业
京03 蒲洼 北京市房山区 5396.5 森林生态系统 森林生态 省级 20050404 林业
京04 石花洞 北京市房山区 3650 岩溶洞穴 地质遗迹 省级 20001226 国土
京05 汉石桥湿地 北京市顺义区 1615 湿地生态系统及野生动植物 内陆湿地 省级 20050404 林业
京06 怀沙河、怀九河 北京市怀柔区 111 大鲵、中华九刺鱼、鸳鸯等野生动物 野生动物 省级 19961121 农业
京07 喇叭沟门 北京市怀柔区 18482.5 森林生态系统 森林生态 省级 19991213 林业
京08 四座楼 北京市平谷区 19997 森林生态系统 森林生态 省级 20021229 林业
京09 密云雾灵山 密云县 4152.4 森林生态系统及金钱豹等珍稀动植物 森林生态 省级 20001226 林业
@erickguan
erickguan / keybase.md
Created September 4, 2017 19:36
Keybase Signature

Keybase proof

I hereby claim:

  • I am fantasticfears on github.
  • I am fantasticfears (https://keybase.io/fantasticfears) on keybase.
  • I have a public key whose fingerprint is 93FA 3555 6212 7E0E 483A 2714 1007 5E9E 7640 7351

To claim this, I am signing this object:

#ifndef RANG_DOT_HPP
#define RANG_DOT_HPP
#if defined(__unix__) || defined(__unix) || defined(__linux__)
#define OS_LINUX
#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)
#define OS_WIN
#elif defined(__APPLE__) || defined(__MACH__)
#define OS_MAC
#else
@erickguan
erickguan / info.sql
Created November 28, 2017 20:07
WAM2017 stat. Loaded to PostgreSQL by pgloader
-- 20 global top users (40 fetched)
SELECT
a.User AS username,
COUNT(a.NAME) AS articleCount,
e.Code AS editathonCode,
e.Description AS ediathonDescription
FROM
fountain.article a
LEFT JOIN fountain.editathon e ON a.EditathonId = e.Id
WHERE (LOWER(e.Code)