# 安装
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh
chmod +x shadowsocksR.sh
./shadowsocksR.sh 2>&1 | tee shadowsocksR.log
# 卸载
./shadowsocksR.sh uninstall
# 状态
/etc/init.d/shadowsocks status
# 下载 Microsoft SQL Server Red Hat 存储库配置文件
curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2022.repo
yum install mssql-server # 安装
# 运行包安装完成后mssql-conf 安装并按照提示操作以设置 SA 密码,并选择你的版本
/opt/mssql/bin/mssql-conf setup
# MSSQL_LCID='2052' MSSQL_COLLATION='Chinese_PRC_CI_AS' /opt/mssql/bin/mssql-conf setup
# "CI" 表示 Case Insensitive,不区分大小写;"AS" 表示 Accent Sensitive,区分重音符号
# https://learn.microsoft.com/zh-cn/sql/linux/sql-server-linux-configure-environment-variables
server {
listen 66;
location / {
# 允许跨域
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_set_header X-Real-IP $remote_addr;
# 网络和 IO 测试 https://teddysun.com/444.html
wget -qO- bench.sh | bash
# 性能测试 https://teddysun.com/245.html
wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh && chmod +x unixbench.sh
./unixbench.sh
wget -qO- --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash
# 生成密钥(RSA 兼容性强)
ssh-keygen -t rsa -b 4096 -C "netnr" # 生成密钥
# Git 客户端 v2.33.1 及以上的版本或者 OpenSSH 是 8.8 及以上 RSA 算法被禁用,添加配置 ~/.ssh/config
Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
# 生成密钥(ED25519 更小更快更安全,需要 OpenSSH 6.5 以上,推荐),密钥均为 256 位
ssh-keygen -t ed25519 -C "netnr"
# 修改系统变量
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