This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DB_HOST="10.8.2.97" && \ | |
DB_NAME_EVENTS="eventsV4" && \ | |
DB_COLLECITON_NAME="eventV4" && \ | |
YEAR=$(date -d -1day '+%Y') && \ | |
MONTH=$(date -d -1day '+%m') && \ | |
DAY=$(date -d -1day '+%d') && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
timestamp_list = [ | |
1486137597659, | |
1486137597659 | |
] | |
for timestamp in timestamp_list: | |
print(datetime.fromtimestamp(timestamp/1000)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import pymongo | |
from pymongo import MongoClient | |
from datetime import datetime | |
import datetime | |
import json | |
from StringIO import StringIO | |
import time | |
from datetime import date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _*_ 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'] | |
# 指定时间范围 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object FileMatcher { | |
private def fileHere = (new java.ui.File(".")).listFiles | |
def filesMatching( | |
matcher: (String) => Boolean) = { | |
for(file <- filesHere; if matcher(file.getName)) | |
yield file | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _*_ coding:utf-8 _*_ | |
""" | |
该脚本用户修改表每日更新备份状态 | |
""" | |
from pymongo import MongoClient | |
import sys | |
import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _*_ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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 | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _*_ 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 |