常用命令
快速删除 node_modules 文件夹
系统命令
# cmd |
使用 npm 包
npm i rimraf -g |
一次执行多条命令
# cmd 使用 && 连接多个命令 |
删除一个文件夹内字节小于 10kb 的文件
# 输出所有大小小于10k的文件 |
系统命令
# cmd |
使用 npm 包
npm i rimraf -g |
# cmd 使用 && 连接多个命令 |
# 输出所有大小小于10k的文件 |
Window.history 是一个只读属性,提供了操作浏览器会话历史(浏览器地址栏中访问的页面,以及当前页面中通过框架加载的页面)的接口。HTML5 引入了 history.pushState() 和 history.replaceState() 方法,它们分别可以添加和修改历史记录条目。这些方法通常与 window.onpopstate 配合使用。
参考
https://developer.mozilla.org/zh-CN/docs/Web/API/History_API
https://developer.mozilla.org/zh-CN/docs/Web/API/Window/history
在 history 中跳转
window.history.back() // 向后跳转 相当于点击浏览器回退按钮 |
可以通过查看长度属性的值来确定的历史堆栈中页面的数量
window.history.length |
history.pushState(stateObject, title, url) |
状态对象(stateObject)–stateObject 是一个 JavaScript 对象,通过 pushState 方法可以将 stateObject 内容传递到新页面中。
标题(title)–几乎没有浏览器支持该参数,但是传一个空字符串会比较安全。
地址(url)–新的历史记录条目的地址(可选,不指定的话则为文档当前 URL);浏览器在调用 pushState()方法后不会加载该地址;传入的 URL 与当前 URL 应该是同源的,否则,pushState()会抛出异常。
history.pushState()主要是在不刷新浏览器的情况下,创建新的浏览记录并插入浏览记录队列中
假设在 http://mozilla.org/foo.html 中执行了以下 JavaScript 代码:
let stateObj = { |
这将使浏览器地址栏显示为 http://mozilla.org/bar.html,但并不会导致浏览器加载 bar.html ,甚至不会检查 bar.html 是否存在
history.replaceState() 的使用与 history.pushState() 非常相似,区别在于 replaceState() 是修改了当前的历史记录项而不是新建一个
# yum install httpd (centos之下,Apache的名字叫httpd,和Apache的主程序 httpd.exe 同名) |
先确保,云服务器的 80 端口,是允许外网访问的。
开启 Apache 服务
service httpd start |
浏览器输入: 外网 IP:80,如果能正常显示 Apache 的内置主页,则说明 Apache 服务已正常开启。
主配置文件 /etc/httpd/conf/httpd.conf
修改如下键值兼容 php
键:DirectoryIndex
值:index.html index.php
默认站点主目录:/var/www/html/
https://www.cnblogs.com/smbin/p/6946210.html
# yum install mod_ssl -y |
Ps:安装完成后,会在/etc/httpd/conf.d/下生成一个 ssl.conf 配置文件。
建一个目录用来放 ssl 证书文件
# mkdir /etc/httpd/ssl/ |
编辑 ssl 配置文件
# vim /etc/httpd/conf.d/ssl.conf |
修改以下几行,去掉前面的“#”注释;
<VirtualHost> |
重启服务器
# service httpd restart |
通过安装包安装
# 安装所需环境 |
centos 下,yum 源不提供 nginx 的安装,可以通过切换 yum 源的方法获取安装
yum -y install nginx |
主站点目录/usr/share/nginx/html
配置 Nginx:
Nginx 的配置文件默认位置为:/etc/nginx/nginx.conf
server { |
自定义 Nginx 站点配置文件存放目录
/etc/nginx/conf.d/ |
默认站点目录/usr/share/nginx/html
安装 php
yum install php php-fpm |
配置 php.ini
/etc/php.ini
cgi.fix_pathinfo=1 |
配置 php-fpm
/etc/php-fpm.d/www.conf
user = nginx
group = nginx
chkconfig php-fpm on #设置 php-fpm 自启动
service nginx restart #重新启动 nginx
service php-fpm start #启动 php-fpm
sudo iptables -I INPUT -p tcp -m tcp –dport 80 -j ACCEPT
sudo iptables -I INPUT -p tcp -m tcp –dport 443 -j ACCEPT
iptables -L -n
/usr/sbin/nginx
查询 nginx 进程
ps -ef | grep nginx
nginx 配置
# |
# |
安装 nginx
sudo apt-get install nginx |
Ubuntu 安装之后的文件结构大致为:
安装 php
apt-get install php |
配置 php.ini /etc/php/7.2/cli/
cgi.fix_pathinfo=1 |
配置 php-fpm
启动 nginx
/etc/init.d/nginx restart |
删除 nginx
sudo apt-get --purge remove nginx |
pacman -S nginx |
启动 Nginx 服务,运行以下命令:
# systemctl start nginx |
# systemctl enable nginx |
默认页面是:
/usr/share/nginx/html/index.html |
你可以修改在 /etc/nginx/ 目录中的文件来更改配置 ./etc/nginx/nginx.conf 是主配置文件
<a href="tel:+86-123-456-7890">1234567890</a> |
有时候不是电话号码的数字会被浏览器自动解析为如上电话号码格式,导致样式和布局改变
忽略页面中的数字识别为电话号码, 只要把这个默认行为关闭就行
<meta name="format-detection" content="telephone=no" /> |
说明:Meta 标签中的 format-detection 属性及含义
format-detection 中文的意思是 “格式检测”,它是用来检测 html 里的一些格式的
<!-- 禁止了把数字转化为拨号链接 默认为 yes --> |
在网上搜索后发现有可能有以下原因:
1.你的 VPS 被人用来做爬虫爬 Google,IP 被封
2.你的 IPv4 网段有人做爬虫,网段被封
3.你的 IPv6 网段有人做爬虫,网段被封
IPv6 网段被封
强制你的 VPS 用 IPv4 来访问,具体方法在 /etc/sysctl.conf 后追加
# disable ipv6 |
IPv4 网段被封
强制 VPS 使用 IPv6 访问,确认打开 VPS 上的 IPv6 功能,更改 VPS 的 hosts 中指定 Google Schoolar 的 IPv6 地址,编辑/etc/hosts后追加:
## Scholar |
更改配置后,重启 SS
vultr 注册地址:https://www.vultr.com/
利用 ipip 这个网站的 实用工具里的 ping 来全国性的 ping 我们的主机,检测连通性
Win:
使用软件 PuTTY
打开软件
Host Name (or IP address) 写你服务器的 IP 地址
Port 默认 22
Connection type 选择 SSH
Open
Mac:
默认有 SSH 命令
ssh root@IP
输入用户名和密码,用户名为 root
login as: root
root@IP’s password:
CentOS/Debian/Ubuntu ShadowsocksR 单/多端口 一键管理脚本
https://doub.io/ss-jc42/
yum -y install wget |
备用脚本:
yum -y install wget |
复制上面的代码到 VPS 服务器里,按回车键,脚本会自动安装,以后只需要运行 bash ssr.sh 这个快捷命令就可以出现下图的界面进行设置。
ShadowsocksR MudbJSON 模式多用户一键脚本 支持流量限制
https://doub.io/ss-jc60/
wget -N --no-check-certificate https://softs.fun/Bash/ssrmu.sh && chmod +x ssrmu.sh && bash ssrmu.sh |
备用下载地址
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssrmu.sh && chmod +x ssrmu.sh && bash ssrmu.sh |
bash ssrmu.sh |
wget https://raw.githubusercontent.com/oooldking/script/master/superbench.sh |
锐速/BBR/魔改 BBR/KCPTUN 加速效果对比测试
【原版 BBR】
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh |
【魔改 BBR】
只有 centos 和 debain 版
# centos 版 |
【BBRPlus(BBR v2.0)】
Github 项目地址:https://github.com/cx9208/bbrplus
一键脚本(仅CentOS)
yum -y install wget && wget "https://github.com/cx9208/bbrplus/raw/master/ok_bbrplus_centos.sh" && chmod +x ok_bbrplus_centos.sh && ./ok_bbrplus_centos.sh |
等待安装完成,重启,重启之后,按照以下步骤检查是否成功:
执行 uname -r,显示 4.14.129-bbrplus 则切换内核成功
执行 lsmod | grep bbr,显示有 bbrplus 则开启成功
如 electron sass
修改 ~/.npmrc,或当前项目下的.npmrc 文件(如果没有可以新建)增加如下内容
registry=https://registry.npm.taobao.org |
淘宝 npm 镜像 https://npm.taobao.org/
npm 官网
npm 文档
npm 中文文档
# 更新 npm |
简写
npm install 可简写成 npm i |
修改全局配置
registry=https://registry.npm.taobao.orgnpm config set registry https://registry.npm.taobao.org修改当前项目的 npm 源
在 package.json 同级目录下创建 .npmrc 文件,增加 registry=https://registry.npm.taobao.org
临时使用指定源下载 npm install jquery --registry=https://registry.npm.taobao.org
使用 nrm 管理源
# .npmrc 配置文件位置(~/.npmrc) |
使用 NPM 下载和发布代码时都会接触到版本号。NPM 使用语义版本号来管理代码
语义版本号分为 X.Y.Z 三位,分别代表主版本号、次版本号和补丁版本号。当代码变更时,版本号按以下原则更新。
nrm:npm registry manager(npm 仓库地址管理工具)
# 查看配置列表,带 `*` 号即为当前使用的配置 |
npm list --depth=0 [--dev | --production] |
–depth 表示深度,我们使用的模块会有依赖,深度为零的时候,不会显示依赖模块
npm list --depth=0 --global |
package.json 文件,包(项目)描述文件,用来管理组织一个包(项目),它是一个纯 JSON 格式的
npm init或者npm init -ypackage.json文件进行描述npm install 直接安装项目所有的依赖项{ |
注意:一个合法的 package.json,必须要有 name 和 version 两个属性
91.108.56.0/22 |
原文
http://www.asciiworld.com/
https://github.com/Blankj/awesome-comment
------------------------- |
//When I wrote this, only God and I understood what I was doing |