Skip to content

Instantly share code, notes, and snippets.

View diggzhang's full-sized avatar
🎯
Focusing

Xingze Zhang diggzhang

🎯
Focusing
View GitHub Profile
#!/bin/sh
# mongodb部署脚本
# https://gist.github.com/chappy84/4400325/download#
# diggzh 2015/7/2
# MongoDB Version
MONGODB_DISC='linux-x86_64'
MONGODB_VER='3.0.4'
TAR_TGZ='tgz'
@diggzhang
diggzhang / 0_reuse_code.js
Created September 27, 2015 10:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# -*- coding: utf-8 -*-
__author__ = 'ronfe'
import os
from pymongo import MongoClient, DESCENDING
from bson.objectid import ObjectId
from bson.son import SON
import datetime
import threading
@diggzhang
diggzhang / weeklyDataReport.py
Created November 9, 2015 02:49
数据周报 code review 之后
# _*_ coding: utf8 _*_
from pymongo import MongoClient
from bson.objectid import ObjectId
import datetime
# link to db
dbClient = MongoClient('mongodb://localhost:27017')
db = dbClient['yangcong-prod25']
@diggzhang
diggzhang / psutilBasicUsage.py
Created November 12, 2015 05:56
psutil basic usage
import psutil,datetime
def printLine():
print('----------------')
printLine()
print('CPU:')
print(str(psutil.cpu_times()))
printLine()
@diggzhang
diggzhang / weelyAct.py
Last active November 17, 2015 03:30
周活跃
# _*_ coding: utf8 _*_
from pymongo import MongoClient
from bson.objectid import ObjectId
import datetime
# link to db
dbClient = MongoClient('mongodb://localhost:27017')
db = dbClient['yangcong-prod25']
@diggzhang
diggzhang / vsPageWithQ.py
Created November 20, 2015 02:39
简单的生成几百个落地页加Q的方法
# -*- coding: utf-8 -*-
import sys
import os
import time
url_list = [
"http://vs.yangcong345.com/三角形的高.html",
"http://vs.yangcong345.com/三角形的高.html",
"http://vs.yangcong345.com/三角形的高.html",
]
@diggzhang
diggzhang / mongoshellextend.js
Created December 25, 2015 07:14
extend script of mongoshell
DBCollection.prototype.sample = function () {
return this.find();
}
DBCollection.prototype.onedoc = function (userId) {
return this.findOne({"_id": ObjectId(userId)});
}
DBCollection.prototype.pipeline = function (pipeline) {
return this.find(pipeline);
{
"eventKey": "showPhysicsBanner",
"category": "site",
"eventTime": Number, //unix timestamp in ms
"user": ObjectId,
"platform": ["web", "app"], //pc ~ web, ios||android ~ app
"platform2": ["PC", "android", "iOS"]
}
# _*_ coding:utf-8 _*_
# 1. 遍历httplogs, 读取到每一条doc
# 2. 根据doc的 url + method 判断该发那个埋点 传入到转发器
# 3. 转发器根据不同情况的埋点生成一个eventObj出来
# 4. save to db add one del one
from pymongo import MongoClient
import datetime
import time
import jwt
import IP