nginx 禁止ip访问

继上次jenkins漏洞后小博客最近又被搞了 各种链接超时 状态504 登录服务器 top 查看 进程正常 ps  -aux | grep php-fpm  查看进程数正常 netstat -tunlpa | grep 9000 发现大量链接阻塞 查看nginx error.log 大量504 追踪 nginx access.log 发现有个ip不停POST某链接 cat /var/log/nginx/access.log| jq ".clientip" |sed 's/\"//g' | sort | uniq  -c  |  sort -n -r  查找有问题的ip 打开nginx配置 server 增加deny ip 重启nginx 网站能正常访问  查看日志问题ip访问返回状态403

mysql 批量建表 存储过程

delimiter // CREATE procedure create_table() BEGIN DECLARE `@i` int(11); DECLARE `@sqlstr` varchar(65000); SET `@i`=0; WHILE `@i` < 256 DO SET @sqlstr = CONCAT( "CREATE TABLE box_item_pool_", `@i`, "( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `_unique` varchar(64) NOT NULL DEFAULT '' COMMENT '分表后唯一标示', `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID', `box_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '盒子ID', `prod_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID, 目前是product_master.id', `prod_code` varchar(32) NOT NULL DEFAULT '' COMMENT '商品CODE, 目前是product_master.code', `product_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'product.id', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, `deleted_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `_unique` (`_unique`) USING BTREE, KEY `user_box` (`user_id`,`box_id`), KEY `box` (`box_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" ); prepare stmt from @sqlstr; execute stmt; SET `@i` = `@i` + 1; END WHILE; END; call create_table(); drop procedure create_table; //

ibatis java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timest

java.sql.SQLException:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp 原因:因为数据库里面存储了这样子的值,所以查询的时候报错了 解决方案:在url路径哪里加上一句话 jdbc.url=jdbc:mysql://ip地址\:端口号/数据库名称?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull

python 两个list 求交集,并集,差集

在python中,数组可以用list来表示。如果有两个数组,分别要求交集,并集与差集,怎么实现比较方便呢? 当然最容易想到的是对两个数组做循环,即写两个for循环来实现。这种写法大部分同学应该都会,而且也没有太多的技术含量, [python] #!/usr/bin/env python #coding:utf-8 def diff(listA,listB): #求交集的两种方式 retA = [i for i in listA if i in listB] retB = list(set(listA).intersection(set(listB))) print "retA is: ",retA print "retB is: ",retB #求并集 retC = list(set(listA).union(set(listB))) print "retC1 is: ",retC #求差集,在B中但不在A中 retD = list(set(listB).difference(set(listA))) print "retD is: ",retD retE = [i for i in listB if i not in listA] print "retE is: ",retE def main(): listA = [1,2,3,4,5] listB = [3,4,5,6,7] diff(listA,listB) if __name__ == '__main__': main() [/python] retA is: [3, 4, 5] retB is: [3, 4, 5] retC1 is: [1, 2, 3, 4, 5, 6, 7] retD is: [6, 7] retE is: [6, 7] 转自 http://blog.csdn.net/bitcarmanlee/article/details/51622263 结合代码来看,大体上是两种思路: 1.使用列表解析式。列表解析式一般来说比循环更快,而且更pythonic显得更牛逼。 2.将list转成set以后,使用set的各种方法去处理。

mysql Incorrect datetime value

从本地 迁移数据库到测试服 发现sql报错 MySQL []> INSERT INTO `table` VALUES (1, 1, 1, 1, 0, 0, 0, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2017-08-31 11:41:22', '2017-08-31 11:41:26', 0); ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00' for column 'rental_days_at' at row 1 MySQL [nparis]> select @@sql_mode; +-------------------------------------------------------------------------------------------------------------------------------------------+ | @@sql_mode | +-------------------------------------------------------------------------------------------------------------------------------------------+ | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +-------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.41 sec) MySQL []> set @@sql_mode='no_engine_substitution'; Query OK, 0 rows affected, 1 warning (0.07 sec) MySQL []> INSERT INTO `table` VALUES (1, 1, 1, 1, 0, 0, 0, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2017-08-31 11:41:22', '2017-08-31 11:41:26', 0); Query OK, 1 row affected (0.56 sec) 出自 https://dba.stackexchange.com/questions/48704/mysql-5-6-datetime-incorrect-datetime-value-2013-08-25t1700000000-with-er