Skip to content

Instantly share code, notes, and snippets.

View ronfe's full-sized avatar

JI Hongfei ronfe

  • Guanghe.tv
  • Beijing, China
View GitHub Profile
from pymongo import MongoClient
import datetime
topics = MongoClient('10.8.8.111:27017')['onions35']['topics']
users = MongoClient('10.8.8.111:27017')['onions']['users']
finish_state = MongoClient('10.8.8.111:27017')['ronfedb']['finishStateNew']
finish_state.drop()
DATE_DEFAULT_HOLD = datetime.datetime(2016,5,5,1)
DATE_INIT = datetime.datetime(1970,1,1)
# _*_ coding:utf-8 _*_
from pymongo import MongoClient
from bson.objectid import ObjectId
import subprocess
import jwt
'''
This script aims to generate finishPractice log from daily
dumped httplogs
@ronfe
ronfe / 1a.py
Last active May 10, 2016 10:35
# -*- coding: utf-8 -*-
"""
Created on Fri May 6 11:01:25 2016
@author: xinruyue
"""
from pymongo import MongoClient
db = MongoClient("10.8.8.111:27017")["eventsV35"]
events = db['eventV35']
var practiceFinishSchema = new Schema({
"user": ObjectId,
"eventTime": Number, // time of finish practice
"serverTime": ISODate, // time of finish practice
"topic": String,
"type": String(enum: ["A", "B", "C", "D", "E", "S"]),
"finishState": String(enum: ["perfect", "imperfect"]),
"duration": Number, //the duration from start practice to finish
"practiceLog": [ // not contained in first version
{"level": String, "problemId": ObjectId, "duration": Number, "correctness": Boolean}
@ronfe
ronfe / step1.py
Created April 26, 2016 05:28
r-yaqi-courseuser
# _*_ coding:utf-8 _*_
from pymongo import MongoClient
db = MongoClient('10.8.8.111:27017')['onions-cb']
chapters = db['chapters']
x = chapters.find({"publisher": "北师大版", "semester": "七年级下", "status": "published"})
topic_list = []
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
//退款原因、拒绝续费、拒绝退费(逍遥Part)
{
userId: {type: ObjectId, required: true},
tag: {type: String, enum: ["refund", "noPay", "noRenew"]}, //refund = 退款问卷, noPay = 拒绝付费问卷, noRenew = 拒绝续费问卷
publisher: {type: String},
semester: {type: String},
body: {
"anotherString": {
"qq": String
backSchema = new Schema({
"eventKey": {type: String, required: true},
"eventValue": {type: Mixed},
"ua": String,
"url": String, //only for pc, the full url
"category": "onionsBackend", // to string
"platform": "backend", //Required
"ip": String,
"location": {type: Mixed},
"user": ObjectId, //Required when user logged in, its user id
event35Schema = new Schema({
"eventKey": {type: String, required: true},
"eventValue": {type: Mixed},
"device": String, //Required, unique id for pc, imei for android, idfa for ios
"deviceOld": String,
"deviceAttr": {
"os": {
"name": {type: String}, //Required, operating system name macos/linux/win for pc, android/ios/win for mobile
"version": String //Conditional optional, os version code
},
{
"code": 101,
"name": "Student Home PC",
"block": 1,
"platform": "web",
"prevPoint": "enterHome",
"property": {
"sampleExerciseChosen": "",
"sampleExerciseChecked": false
"iosAppTrayExtended": false,