Skip to content

Instantly share code, notes, and snippets.

View yuecong's full-sized avatar

Cong Yue yuecong

View GitHub Profile
@yuecong
yuecong / gist:1ac64bd90a1e99c89008
Created October 29, 2015 06:45
pandas install into AMI linux
http://blog.datapolitan.com/2015/08/25/installing-matplotlib-and-pandas-on-amazon-ec2/
sudo yum groupinstall "Development Tools"
sudo yum install python-devel libpng-devel freetype-devel
sudo pip install pandas
sudo yum-config-manager --enable epel
sudo yum install p7zip
#download .7z file
wget https://dumps.wikimedia.org/enwiki/20150901/enwiki-20150901-pages-meta-history1.xml-p000000010p000002861.7z
#check md5 sum
md5sum enwiki-20150901-pages-meta-history1.xml-p000000010p000002861.7z
# decompress .7z file
{
"instrument" : "EUR_USD",
"granularity" : "H1",
"candles" : [
{
"time" : "2002-05-06T20:00:00.000000Z",
"openBid" : 0.9181,
"openAsk" : 0.9184,
"highBid" : 0.9181,
"highAsk" : 0.9184,
@yuecong
yuecong / gist:51eacf70408f368bfdd1
Created March 3, 2015 18:03
terms agreegation
GET /ats/_search
{
"size": 0,
"aggs": {
"top_request_URL": {
"terms": {
"field": "requestURL",
"size": 10,
"order": {
"_count": "desc"
@yuecong
yuecong / gist:7a678517064667aa294f
Created February 23, 2015 19:31
bulk helper code
# build_index.py
import datetime
from elasticsearch import Elasticsearch
from elasticsearch import helpers
FILE_PATH = "./squid.log.1"
ES_HOST = {
"host" : "10.0.0.158",
"port" : 9200
}
@yuecong
yuecong / gist:67237a5aae2dc2ea6f2d
Created February 23, 2015 18:18
Bulk data morn than 10 make some data lost.
This file has been truncated, but you can view the full file.
curl 'localhost:9200/_cat/indices?v';
health status index pri rep docs.count docs.deleted store.size pri.store.size
yellow open .kibana 1 1 2 2 10.5kb 10.5kb
green open ats 1 0 23307 31 1.7mb 1.7mb
mk_index.py
# build_index.py