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
| 假设现有大小为32 x 32的图片样本,输入样本的channels为1,该图片可能属于10个类中的某一类。CNN框架定义如下: | |
| ```python | |
| class CNN(nn.Module): | |
| def __init__(self): | |
| nn.Model.__init__(self) | |
| self.conv1 = nn.Conv2d(1, 6, 5) # 输入通道数为1,输出通道数为6 | |
| self.conv2 = nn.Conv2d(6, 16, 5) # 输入通道数为6,输出通道数为16 | |
| self.fc1 = nn.Linear(5 * 5 * 16, 120) | |
| self.fc2 = nn.Linear(120, 84) |
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
| ``` | |
| sed -n '/05\/Jun\/2018:15:59/,/06\/Jun\/2018:15:59/p' access.log | sed | |
| -n '/GET\s\{1,\}\/7\/qipai\/download\/index.html/p' | wc -l | |
| ``` |
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
| 1、尽量使用https | |
| https可以过滤掉大部分的安全问题。https在证书申请,服务器配置,性能优化,客户端配置上都需要投入精力,所以缺乏安全意识的开发人员容易跳过https,或者拖到以后遇到问题再优化。https除了性能优化麻烦一些以外其他都比想象中的简单,如果没精力优化性能,至少在注册登录模块需要启用https,这部分业务对性能要求比较低。 | |
| 2、不要传输明文密码 | |
| 不知道现在还有多少app后台是明文存储密码的。无论客户端,server还是网络传输都要避免明文密码,要使用hash值。客户端不要做任何密码相关的存储,hash值也不行。存储token进行下一次的认证,而且token需要设置有效期,使用refreshtoken去申请新的token。 | |
| 3、Post并不比Get安全 |
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
| 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
| 例如要杀掉hello这个进程,使用下面这个命令就能直接实现。 | |
| ``` | |
| ps -ef |grep hello |awk '{print $2}'|xargs kill -9 | |
| ``` | |
| 这里是输出ps -ef |grep hello 结果的第二列的内容然后通过xargs传递给kill -9,其实第二列内容就是hello的进程号! | |
| 附录: | |
| 1,awk是一种编程语言,用于在Linux/unix下对文本和数据进行处理。数据可以来自标准输入、一个或多个文件,或其它命令的输出。它支持用户自定义函数和动态正则表达式等先进功能,是linux/unix下的一个强大编程工具。它在命令行中使用,但更多是作为脚本来使用。awk的处理文本和数据的方式是这样的,它逐行扫描文件,从第一行到最后一行,寻找匹配的特定模式的行,并在这些行上进行你想要的操作。如果没有指定处理动作,则把匹配的行显示到标准输出(屏幕),如果没有指定模式,则所有被操作所指定的行都被处理。awk分别代表其作者姓氏的第一个字母。因为它的作者是三个人,分别是Alfred Aho、Brian Kernighan、Peter Weinberger。gawk是awk的GNU版本,它提供了Bell实验室和GNU的一些扩展。 | |
| 2. xargs是给命令传递参数的一个过滤器,也是组合多个命令的一个工具。它把一个数据流分割为一些足够小的块,以方便过滤器和命令进行处理。通常情况下,xargs从管道或者stdin中读取数据,但是它也能够从文件的输出中读取数据。xargs的默认命令是echo,这意味着通过管道传递给xargs的输入将会包含换行和空白,不过通过xargs的处理,换行和空白将被空格取代。xargs 是一个强有力的命令,它能够捕获一个命令的输出,然后传递给另外一个命令. |
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
| 1. Linux系统磁盘使用空间不足时,如何查找大文件并进行清理的方法。 | |
| ``` | |
| 查找大于100M的大文件: | |
| find / -size +100M -exec ls -lh {} \; | |
| ``` | |
| 2.Linux查看磁盘空间大小 | |
| 查看磁盘空间大小:`df -h` |
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
| 1.[shadowsocks](https://github.com/shadowsocks): 翻墙神器,不解释 | |
| 2.[localtunnel](https://github.com/localtunnel):内网穿透神器,nodejs开发的,可以把你的网站从没有公网ip的局域网内发布到广域网上。 | |
| 3.[QQBot](https://github.com/floatinghotpot/qqbot):基于 WebQQ 的机器人,可以自制智能机器人,可以用来集成团队协作系统的消息推送,可以持续集成自动通知,集成监控报警, | |
| 4.[Fuse](https://www.fusetools.com/):移动跨平台解决方案 | |
| 5.[APIDoc](http://apidocjs.com/):自动生成接口文档,自带调试功能哦。 | |
| 6.[Docker](https://docker.io):这个真不用说了。。。 | |
| 7.[ATOM](https://atom.io):github开源的编辑器,插件丰富,支持语言广,使用体验好,还可以写Markdown。 | |
| 8.[docsify](https://docsify.js.org/#/):文档生成工具,体验友好基于VUE | |
| 9.[NativeScript](https://www.nativescript.org):基于AngularJS 开发IOS、Android应用,体验比RN好 |
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
| 先看一个笑话 | |
| ``` | |
| 作为一个RD最恨的是如下场景 | |
| PM:这个按钮改成方的,这里加一个确认页,blah,blah…我要赶着回家和女友啪啪啪, | |
| 你们这群屌丝RD留下加班吧,明天早上我来看结果。 | |
| RD:… | |
| (第二天) |
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
| 相信有人会想过如何对服务器上某个特定IP出口/入口流量进行进行统计。不需要找其他程序,Linux kernel 2.6(2.4算不算?)与之后版本自带的iptables就能实现此功能。方法非常简单,在iptables处添加特定规则即可。 | |
| 对特定IP进行流量统计: | |
| 例如我要统计服务器上的IP:192.168.0.10的入网流量: | |
| iptables -I INPUT -d 192.168.0.10 | |
| 统计该IP的出网流量: |
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
| DigitalOcean是一家美国VPS服务商,成立于2012年4月,虽然成立时间不长,但是用户增长却很快,据他们官网上的统计有20多万台VPS。 | |
| 我使用了很长时间了,归结一下:采用KVM虚拟技术;使用SSD硬盘速度上要比HDD硬盘快不少,但如果万一损坏数据很难找回,所以备份是王道;后台自己开发的,简洁且功能也比较完善;后台发ticket回复快,发过几次ticket没超过10分钟的;计费方式灵活,可以按月或按小时付费,其实这两种付费方式差不多;机房有旧金山(San Francisco)、纽约(NewYork)和荷兰阿姆斯特丹(Amsterdam)可选;可以直接向他们要求增加功能,而且有进度,完成后有通知;有类似于Linode的各类环境的搭建使用教程和比较活跃的社区;支付方式支持Paypal和信用卡,推荐用Paypal。 | |
| 基本上用起来还是挺爽的,如果会linux。 | |
| 点击下面链接注册送10美元,不过注册验证需要支付5美元才能验证通过。 | |
| 附上地址:[http://www.digitalocean.com](http://www.digitalocean.com/?refcode=05288e832cdc) |
NewerOlder