Skip to content

Instantly share code, notes, and snippets.

View diggzhang's full-sized avatar
🎯
Focusing

digz diggzhang

🎯
Focusing
View GitHub Profile
@diggzhang
diggzhang / userid_address_cache.py
Last active April 28, 2016 03:23
用户地址位置信息脚本
# _*_ coding:utf-8 _*_
"""
s0. dump fully event collection by getProfile 得出所有登录过的注册用户的埋点
s1. run this programm
"""
from pymongo import MongoClient
from bson.objectid import ObjectId
@diggzhang
diggzhang / config.csv
Created May 2, 2016 02:46
线上版本config
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 10 columns, instead of 9 in line 2.
/signup$,POST,,signupSuccess,,channel,from,,_id,type
/signup/qq,POST,,signupSuccess,,channel,from,,_id,type
/login$,POST,,loginSuccess,,,,_id,type
/login/qq,POST,,loginSuccess,,,,_id,type
/bind/qq,PUT,,bindQQSuccess,,,,_id
/unbind/qq,PUT,,unbindQQSuccess,,,,
/logout,POST,,logoutSuccess,,,,
/user/password$,PUT,,modifyPassword,,,,_id
/me$,PUT,,updateProfile,,**,,
/me$,GET,,getProfile,,,,_id,allowed,partialOpen
# _*_ coding:utf-8 _*_
import re
from pymongo import MongoClient
from bson.objectid import ObjectId
import time
import datetime
from pyqqwry.qqwry import QQWry
qq_wry = QQWry("./qqwry.dat")
@diggzhang
diggzhang / vistor_user.py
Created May 9, 2016 02:25
区分注册用户与体验用户表
# _*_ coding:utf-8 _*_
import re
from pymongo import MongoClient
from bson.objectid import ObjectId
import jwt
import time
import datetime
# TODO: change mongo env as online configure
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os, urllib2, sys
import datetime
import random
import subprocess
import smtplib
from email.mime.text import MIMEText
@diggzhang
diggzhang / myPromise.js
Created June 23, 2016 10:08
一个promise的request
"use strict";
import mongoose from 'mongoose';
const EventAuto = mongoose.model('EventAuto');
const autoEventsProxy = "http://localhost:8080/v3_6/autoevents/";
const request = require('request').defaults({
json: true
});
# _*_ coding:utf-8 _*_
"""
该脚本的gist地址 https://gist.github.com/diggzhang/480bf81101173525cc55926e990f8858
关联脚本1: cronjob 备份 https://gist.github.com/diggzhang/cc0326d54bb592a0b2d7d7170fb94a17
在跑这个脚本前最好建立索引
db.httplogs.ensureIndex({
"url": 1,
"method": 1,
"status": 1
# _*_ coding:utf-8 _*_
"""
该脚本用户修改表每日更新备份状态
"""
from pymongo import MongoClient
import sys
import datetime
@diggzhang
diggzhang / FileMatcher.scala
Last active September 28, 2016 06:50
实验楼scala公开课temp code
object FileMatcher {
private def fileHere = (new java.ui.File(".")).listFiles
def filesMatching(
matcher: (String) => Boolean) = {
for(file <- filesHere; if matcher(file.getName))
yield file
}
@diggzhang
diggzhang / find_duplicate_uuid.py
Created December 5, 2016 02:20
查找重复的uuid,找出重发的埋点。
# _*_ coding:utf-8 _*_
from __future__ import print_function
from pymongo import MongoClient
import datetime
import time
db = MongoClient('10.8.8.111', 27017)['eventsV4']
events = db['eventV4']
# 指定时间范围