# 修改系统变量
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p # 保存生效
sysctl net.ipv4.tcp_available_congestion_control # 查看内核是否已开启 BBR
lsmod | grep bbr #查看 BBR 是否启动
#help
https://www.moerats.com/archives/612/
/// <summary>
/// 将Datetime转换成时间戳,10位,秒
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static long ToTimestamp(this DateTime datetime)
{
return (datetime.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
}
/// <summary>
/// 编码
/// </summary>
/// <param name="uri"></param>
/// <param name="charset"></param>
/// <returns></returns>
public static string ToEncode(this string uri, string charset = "utf-8")
{
string URL_ALLOWED_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
/// <summary>
/// 实体转表
/// </summary>
/// <typeparam name="T">泛型</typeparam>
/// <param name="list">对象</param>
/// <returns></returns>
public static DataTable ToDataTable<T>(this IList<T> list)
{
Type elementType = typeof(T);
var t = new DataTable();
# 安装字体
yum -y install fontconfig
cd /usr/share/fonts
mkdir cfont # 创建新的字体文件夹
chmod -R 755 /usr/share/fonts/cfont # 修改 cfont 目录的权限使 root 用户以外的用户也可以使用
# 拷贝字体到 cfont 文件夹
yum install mkfontscale
mkfontscale && mkfontdir
fc-cache –fv # 刷新内存中的字体缓存
chkconfig –list | grep vsftpd # 检查是否安装(没任何反应)
yum install vsftpd # 安装
touch /var/log/vsftpd.log # 创建日志
chkconfig vsftpd on # 自启动
# 允许 root 登录
cd /etc/vsftpd && ls
# 编辑,注释 root,前面添加#
vi ftpusers
vi user_list
/// <summary>
/// 反射参数为实体
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="model"></param>
/// <param name="request"></param>
/// <returns></returns>
public static T RequesToModel<T>(this T model, HttpRequest request = null)
{
if (request == null)
/// <summary>
/// 实体转为表
/// </summary>
/// <typeparam name="T">泛型</typeparam>
/// <param name="list">对象</param>
/// <returns></returns>
public static DataTable ToDataTable<T>(this IList<T> list)
{
Type elementType = typeof(T);
var t = new DataTable();
mysqldump -u 账号 -p 数据库 > 路径 # 备份格式
# 备份库(表结构及数据) -R 包含存储过程、函数和触发器 --no-tablespaces 不包括表空间
mysqldump -u root -p netnrdb -e -R --no-tablespaces > /netnr/data/netnrdb.sql
mysqldump -uroot -p123456 netnrdb -e -R --no-tablespaces > /netnr/data/netnrdb.sql
mysqldump -u root -p -d netnrdb > /netnr/data/netnrdb.sql # 备份库(表结构)(加 -d 不含数据)
mysqldump -u root -p netnrdb table1 table2 table3 > netnrdb.sql # 备份库(指定表)
mysqldump -u root -p --databases dbname1, dbname2 > backdb.sql # 备份多个数据库
-- 生成清理所有表语句;
SELECT CONCAT('truncate TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ';')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA IN ( '数据库名' );
# 公共依赖
Install-Package Microsoft.EntityFrameworkCore.Tools
# MySQL
Install-Package Pomelo.EntityFrameworkCore.MySql
Scaffold-DbContext "Server=.;Port=3306;Database=netnr;uid=root;pwd=123" Pomelo.EntityFrameworkCore.MySql -Force -UseDatabaseNames -DataAnnotations -NoPluralize -NoOnConfiguring -Context ContextBase
#SQLServer
Install-Package Microsoft.EntityFrameworkCore.SqlServer
Scaffold-DbContext "Server=.;Database=netnr;uid=sa;pwd=123" Microsoft.EntityFrameworkCore.SqlServer
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum install mysql-server
mysqld --initialize # 初始化
chown mysql:mysql -R /var/lib/mysql # 设置权限
systemctl start mysqld # 启动
service mysqld restart # 重启
# linux 安装
yum install git-core
# clone项目
git clone https://github.com/netnr/np.git
# 强制覆盖本地
git fetch --all
git reset --hard origin/master
git pull
nohup dotnet Web.dll & # 后台运行 dotnet 站点
# 会生成 nohup.out 日志文件,如果不想输出日志 /dev/null 是一个路径黑洞
nohup dotnet Web.dll > /dev/null &
echo "" > nohup.out # 清空 nohup.out 日志文件
tail -f nohup.out # 监听 nohup.out 日志输出
kill $(lsof -t -i :8080) # 根据端口 8080 关闭进程
kill $(pidof node) # 根据进程名称 node 关闭进程
# 安装方式:一键安装
wget http://soft.vpser.net/lnmp/lnmp1.9.tar.gz && tar -xvf lnmp1.9.tar.gz && cd lnmp1.9 && ./install.sh nginx
./upgrade.sh nginx # 升级
# help
https://lnmp.org/install.html
# 安装方式:CentOS7 yum
rpm -Uvh https://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# 环境
yum -y install gcc gcc-c++ autoconf automake libtool make cmake
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz # 安装包下载地址 https://www.openssl.org/source/
tar -xzf openssl-1.1.1.tar.gz # 解压
cd openssl-1.1.1 # 进入安装目录
mkdir /usr/local/openssl # 创建文件夹
# 卸载升级
vi /etc/ssh/sshd_config # 编辑配置文件
ClientAliveInterval 60 # 表示每分钟发送一次,然后客户端响应,这样就保持长连接,默认是 0, 不发送.
ClientAliveCountMax 3 # 表示服务器发出请求后客户端没有响应的次数达到一定值,就自动断开.
service sshd restart # 重启 sshd 服务
# help
https://www.cnblogs.com/adolfmc/p/7248515.html
wget --no-check-certificate -O shadowsocks.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh
chmod +x shadowsocks.sh
./shadowsocks.sh 2>&1 | tee shadowsocks.log
cat /etc/shadowsocks.json # 查看 config
systemctl restart shadowsocks # 重启
systemctl status shadowsocks # 状态
# help
https://github.com/shadowsocks/shadowsocks-windows/releases