linux学习lesson51

三款开箱即用的Web端开源ER图工具实战对比 ER图(实体关系图)是数据库设计的基础可视化表达,其核心在于准确刻画表结构、主外键约束与业务语义关联。原理上依赖关系代数与概念建模理论,技术价值体现在降低沟通成本、保障设计一致性、支撑正向/逆向工程。典型应用场景包括课程设计、团队协作评审、国产数据库适配及等保合规文档生成。面对部署复杂、导出失真、协作缺失等痛点,QuickDBD、SQLDBM和DbSchema三款纯Web端开源工具脱颖而出——它们支持主流数据库连接、提供SVG/PDF/DDL等多格式交付,并分别聚焦极简绘图、Git式协同与国产化深度适配,真 阅读详情



1 nginx防盗链

配置如下,可以和上面的配置结合起来

编辑配置文件:

[root@linux01 ~]# vim /usr/local/nginx/conf/vhost/test.com.conf
server
{
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root /data/wwwroot/test.com;
}
location ~* ^.+\.
(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$ // *表示后面()里的内容不区分大小写
{
expires 7d;
valid_referers none blocked server_names *.test.com ;
if ($invalid_referer) { //否定不是test.com
return 403;
}
access_log off;
}

重新加载配置文件:

[root@linux01 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linux01 ~]# /usr/local/nginx/sbin/nginx -s reload

curl 测试:(定义referer为www.baidu.com)

[root@linux01 ~]# curl -e "http://www.baidu.com" -x127.0.0.1:80 test.com/1.png -I
HTTP/1.1 403 Forbidden
Server: nginx/1.15.5
Date: Sat, 24 Nov 2018 10:29:29 GMT
Content-Type: text/html
Content-Length: 153
Connection: keep-alive

状态码返回403,访问受限

curl 测试:(定义referer为www.test.com)

[root@linux01 ~]# curl -e "http://www.test.com" -x127.0.0.1:80 test.com/1.png -I
HTTP/1.1 200 OK
Server: nginx/1.15.5
Date: Sat, 24 Nov 2018 10:29:36 GMT
Content-Type: image/png
Content-Length: 211090
Last-Modified: Sat, 24 Nov 2018 10:16:52 GMT
Connection: keep-alive
ETag: "5bf92514-33892"
Expires: Sat, 01 Dec 2018 10:29:36 GMT
Cache-Control: max-age=604800
Accept-Ranges: bytes

状态码返回200,访问成功


2 nginx访问控制

需求:访问/admin/目录的请求,只允许某几个IP访问,配置如下:
编辑配置文件:

server
{
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root /data/wwwroot/test.com;
location /admin/
{
allow 192.168.133.112; //只要匹配其中一条就停止了,与Apache的不一样
allow 127.0.0.1;
deny all;
}
}

重新加载配置文件:

[root@linux01 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linux01 ~]# /usr/local/nginx/sbin/nginx -s reload

创建目录:

[root@linux01 ~]# mkdir /data/wwwroot/test.com/admin/
[root@linux01 ~]# echo “test,test”>/data/wwwroot/test.com/admin/1.html

curl测试:(指定192.168.139.111访问)

[root@linux01 ~]# curl -x192.168.139.111:80 test.com/admin/1.php -I
HTTP/1.1 403 Forbidden
Server: nginx/1.15.5
Date: Sat, 24 Nov 2018 10:43:31 GMT
Content-Type: text/html
Content-Length: 153
Connection: keep-alive

状态码返回403,访问成功

curl测试:(指定127.0.0.1访问)

[root@linux01 ~]# curl -x127.0.0.1:80 test.com/admin/1.php -I
HTTP/1.1 200 OK
Server: nginx/1.15.5
Date: Sat, 24 Nov 2018 10:44:11 GMT
Content-Type: application/octet-stream
Content-Length: 21
Last-Modified: Sat, 24 Nov 2018 10:36:21 GMT
Connection: keep-alive
ETag: "5bf929a5-15"
Accept-Ranges: bytes

状态码返回200,访问成功

需求:防止图片目录解析php,否则容易被人值木马
可以匹配正则
编辑配置文件:

server
{
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root /data/wwwroot/test.com;
location ~ .*(upload|image)/.*\.php$
{
deny all;
}
}

重新加载配置:

[root@linux01 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linux01 ~]# /usr/local/nginx/sbin/nginx -s reload

创建目录和文件:

[root@linux01 test.com]# mkdir upload
[root@linux01 test.com]# vim upload/1.php
<?php
echo 123;
?>
[root@linux01 test.com]# vim upload/1.txt
hello

curl测试:

[root@linux01 ~]# curl -x127.0.0.1:80 test.com/upload/1.php
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.15.5</center>
</body>
</html>

状态码返回403,访问受限

[root@linux01 ~]# curl -x127.0.0.1:80 test.com/upload/1.txt
hello

成功访问

根据user_agent限制

编辑配置文件:

[root@linux01 ~]# vim /usr/local/nginx/conf/vhost/test.com.conf
server
{
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root /data/wwwroot/test.com;
if ($http_user_agent ~ 'Spider/3.0|YoudaoBot|Tomato') //禁止Spider/3.0,YoudaoBot,Tomato访问
{
return 403;
}
}

重新加载配置文件:

[root@linux01 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linux01 ~]# /usr/local/nginx/sbin/nginx -s reload

curl测试:(-A指定Tomato访问)

[root@linux01 ~]# curl -A "Tomato" -x127.0.0.1:80 test.com/1.png -I
HTTP/1.1 403 Forbidden
Server: nginx/1.15.5
Date: Sat, 24 Nov 2018 10:59:40 GMT
Content-Type: text/html
Content-Length: 153
Connection: keep-alive

状态码返回403,访问受限

[root@linux01 ~]# curl -A "baidu" -x127.0.0.1:80 test.com/1.png -I
HTTP/1.1 200 OK
Server: nginx/1.15.5
Date: Sat, 24 Nov 2018 11:01:18 GMT
Content-Type: image/png
Content-Length: 211090
Last-Modified: Sat, 24 Nov 2018 10:16:52 GMT
Connection: keep-alive
ETag: "5bf92514-33892"
Expires: Sat, 01 Dec 2018 11:01:18 GMT
Cache-Control: max-age=604800
Accept-Ranges: bytes

状态码返回200,成功访问


3 nginx解析php相关配置

修改配置文件:

[root@linux01 ~]# vim /usr/local/nginx/conf/vhost/test.com.conf
server
{
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root /data/wwwroot/test.com;
location ~ \.php$
{
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock; //如果修改了,跟配置文件不一致,会报502
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/data/wwwroot/test.com$fastcgi_script_name;
}
}

没有加载配置文件curl测试:

[root@linux01 ~]# curl -x127.0.0.1:80 test.com/1.php
<?php
echo  "hello";
?>

重新加载配置文件:

[root@linux01 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linux01 ~]# /usr/local/nginx/sbin/nginx -s reload

curl测试:

[root@linux01 ~]# curl -x127.0.0.1:80 test.com/1.php
hello

fastcgi_pass 用来指定php-fpm监听的地址或者socket

遇到访问502

查看logs日志和配置文件是否有误

查看php-fpm.conf和conf/vhost/test.com.conf的配置文件php的sock路径是否一致

查看cat /usr/local/php-fpm/etc/php-fpm.conf
listen = /tmp/php-fcgi.sock

查看cat /usr/local/nginx/conf/vhost/test.com.conf
fastcgi_pass unix:/tmp/php-cgi.sock;

查看nginx_errors_log日志信息
php和nginx的listen = /tmp/php-fcgi.sock是否一致

还有一种可能就是php服务资源耗尽了

4 nginx代理

修改配置文件:

[root@linux01 ~]# cd /usr/local/nginx/conf/vhost
[root@linux01 vhost]# vim proxy.conf //加入如下内容
server
{
listen 80;
server_name www.baidu.com; //访问的web域名

location /
{
proxy_pass http://163.177.151.110/; //需要访问服务器的ip
proxy_set_header Host $host; //$host表示的是server_name
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

获取百度的ip:(yum install -y bind-utils)

[root@linux01 ~]# dig www.baidu.com

; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7_5.1 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59086
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com.            IN    A

;; ANSWER SECTION:
www.baidu.com.        837    IN    CNAME    www.a.shifen.com.
www.a.shifen.com.    127    IN    A    163.177.151.110
www.a.shifen.com.    127    IN    A    163.177.151.109

;; Query time: 13 msec
;; SERVER: 119.29.29.29#53(119.29.29.29)
;; WHEN: Sat Nov 24 23:40:01 CST 2018
;; MSG SIZE  rcvd: 101

重新加载配置文件:

[root@linux01 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linux01 ~]# /usr/local/nginx/sbin/nginx -s reload

curl测试:
直接访问百度:

[root@linux01 ~]# curl  www.baidu.com/robots.txt
User-agent: Baiduspider
Disallow: /baidu
Disallow: /s?
Disallow: /ulink?
Disallow: /link?
Disallow: /home/news/data/
以下略...

通过本机代理访问百度:

[root@linux01 ~]# curl -x127.0.0.1:80  www.baidu.com/robots.txt
User-agent: Baiduspider
Disallow: /baidu
Disallow: /s?
Disallow: /ulink?
Disallow: /link?
Disallow: /home/news/data/
以下略...

代理成功


扩展
502问题汇总 http://ask.apelearn.com/question/9109
location优先级 http://blog.lishiming.net/?p=100

从时序博弈到数据稳定:CS1237驱动中的信号滤波与卡尔曼实践 本文探讨了CS1237高精度ADC驱动在复杂工业环境中的信号处理挑战,重点介绍了一阶滤波与自适应卡尔曼滤波算法的实践应用。通过参数优化和动态调整策略,有效提升了数据稳定性和抗干扰能力,为嵌入式系统在噪声环境下的精密测量提供了可靠解决方案。 阅读详情

相关推荐

企业网络改造必看:如何用华为S5700三层交换机解决多部门隔离通信?

本文详细介绍了如何利用华为S5700三层交换机解决企业多部门网络隔离与通信需求。通过划分VLAN实现逻辑隔离,并配置三层路由实现受控互通,结合ACL进行精细访问控制,构建安全高效的企业网络。文章提供了从拓扑规划、地址分配到核心配置的完整实战指南。

weixin_29260291的博客 261

CentOS7入门:常用的网络操作命令

参考视频:https://edu.51cto.com//center/course/lesson/index?id=94966

kingshown_WZ的专栏 1748

TK抓包协议分析:So层逆向

第三个参数是一个回调函数,这里他的返回值1表示成功,0表示失败,那我们手动把他Hook为0,让他不支持quic协议,实现降级。等,我们是为了解决抓包问题,那很有可能是在net目录下(network),那来搜索一下。开了抓包以后APP直接是网络无连接了,并且抓到的请求也是不正常的,下面我们就开始定位。看了半天感觉也没啥有用的东西,那下面我们整理一下已经有信息,来猜测一下,后续怎么进行。那可以猜测,我们真正需要Hook的那个函数也有可能是这样加载的,可以字符串搜索一下。

2503_90751938的博客 3417

Linux学习lesson1

目录 1 学习之初 2 约定 3 认识linux 4 安装虚拟机 5 安装centos7 1 学习之初 预习和复习的重要性 当日事当日毕 记笔记(老王学习技巧 论坛) 利用好资源(vip群,论坛) 励志前辈经历 http://ask.apelearn.com/question/6597    2 约定 系统centos7.3系统 虚拟软件VMware workstat...

InfiniteIdea_Go的博客 503

从补码原理到实践:RISC-V中addi指令的符号扩展机制详解

本文深入解析了RISC-V架构中addi指令的符号扩展机制。从补码的数学原理出发,详细阐述了12位立即数在指令编码中如何通过符号位进行扩展,并结合lui指令,揭示了加载任意32位立即数的正确方法与实践陷阱,帮助开发者编写高效可靠的底层代码。

weixin_29161719的博客 139

从设计到实战:手把手教你用SolidWorks完成一个简易离心泵叶轮的水力设计全流程

本文详细介绍了使用SolidWorks进行简易离心泵叶轮水力设计的全流程,涵盖参数计算、水力设计和三维建模等关键步骤。通过实际案例演示,帮助机械设计工程师和学生掌握从理论到实践的转化技巧,特别适合低比转速离心泵叶轮的设计需求。

weixin_30621711的博客 233

linux学习lesson32

目录 1 监控io性能 2 free命令 3 ps命令 4 查看网络状态 5 linux下抓包 1 监控io性能 iostat -x  磁盘使用 [root@worker1 ~]# iostat -x Linux 3.10.0-327.el7.x86_64 (worker1) 10/15/2018 _x86_64_ (2 CPU) avg-cpu: %us...

InfiniteIdea_Go的博客 397

【从零搭建到实战运行】基于PX4-1.13与XTDrone的FAST-LIVO2 Gazebo仿真全流程解析

本文详细解析了从零开始搭建基于PX4-1.13飞控、XTDrone仿真框架与Gazebo的FAST-LIVO2无人机仿真平台的全流程。内容涵盖环境配置、Livox雷达插件定制、算法部署与参数调试,旨在帮助开发者快速构建完整的激光-惯性-视觉SLAM仿真环境,并解决集成过程中的常见问题。

weixin_29218509的博客 520

linux学习lesson39

1 lamp架构介绍 Linux+Apache(httpd)+MySQL+PHP PHP网站(Google、淘宝、百度、51cto博客、猿课论坛) 三个角色可以在一台机器、也可以分开(httpd和PHP要在一起) 2 mysql,mariadb介绍 MySQL是一个关系型数据库,由mysql ab公司开发,mysql在2008年被sun公司收购(10亿刀),2009年sun公司被oracl...

InfiniteIdea_Go的博客 201

解密OpenVLA的ActionTokenizer:如何用256个Token控制7维机器人动作

本文深入解析了OpenVLA模型中ActionTokenizer的核心机制。该分词器通过将7维连续机器人动作空间离散化为256个Token,巧妙地解决了大语言模型输出精确控制指令的难题。文章详细阐述了其设计哲学、与Llama-2词表的集成方式,并分析了256个离散区间在精度与效率间的平衡,为机器人视觉-语言-动作控制提供了关键技术桥梁。

weixin_29209801的博客 477

【2023版】基于JT808/JT1078协议的车载视频监控平台开发实战-开源架构解析

本文详细解析了基于JT808/JT1078协议的车载视频监控平台开发实战,涵盖协议核心作用、开源架构设计、开发避坑指南及二次开发建议。重点介绍了JT1078协议在音视频传输中的优化方案,以及海量位置数据存储、高可用架构等关键技术点,为开发者提供全面的实战参考。

weixin_26965807的博客 236

Lesson9 【LINUX】将京淘项目发布到Linux系统上

1.Linux中配置JDK 2.Linux中配置MariaDB 3.将打包好的项目发布到Linux 4.配置nginx

weixin_42752402的博客 309

二叉树随机漫步

元旦快乐! 学习到中本聪bitcoin的文章的calculation部分的时候,出现了binomial random walk,不是很明白什么是random walk。发现这个文章写的很好:https://blog.youkuaiyun.com/fireguard/article/details/16111603 随机漫步,也叫随机游走,最早是物理学中做"布朗运动"的微观粒子的运动形态来形成的一个模型,布朗运...

gjq5464的博客 1737

linux学习lesson41

php

InfiniteIdea_Go的博客 309

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

linux学习lesson62

mysql的主从数据库的扩展知识 不停库不锁表在线主从配置 http://seanlook.com/2015/12/14/mysql-replicas/ 主从不同步 http://www.rfyy.net/archives/2309.html http://blog.51cto.com/storysky/259280 主主 关于 auto_increment https://blog.csdn...

InfiniteIdea_Go的博客 238

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

linux学习lesson65

文章目录1 LVS DR模式搭建2 keepalived + LVS扩展 1 LVS DR模式搭建 三台机器 (rs要启动nginx) 分发器,也叫调度器(简写为dir) 192.168.139.130 rs1 192.168.139.132 rs2 192.168.139.133 vip 192.168.133.200 dir上编写脚本 vim /usr/local/sbin/lvs_dr.s...

InfiniteIdea_Go的博客 481

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

linux学习lesson67

文章目录1.主动模式和被动模式2.添加监控主机3.添加自定义模板4.处理图形中的乱码扩展 1.主动模式和被动模式 主动或者被动是相对客户端来讲的 被动模式,服务端会主动连接客户端获取监控项目数据,客户端被动地接受连接,并把监控信息传递给服务端 主动模式,客户端会主动把监控数据汇报给服务端,服务端只负责接收即可。 当客户端数量非常多时,建议使用主动模式,这样可以降低服务端的压力。 服务端有公网ip...

InfiniteIdea_Go的博客 312

linux学习lesson63

文章目录1.集群介绍2keepalived配置高可用集群扩展 1.集群介绍 根据功能划分为两大类:高可用和负载均衡 高可用集群通常为两台服务器,一台工作,另外一台作为冗余,当提供服务的机器宕机,冗余将接替继续提供服务 实现高可用的开源软件有:heartbeat、keepalived 负载均衡集群,需要有一台服务器作为分发器,它负责把用户的请求分发给后端的服务器处理,在这个集群里,除了分发器外,...

InfiniteIdea_Go的博客 262

linux学习lesson47

文章目录1 php扩展模块安装扩展 1 php扩展模块安装 需求:临时添加一个模块,以redis模块为例 查看php已安装的模块: [root@linux01 ~]# /usr/local/php/bin/php -m //查看模块 下面安装一个redis的模块(在lamp架构,当做缓存来用) 下载redis包: [root@linux01 ~]#cd /usr/local/src/ [roo...

InfiniteIdea_Go的博客 205

ADS122U04与dsPIC33FJ的RTD测温方案:从硬件到固件全解析

工业现场与HVAC系统中的温度测量,常面临传感器信号微弱、电磁环境复杂、精度要求高等多重挑战。以PT100/PT1000为代表的电阻式温度传感器,其阻值变化极小,普通MCU内置ADC难以实现高分辨率的稳定采集。基于Δ-Σ架构的高精度ADC配合比例式测量原理,可有效抑制激励电流温漂和引线电阻误差,成为这类场景的主流技术路径。ADS122U04IPWR作为一款集成UART接口与双IDAC电流源的24位ADC,配合dsPIC33FJ256GP710A数字信号控制器,既能完成高精度温度采集,又能实现风机、阀门等执行

weixin_34115824的博客 241

linux学习lesson25

目录 1 shell特殊符号cut命令 2 sort_wc_uniq命令 3 tee_tr_split命令 4 shell特殊符号下 1 shell特殊符号cut命令 特殊符号 "*" 任意个任意字符 "?" 任意一个字符 "#" 注释字符 "\" 脱义字符 "|" 管道符 cut命令 用来截取某一个字段,其格式为cut -d '分隔字符' [-cf] n,这里的n是数...

InfiniteIdea_Go的博客 216

跟马哥学linux (lesson 1)

简单用户管理命令总结一,用户相关命令1.useraddman文档说明:create a new user or update default new user information中文说明:创建一个新用户或者更新默认新用户信息重用参数:-d, --home HOME_DIR:创建家目录-c, --comment COMMENT 创建注释说明-D, --defaults 修...

weixin_34417183的博客 137

Lesson5 -Linux Network Configuration

basic tasks1.ifconfig show ip,networkcard infomation eth02.sudo dhclient release renew IP configuration3.sudo /etc/init.d/neworking restart restart networking serve...

weixin_34336526的博客 223

lesson2 -basic Linux tasks

1. sudo super user do ROOT is higest user2. man Pages man ping : describe ping command hit 'q' exit and back to command line3. sudo tasksel: LAMP se...

weixin_33748818的博客 99

Oracle_linux_lesson_p2

用户和组 组:groupadd -g 1100 dbagroupadd -g 1200 oinstall 用户useradd -u 1100 -g 1200 -G 1100 -d /home/oracle oracle 查看oracle用户id oracle 改组名groupmod -n osdba #新用户 dba #老用户 用户改组名usermod -G 1201 1100 oracle ...

weixin_33915554的博客 96
上一篇: linux学习lesson50
下一篇: linux学习lesson52
InfiniteIdea_Go
博客等级 码龄8年 3粉丝 77原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值