2018年日常小计汇总

2018年

2018-10-06开始记录

十二月

2018-12-27

解析nginx日志,实时了解服务器的情况(类似于top)
https://github.com/lebinh/ngxtop

Nginx 简易教程
https://www.cnblogs.com/jingmoxukong/p/5945200.html

一篇信息搜集的文章
https://mp.weixin.qq.com/s/XGdeoQKjOkUFpc6HV3IfGw

开灯看暗网(概念讲的挺透彻的)
https://mp.weixin.qq.com/s/SzzEWdh5gaCkRUTr1EKZiw

便捷的漏洞镜像管理部署Web应用
https://github.com/phantom0301/VulCloud

Kafka与RabbitMQ(文章不错)
https://mp.weixin.qq.com/s/r8L-Nz_457xdsww2DdlqJw

360线上移动性能检测平台
https://github.com/Qihoo360/ArgusAPM

2018-12-26

发现了个性价比很高的数据库,中小公司不用蛋疼于多种NoSQL的混合开发了:(Start 7k)

ArangoDB是一个原生的多模型数据库,具有文档,图形和键值的灵活数据模型
https://github.com/LessChina/arangodb

最新SSR:https://ssrss.space/register?aff=986229

最新FQ参考源码:(golang)
https://github.com/lotapp/firefly-proxy

更新维基hosts:C:\Windows\System32\drivers\etc

# https://zh.wikibooks.org/wiki/突破网络审查#修改hosts文件
198.35.26.96 zh.wikipedia.org #中文维基百科
198.35.26.96 zh.m.wikipedia.org #中文维基百科移动版
198.35.26.96 zh-yue.wikipedia.org #粤文维基百科
198.35.26.96 wuu.wikipedia.org #吴语维基百科
198.35.26.96 zh.wikinews.org #中文维基新闻
198.35.26.96 ja.wikipedia.org #日文维基百科
198.35.26.96 ja.m.wikipedia.org #日文维基百科移动版

2018-12-25

SkyWalking的NetCore版仪表盘
https://github.com/OpenSkywalking/skywalking-netcore

类似于EventBus的分布式事务解决方案
https://github.com/dotnetcore/CAP

JetBrains全家桶破解思路(最新更新:2018-12-24)
https://www.cnblogs.com/dotnetcrazy/p/9711763.html

最适合Net开发人员的MySQL``IDE
https://www.cnblogs.com/dotnetcrazy/p/10172959.html

DataGrip基础教程
https://blog.csdn.net/u013870094/article/details/79460787

DataGrip像navicat一样导入导出表数据
https://blog.csdn.net/erxiaoouba/article/details/79554724

2018-12-24

对SQL进行优化和改写的自动化工具(小米开源)
https://github.com/lotapp/soar

HBase替代方案:Pegasus(小米开源)
https://github.com/lotapp/pegasus

滴滴 Elasticsearch 多集群架构实践
https://www.infoq.cn/article/SbfS6uOcF_gW6FEpQlLK

2018 年最值得关注的 10 个机器学习开源项目
https://www.infoq.cn/article/8u2DZBVI*2pp7Y39l1ak

2018-12-23

【开源】Bug管理系统(PHP)
https://github.com/lotapp/masterlab

CMS内容管理系统(NodeJS)
https://github.com/lotapp/DoraCMS

阿里巴巴开源的LoT系统
https://github.com/lotapp/AliOS-Things

博客园文章管理编辑器客户端
https://gitee.com/lotapp/cnblogs

一款优雅的中国风Android App(包括Server端)

https://github.com/lotapp/jianshi
如何在一天之内完成一款Android产品
https://www.jianshu.com/p/cf496fc408b2

基于svg图片生成的图标字体
https://github.com/uiw-react/icons

2018-12-20

解释Referer信息泄露的一篇文章
https://mp.weixin.qq.com/s/xFmepVSfOKIh_L-6GaltcA

正则小工具(图形演示整个匹配过程)

在线演示:https://jex.im/regulex
https://github.com/lotapp/regulex

Java架构师知识图谱参考
https://github.com/lotapp/architect-awesome

极客时间-从零开始学架构(PDF+音频)
链接: https://pan.baidu.com/s/1Z18zinechCefigAFO5s0xA 提取码: b7c3

2018-12-19

如何让nginx修改Response HTTP Header中的server的值
https://blog.csdn.net/caoshiying/article/details/78114315

Node包管理工具

  1. Nvm:https://github.com/creationix/nvm
  2. Yarnhttps://yarnpkg.com/zh-Hans/

【推荐】Taro京东开源的多端统一框架小程序H5ReactNative
https://github.com/LessChina/taro

逆天点评:这个之前我有提到过

最近百度小程序也比较火,大有超越微信小程序的趋势,这款也支持百度小程序和支付宝小程序了

前端大一统早就是经常提的,Taro就是这一款开发框架(采用`React`语法标准,支持`JSX`和`TypeScript`)

最重要的是有个强大的后盾~`京东`,而且这款开源的确是京东为数不多的良心之作了,希望不要和360一样,各自开源胎死腹中......

相关链接:
https://taro.aotu.io
https://nervjs.github.io/taro
https://github.com/NervJS/awesome-taro
https://nervjs.github.io/taro/docs/README.html
https://juejin.im/book/5b73a131f265da28065fb1cd

https://nerv.aotu.io
https://nervjs.github.io/docs

京东前端团队:https://aotu.io
https://github.com/NervJS
https://github.com/o2team

小程序市场分析:https://baijiahao.baidu.com/s?id=1612578358728437062

2018-12-18

一步一步教你如何用Python做词云
https://www.cnblogs.com/ZaraNet/p/10136589.html

IdentityServer4

http://www.cnblogs.com/stulzq/p/8119928.html
https://www.cnblogs.com/FireworksEasyCool/category/1364487.html

Asp.net core WebApi 使用Swagger生成帮助页
https://www.cnblogs.com/suxinlcq/p/6757556.html

CSS系列——前端进阶之路:初涉Less
https://www.cnblogs.com/landeanfen/p/6047031.html

自己手动搭建SS优雅上网http://blog.51cto.com/13589319/2125370

国外服务端:
pip install shadowsocks

# `locale.Error: unsupported locale setting` 》》`export LC_ALL=C`

ssserver -c json配置文件 -d start

json配置文件内容:
{
"server":"0.0.0.0",
"server_port":8000,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"自定义密码",
"timeout":300,
"method":"aes-256-cfb"
}
---
Linux客户端使用`Shadowsocks-qt5`即可:
https://github.com/shadowsocks/shadowsocks-qt5/releases/download/v3.0.1/Shadowsocks-Qt5-3.0.1-x86_64.AppImage

sudo chomod +x Shadowsocks*

2018-12-17

图灵系列丛书203册
链接: https://pan.baidu.com/s/1-Ai-OXFyOU2D6IF9AjbSkg 密码: 6xk6

百度网盘客户端(Golang版本)
https://github.com/lotapp/BaiduPCS-Go
https://github.com/lotapp/baidupcs-web

PDF下载站

https://kgbook.com
http://www.pdfbook.cn

【推荐】牛津书虫-双语读物
链接:https://pan.baidu.com/s/1GA87KxEjk9ZhRqAQ_g67Fg 提取码:hs6n

【推荐】2018最新学而思小学奥数全套(49G)
链接:https://pan.baidu.com/s/1aRWXWrLDmcT1EP4djWD1Vw 提取码:ublz

2019初级会计
https://pan.baidu.com/s/1vwlbwooSlozsoeROAd-Fvw 提取码:u5ai

2018-12-16

NetCore招聘:
https://dotnet.microsoft.com/platform/customers

NetCore:人工智能聊天机器人框架

https://botsharp.readthedocs.io
https://github.com/dotnetcore/BotSharp

2018-12-15

【推荐】CUP基础库是百度开源的Python2基础库

https://github.com/lotapp/CUP
文档:https://cupdoc.iobusy.com
https://github.com/Baidu/CUP/wiki

Python 开发的守护进程
https://github.com/lotapp/supervisor

微信网页版 API 的 Go 实现
https://github.com/lotapp/wechat-go

Golang微信支付SDK
https://github.com/objcoding/wxpay

Facebook GraphQL 协议的 Go 语言版本
https://github.com/samsarahq/thunder

机器学习库
https://github.com/lotapp/awesome-machine-learning

JavaScript3D库three.js

Docs:https://threejs.org/docs/
Demo:https://threejs.org/examples/
https://github.com/mrdoob/three.js

200行实现的面部识别库
https://github.com/tehnokv/picojs

2018-12-14

微信小程序即时通讯
https://github.com/lotapp/wechat-im

神经网络与深度学习

https://nndl.github.io/
https://github.com/lotapp/nndl.github.io

ES6手册(在线:http://es6.ruanyifeng.com
https://github.com/lotapp/es6tutorial

webpack学习demo
https://github.com/lotapp/webpack-demos

react学习demo
https://github.com/lotapp/react-demos

易搭建的自助Git服务(Golang)
https://github.com/lotapp/gitea

Java 性能监控
https://github.com/LinShunKang/MyPerf4J

2018-12-13

SQL 速查表
https://github.com/lotapp/quick-SQL-cheatsheet

Chrome 插件开发完整教程
https://github.com/lotapp/chrome-plugin-demo

Leetcode 题解及经典算法实现,实现语言包含 Python、Java、C++、JS
https://github.com/lotapp/awesome-algorithm

centos7 mysql数据库安装和配置
https://www.cnblogs.com/starof/p/4680083.html

重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
https://www.cnblogs.com/gumuzi/p/5711495.html

爱奇艺解析(Python)
https://github.com/ZSAIm/iqiyi-parser

找回 Node.js 里面那些遗失的 ES6 特性
http://taobaofed.org/blog/2016/01/07/find-back-the-lost-es6-features-in-nodejs/

2018-12-12

Python词云图案

在线工具:http://yciyun.com/

一步一步教你如何用Python做词云
https://www.cnblogs.com/ZaraNet/p/10136589.html

利用Python爬取微博数据生成词云图片实例代码
https://www.jianshu.com/p/6b84a9631f8a

使用python实现个性化词云的方法
https://www.jb51.net/article/116346.htm

利用Python把图片生成词云
https://blog.csdn.net/qq_42156420/article/details/83058442

Python 分词及词云绘图
http://www.cnblogs.com/hzc2012/p/8277826.html

2018-12-09

jupyter notebook导出pdf并支持中文
https://www.jianshu.com/p/6b84a9631f8a

Linux下文件的三个时间(Atime,Mtime,Ctime)
http://www.cnblogs.com/MrListening/p/5793944.html

2018-12-05

Ubuntu解决dpkg returned an error code (1)

https://blog.csdn.net/qq_31617637/article/details/72881105
https://jingyan.baidu.com/article/647f0115d248ae7f2148a8a3.html

2018-12-02

Linux软件包中心
https://pkgs.org/

nmp包的CDN:
https://unpkg.com/

2018-12-01

知乎社区核心业务 Golang 化实践
https://zhuanlan.zhihu.com/p/48039838

Linux中安装Cisco Packet Tracer

https://linux.cn/article-5576-1.html
https://blog.csdn.net/qq_37935670/article/details/80479654
https://blog.csdn.net/qq_35882901/article/details/77652571

软件下载地址:
链接:http://pan.baidu.com/s/1dFeqLRb 密码:d40z
备用链接:https://pan.baidu.com/s/1akAzm4-WDm7wbifq_3n13g 提取码: dfw7

todo

十一月

2018-11-30

wxpy~微信常用模块
https://wxpy.readthedocs.io/zh/latest/

2018-11-29

Youtube上的软件开发视频集合
https://dev.tube/

动画演示算法
https://www.codelike.in/animation/binary-search-tree/

外国学习网站:
https://tutorialedge.net

使用WebAssembly和Go编写前端Web框架

https://github.com/lotapp/oak
http://www.cnblogs.com/baizx/p/9602581.html

Golang模块案例
https://github.com/go-modules-by-example/index

Github时间裤子
https://githubtimeline.xyz

X-Frame-Options: SAMEORIGIN的说明
https://www.cnblogs.com/trance/p/4645486.html

页面的返回头被设置 X-Frame-Options SAMEORIGIN ,只能被同源的iframe 引用。跨域名的iframe 没法显示了

2018-11-28

Linux工具大全:(使用文档)

https://linuxtools-rst.readthedocs.io/zh_CN/latest/index.html

《动手学深度学习》

PDF:
https://zh.gluon.ai/gluon_tutorials_zh.pdf

GitHub
https://github.com/lotapp/d2l-zh

在线阅读:
https://zh.gluon.ai/toc.html
https://zh.diveintodeeplearning.org

论坛:
https://discuss.gluon.ai

视频:
https://discuss.gluon.ai/t/topic/753
https://space.bilibili.com/209599371/channel/detail?cid=23541

2018-11-27

手势验证
https://www.vaptcha.com

Python高性能框架~Japronto(每秒处理 120 万次 HTTP 请求)
https://blog.csdn.net/sinat_38682860/article/details/72862220

2018-11-26

根据 JSON 文件快速生成 API 的 Web 服务端
https://github.com/lotapp/localroast

算法练习网站

https://oi-wiki.org
https://github.com/lotapp/OI-wiki

2018-11-25

老外数学讲解:
https://hadrienj.github.io/deep-learning-book-series-home

易经卦象的二维码生成器:(源码)
https://github.com/lotapp/Nodle-I-Ching

网页音频格式解码的 JS 库
https://github.com/lotapp/howler.js

基于TensorFlow.js的封装库:ml5js

https://github.com/lotapp/ml5-library
https://github.com/lotapp/ml5-examples

二维码生成原理:
https://www.nayuki.io/page/creating-a-qr-code-step-by-step

2018-11-24

React入门教程
http://huziketang.mangojuice.top/books/react/

开源网络钓鱼工具包
https://github.com/lotapp/gophish

JS敏感词过滤库
https://github.com/lotapp/fastscan

2018-11-14

Docker仓库-国内版
https://dev.aliyun.com/

编译:Babel将ES6转码为ES5
https://www.jianshu.com/p/8a8f7b0f887a

临时邮箱开源版https://mailsac.com
https://github.com/lotapp/mailsac
https://github.com/lotapp/forsaken-mail

2018-11-13

VsCode中使用Emmet神器快速编写HTML代码
http://www.cnblogs.com/summit7ca/p/6944215.html

IntelliJ IDEA 注册码

http://idea.lanyus.com
https://www.cnblogs.com/dotnetcrazy/p/9950762.html

开课吧Web全栈架构师二期
https://pan.baidu.com/s/1-KyqGZOR5O_BxTXR0z41BA 提取码:bj34

2018-11-12

文章

Go线程和Java线程的对比
https://www.infoq.cn/article/a-million-go-routines-but-only-1000-java-threads

为什么要使用GraphQL?

对于客户端而言,开箱即用的GraphQL API实现将具有比标准REST API更好的性能
https://honest.engineering/posts/why-use-graphql-good-and-bad-reasons

密码学演变-含Python代码
http://davidlowryduda.com/a-brief-notebook-on-cryptography

Nginx配置IPv6
https://bubblin.io/blog/ipv6-nginx

裤子

亚马逊所有IP地址
https://ip-ranges.amazonaws.com/ip-ranges.json

资源

新网盘搜索:https://www.aisouziyuan.com

前端面试题:http://scriptoj.mangojuice.top

gRPC Web:Web程序能够直接与后端gRPC服务通信(不需要HTTP服务器|替代REST的gRPC的Javascript库包)

https://www.npmjs.com/package/grpc-web
https://www.infoq.cn/article/2018%2F10%2Fpublished-gRPC-Web
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md

图解HTTPShttps://tls.ulfheim.net

初音未来音乐站点源码和演示:
https://github.com/lotapp/mikutap
http://github.lesschina.com/life/music/

TweenMax:高性能动画库
https://www.tweenmax.com.cn

又一免费CDN:https://css.loli.net

微软在线工具:将手绘草图转成HTML代码
https://sketch2code.azurewebsites.net

密码强度测试库(多语言支持):
https://github.com/dropbox/zxcvbn

将网页上的外联SVG图像,变为内嵌的SVG图像,从而使得全局的CSS样式文件可以对这个图像生效
https://github.com/iconfu/svg-inject

科幻风格React UI组件库
https://github.com/arwesjs/arwes

一本英文的纯数学教材,免费下载,从简单的自然数讲起,包括代数、数论、集合运算、概率和微积分等

https://infinitedescent.xyz
https://infinitedescent.xyz/dl/infdesc-a4.pdf

电子图书馆:http://m.ndlib.cn

【轻量级】基于Arch Linux的图形化系统:manjaro

家里的低配电脑可以走起了,最低内存500M左右
https://manjaro.org/get-manjaro

2018-11-07

小技巧:

  • 浏览器强制更新(不使用浏览器缓存):Ctrl+F5
  • 触摸屏使用心得:(未必通用)
    1. 鼠标右击:双指一起单击
    2. 鼠标滚轮:一指长按,一指起移动(上下)

Python模块导航:

  1. 官方:https://docs.python.org/3/library/index.html
  2. 其他:Python Module of the Week
    1. Py3:https://pymotw.com/3
    2. Py2:https://pymotw.com/2
  3. 解决方案:Python and NetCore

Python博客(外国):https://doughellmann.com/blog

Golang博客(基础):http://www.hellokang.net

Python爬虫系列:https://www.cnblogs.com/zhaof/category/1007686.html

2018-11-06

你可以用Python玩任何街机游戏
https://mp.weixin.qq.com/s/uSbb5hFvjY0VuizQd5gc_A

IIS部署python运行环境
https://www.cnblogs.com/shenh/p/8028081.html

从壹开始前后端分离(NETCore2.0 + Vue2.0 + AOP)
https://www.cnblogs.com/laozhang-is-phi/p/9495618.html


十月

2018-10-31

从最新时间可以看出,当Android开始收费时,Ubuntu Touch又有想法了
http://cdimage.ubuntu.com/ubuntu-touch/

ubports-installer:
https://ubuntu-touch.io/zh_CN/get-ut

Ubuntu-Touch支持列表:
https://wiki.ubuntu.com/Touch/Devices

小米ROM:
https://pan.baidu.com/s/1dEZDZbj

手机变PC:给魅族PRO 5刷Ubuntu Touch系统 | 给Ubuntu Touch安装桌面软件
https://www.ithome.com/html/android/345898.htm
https://www.ithome.com/html/android/346068.htm


手机论坛-小米专题:
https://forum.xda-developers.com/xiaomi

Linux下刷机参考:
http://www.miui.com/thread-6193481-1-1.html

sudo apt-get install android-tools-adb android-tools-fastboot

sudo sh flash_all.sh

在线便利贴:
https://trello.com

2018-10-28

资源

Linux公社FTP共享资源https://linux.linuxidc.com

开源堡垒机:https://github.com/jumpserver/jumpserver
文章介绍:https://www.linuxidc.com/Linux/2018-04/151673.htm

Tails Linux:https://tails.boum.org/install/download/index.en.html
文章介绍:https://linux.cn/article-5649-1.html

可汗学院:https://zh.khanacademy.org

文章

使用Python2脚本实现MySQL误操作的快速回滚
https://www.linuxidc.com/Linux/2018-05/152199.htm

#!/bin/env python
# -*- coding:utf-8 -*-

import os,sys,re,getopt
import MySQLdb

host = '127.0.0.1'
user = ''
password = ''
port = 3306
start_datetime = '1971-01-01 00:00:00'
stop_datetime = '2037-01-01 00:00:00'
start_position = '4'
stop_position = '18446744073709551615'
database = ''
mysqlbinlog_bin = 'mysqlbinlog -v'
binlog = ''
fileContent = ''
output='rollback.sql'
only_primary = 0

# ----------------------------------------------------------------------------------------
# 功能:获取参数,生成相应的binlog解析文件
# ----------------------------------------------------------------------------------------
def getopts_parse_binlog():
    global host
    global user
    global password
    global port
    global fileContent
    global output
    global binlog
    global start_datetime
    global stop_datetime
    global start_position
    global stop_position
    global database
    global only_primary
    try:
        options, args = getopt.getopt(sys.argv[1:], "f:o:h:u:p:P:d:", ["help","binlog=","output=","host=","user=","password=","port=","start-datetime=", \
                                                                      "stop-datetime=","start-position=","stop-position=","database=","only-primary="])
    except getopt.GetoptError:
        print "参数输入有误!!!!!"
        options = []
    if options == [] or options[0][0] in ("--help"):
        usage()
        sys.exit()
    print "正在获取参数....."
    for name, value in options:
        if name == "-f" or name == "--binlog":
            binlog = value
        if name == "-o" or name == "--output":
            output = value
        if name == "-h" or name == "--host":
            host = value
        if name == "-u" or name == "--user":
            user = value
        if name == "-p" or name == "--password":
            password = value
        if name == "-P" or name == "--port":
            port = value
        if name == "--start-datetime":
            start_datetime = value
        if name == "--stop-datetime":
            stop_datetime = value
        if name == "--start-position":
            start_position = value
        if name == "--stop-position":
            stop_position = value
        if name == "-d" or name == "--database":
            database = value
        if name == "--only-primary" :
            only_primary = value

    if binlog == '' :
        print "错误:请指定binlog文件名!"
        usage()
    if user == '' :
        print "错误:请指定用户名!"
        usage()
    if password == '' :
        print "错误:请指定密码!"
        usage()
    if database <> '' :
       condition_database = "--database=" + "'" + database + "'"
    else:
        condition_database = ''
    print "正在解析binlog....."
    fileContent=os.popen("%s %s  --base64-output=DECODE-ROWS --start-datetime='%s' --stop-datetime='%s' --start-position='%s' --stop-position='%s' %s\
                   |grep '###' -B 2|sed -e 's/### //g' -e 's/^INSERT/##INSERT/g' -e 's/^UPDATE/##UPDATE/g' -e 's/^DELETE/##DELETE/g' " \
                   %(mysqlbinlog_bin,binlog,start_datetime,stop_datetime,start_position,stop_position,condition_database)).read()
    #print fileContent

# ----------------------------------------------------------------------------------------
# 功能:初始化binlog里的所有表名和列名,用全局字典result_dict来储存每个表有哪些列
# ----------------------------------------------------------------------------------------
def init_col_name():
    global result_dict
    global pri_dict
    global fileContent
    result_dict = {}
    pri_dict = {}
    table_list = re.findall('`.*`\\.`.*`',fileContent)
    table_list = list(set(table_list))
    #table_list 为所有在这段binlog里出现过的表
    print "正在初始化列名....."
    for table in table_list:
        sname = table.split('.')[0].replace('`','')
        tname = table.split('.')[1].replace('`','')
        #连接数据库获取列和列id
        try:
            conn = MySQLdb.connect(host=host,user=user,passwd=password,port=int(port))
            cursor = conn.cursor()
            cursor.execute("select ordinal_position,column_name \
                                                       from information_schema.columns \
                                                       where table_schema='%s' and table_name='%s' " %(sname,tname))

            result=cursor.fetchall()
            if result == () :
                print 'Warning:'+sname+'.'+tname+'已删除'
                #sys.exit()
            result_dict[sname+'.'+tname]=result
            cursor.execute("select ordinal_position,column_name   \
                               from information_schema.columns \
                               where table_schema='%s' and table_name='%s' and column_key='PRI' " %(sname,tname))
            pri=cursor.fetchall()
            #print pri
            pri_dict[sname+'.'+tname]=pri
            cursor.close()
            conn.close()
        except MySQLdb.Error, e:
            try:
                print "Error %d:%s" % (e.args[0], e.args[1])
            except IndexError:
                print "MySQL Error:%s" % str(e)

            sys.exit()
    #print result_dict
    #print pri_dict

# ----------------------------------------------------------------------------------------
# 功能:拼凑回滚sql,逆序
# ----------------------------------------------------------------------------------------
def gen_rollback_sql():
    global only_primary
    fileOutput = open(output, 'w')
    #先将文件根据'--'分块,每块代表一个sql
    area_list=fileContent.split('--\n')
    #逆序读取分块
    print "正在开始拼凑sql....."
    for area in area_list[::-1]:
        #由于一条sql可能影响多行,每个sql又可以分成多个逐条执行的sql
        sql_list = area.split('##')
        #先将pos点和timestamp传入输出文件中
        for sql_head in sql_list[0].splitlines():
            sql_head = '#'+sql_head+'\n'
            fileOutput.write(sql_head)
        #逐条sql进行替换更新,逆序
        for sql in sql_list[::-1][0:-1]:
            try:
                if sql.split()[0] == 'INSERT':
                    rollback_sql = re.sub('^INSERT INTO', 'DELETE FROM', sql, 1)
                    rollback_sql = re.sub('SET\n', 'WHERE\n', rollback_sql, 1)
                    tablename_pos = 2
                    table_name = rollback_sql.split()[tablename_pos].replace('`', '')
                    # 获取该sql中的所有列
                    col_list = sorted(list(set(re.findall('@\d+', rollback_sql))))
                    # 因为第一个列前面没有逗号或者and,所以单独替换
                    rollback_sql = rollback_sql.replace('@1=', result_dict[table_name][0][1]+'=')
                    for col in col_list[1:]:
                        i = int(col[1:]) - 1
                        rollback_sql = rollback_sql.replace(col+'=', 'AND ' + result_dict[table_name][i][1]+'=',1)
                    # 如果only_primary开启且存在主键,where条件里就只列出主键字段
                    if int(only_primary) == 1 and pri_dict[table_name] <> ():
                        sub_where = ''
                        for primary in pri_dict[table_name]:
                            primary_name = primary[1]
                            for condition in rollback_sql.split('WHERE', 1)[1].splitlines():
                                if re.compile('^\s*'+primary_name).match(condition) or re.compile('^\s*AND\s*'+primary_name).match(condition):
                                    sub_where = sub_where + condition + '\n'
                        sub_where = re.sub('^\s*AND', '', sub_where, 1)
                        rollback_sql = rollback_sql.split('WHERE', 1)[0] + 'WHERE\n' + sub_where
                if sql.split()[0] == 'UPDATE':
                    rollback_sql = re.sub('SET\n', '#SET#\n', sql, 1)
                    rollback_sql = re.sub('WHERE\n', 'SET\n', rollback_sql, 1)
                    rollback_sql = re.sub('#SET#\n', 'WHERE\n', rollback_sql, 1)
                    tablename_pos = 1
                    table_name = rollback_sql.split()[tablename_pos].replace('`', '')
                    # 获取该sql中的所有列
                    col_list = sorted(list(set(re.findall('@\d+', rollback_sql))))
                    # 因为第一个列前面没有逗号或者and,所以单独替换
                    rollback_sql = rollback_sql.replace('@1=', result_dict[table_name][0][1] + '=')
                    for col in col_list[1:]:
                        i = int(col[1:]) - 1
                        rollback_sql = rollback_sql.replace(col+'=', ',' + result_dict[table_name][i][1]+'=', 1).replace(col+'=','AND ' +result_dict[table_name][i][1]+'=')
                    # 如果only_primary开启且存在主键,where条件里就只列出主键字段
                    if int(only_primary) == 1 and pri_dict[table_name] <> ():
                        sub_where = ''
                        for primary in pri_dict[table_name]:
                            primary_name = primary[1]
                            for condition in rollback_sql.split('WHERE', 1)[1].splitlines():
                                if re.compile('^\s*' + primary_name).match(condition) or re.compile('^\s*AND\s*'+primary_name).match(condition):
                                    sub_where = sub_where + condition + '\n'
                        sub_where = re.sub('^\s*AND', '', sub_where, 1)
                        rollback_sql = rollback_sql.split('WHERE', 1)[0] + 'WHERE\n' + sub_where

                if sql.split()[0] == 'DELETE':
                    rollback_sql = re.sub('^DELETE FROM', 'INSERT INTO', sql, 1)
                    rollback_sql = re.sub('WHERE\n', 'SET\n', rollback_sql, 1)
                    tablename_pos = 2
                    table_name = rollback_sql.split()[tablename_pos].replace('`', '')
                    # 获取该sql中的所有列
                    col_list = sorted(list(set(re.findall('@\d+', rollback_sql))))
                    # 因为第一个列前面没有逗号或者and,所以单独替换
                    rollback_sql = rollback_sql.replace('@1=', result_dict[table_name][0][1] + '=')
                    for col in col_list[1:]:
                        i = int(col[1:]) - 1
                        rollback_sql = rollback_sql.replace(col+'=', ',' + result_dict[table_name][i][1]+'=',1)

                rollback_sql = re.sub('\n$',';\n',rollback_sql)
                #print rollback_sql
                fileOutput.write(rollback_sql)
            except IndexError,e:
                print "Error:%s" % str(e)
                sys.exit()
    print "done!"

def usage():
    help_info="""==========================================================================================
Command line options :
    --help                  # OUT : print help info
    -f, --binlog            # IN  : binlog file. (required)
    -o, --outfile           # OUT : output rollback sql file. (default 'rollback.sql')
    -h, --host              # IN  : host. (default '127.0.0.1')
    -u, --user              # IN  : user. (required)
    -p, --password          # IN  : password. (required)
    -P, --port              # IN  : port. (default 3306)
    --start-datetime        # IN  : start datetime. (default '1970-01-01 00:00:00')
    --stop-datetime         # IN  : stop datetime. default '2070-01-01 00:00:00'
    --start-position        # IN  : start position. (default '4')
    --stop-position         # IN  : stop position. (default '18446744073709551615')
    -d, --database          # IN  : List entries for just this database (No default value).
    --only-primary          # IN  : Only list primary key in where condition (default 0)

Sample :
   shell> python binlog_rollback.py -f 'mysql-bin.000001' -o '/tmp/rollback.sql' -h 192.168.0.1 -u 'user' -p 'pwd' -P 3307 -d dbname
=========================================================================================="""

    print help_info
    sys.exit()

if __name__ == '__main__':
    getopts_parse_binlog()
    init_col_name()
    gen_rollback_sql()

Linux终端复用神器-Tmux使用梳理
https://www.cnblogs.com/kevingrace/p/6496899.html

把Ubuntu 18.04改造成Windows主题界面
https://www.linuxidc.com/Linux/2018-09/153973.htm

CentOS 7.3编译安装Nginx 1.12.2
https://www.linuxidc.com/Linux/2018-09/154437.htm

用Prometheus细化Nginx监控
http://blog.51cto.com/xujpxm/2080146

Debian 9.2安装Zabbix 3.4.2
https://www.linuxidc.com/Linux/2018-03/151338.htm

Ubuntu 16.04下JDK+Hadoop+Spark环境搭建
https://www.linuxidc.com/Linux/2018-05/152564.htm

Vagrant创建Jenkins构建环境|用VagrantAnsible搭建持续交付平台
https://www.cnblogs.com/davenkin/p/vagrant-jenkins-master-slave.html

OpenStack Ironic实现裸机部署
https://blog.csdn.net/u010281209/article/details/81611707

CentOS 7下部署.NET Core2.0+Nginx+Supervisor+MySQL环境
https://www.linuxidc.com/Linux/2018-04/151794.htm

Java事务系列
https://www.cnblogs.com/davenkin/tag/事务/

2018-10-24

盘多多:
http://www.panduoduo.net
http://pdd.19mi.net/go/数字编号

新网盘搜索:https://pan.09l.me

个人博客

Python

https://www.dataivy.cn

NetCore

https://www.cnblogs.com/jiekzou

运维

https://www.howtoing.com

站桩

http://blog.sina.cn/dpool/blog/ab4008zhanghua

图书影音

http://mebook.cc

http://orzbook.com

http://www.shuwu.mobi

http://hotbaidu.com

http://www.java51.com

http://www.jiuaijsj.com

http://www.jqhtml.com/down

http://www.jiuaijsj.com/books

博客PDF:
http://www.lanqibing.com
https://www.cnblogs.com/mebook
http://blog.sina.com.cn/s/articlelist_5163237871_0_1.html

杂项搜索:http://www.xwood.net

在线转换

在线Azw3转PDF(中文识别能力欠佳)

http://www.alltoall.net/azw3_pdf

https://cloudconvert.com/azw3-to-pdf

在线Epub转PDF(中文识别能力欠佳)

https://convertio.co/zh/epub-pdf

https://cloudconvert.com/epub-to-pdf

https://www.ofoct.com/ebooktool/zh/epub-to-pdf

推荐:https://www.aconvert.com/cn/pdf

2018-10-22

面试题:

https://www.nowcoder.com
https://www.jiuzhang.com
https://leetcode.com
https://leetcode-cn.com
https://www.cnblogs.com/grandyang/p/4606334.html

树莓派搭建NAS
https://opensource.com/article/18/7/network-attached-storage-Raspberry-Pi

2018-10-15

书籍

Python Cookbook 3:
https://python3-cookbook.readthedocs.io/zh_CN/latest/index.html

Twisted:https://likebeta.gitbooks.io/twisted-intro-cn/content/zh

Python核心编程:https://wizardforcel.gitbooks.io/core-python-2e/content

Python编程风格:
https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/contents

工具

百度免登录下载:https://www.speedpan.com

谷歌助手:http://googlehelper.net

2018-10-10

免费SSL:https://zerossl.com

临时文件:https://cp.ifval.com

谷歌插件:https://chrome-extension-downloader.com

知识产权查询:https://www.qccip.com

影视在线:http://www.dybee.co

台湾影音:https://www.chocotv.com.tw

英语语法纠正:
https://www.gingersoftware.com/grammarcheck
https://www.nounplus.net/grammarcheck/cn
https://virtualwritingtutor.com
http://www.hemingwayapp.com
插件1:https://www.gingersoftware.com
插件2:https://www.grammarly.com

AI人工智能图片放大:https://bigjpg.com

视频下载:https://video-get.com/
人体浏览器:https://www.zygotebody.com

设计师素材:
https://pngtree.com
http://www.sucaidao.com

新加坡设计:http://webneel.com

新加坡资讯:https://www.toggle.sg/zh

新加坡房产:https://www.propertyguru.com.sg


2018-10-08

源码参考

自托管的一次性邮件服务
https://github.com/lotapp/forsaken-mail
临时邮箱Demo:http://forsaken.somecolor.cc:3000/

PicGo - 免费开源的图片上传与管理工具
https://github.com/Molunerfinn/PicGo

工具小记

云展网 - 将 PDF 文档转换成在线 3D 翻页画册
https://www.yunzhan365.com
【用户名和密码:netcore@maildu.de】
http://www.yunzhan365.com/login.php?i=mkqsmG
电子书:https://www.yunzhan365.com/explore/

坚果云 - 跨平台文件同步网盘
https://www.jianguoyun.com/s/downloads

免费网盘:https://www.multcloud.com

百度网盘:https://www.leiyun.org

EverSync - 免费跨浏览器书签收藏夹同步/备份工具
https://www.everhelper.me

蒲公英 – 让在异地的两台电脑组成局域网
https://pgy.oray.com

IP盒子(提供公网地址)
https://www.ipv4.me/

上海大学开源镜像站
https://mirrors.shu.edu.cn

在PC搭建OpenWRT软路由
https://www.cnblogs.com/loveyan1314/p/7820222.html


2018-10-06

Python相关的Github:
https://github.com/Python3WebSpider
https://github.com/chenjiandongx/awesome-asyncio-cn

Python相关的博客:
http://chenjiandongx.com
https://zhu327.github.io/post
论坛:https://pythontab.com

TCP协议参考:
https://www.cnblogs.com/wcd144140/category/1313090.html

MySQL性能测试工具mysqlslap:
https://www.cnblogs.com/fjping0606/p/5853325.html

posted @ 2019-01-13 12:12  鲲逸鹏  阅读(1254)  评论(0编辑  收藏  举报