• 杂记
    csharp database linux netnr 2020-12-03 1020
  • profile.sh 环境变量
    netnr 2020-10-28 360
    # 全局变量
    vi /etc/profile # 编辑
    PATH=$PATH:/package/app/node/bin
    export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL # 在该行前面加
    source /etc/profile # 生效
    
    # 局部变量
    vi ~/.bash_profile # 编辑
    alias nodejs=/package/app/node/bin
    source ~/.bash_profile # 生效
  • install-mysql-win.md Windows 系统安装 MySQL
    netnr 2020-10-21 10
    - 下载地址:https://dev.mysql.com/downloads/mysql
    - 解压包,放置一个目录下(不含中文或空格的路径)
    - 在 **bin** 同级目录创建 **my.ini** 文件和 **data** 文件夹
    - my.ini 文件内容
    ```
    [mysqld]
    # 设置 3306 端口
    port=3306
    # 设置 mysql 的安装目录
    basedir=E:\\mysql-8.0.22-winx64
  • oracle_expdp_impdp.sh Oracle 数据库导入导出
    netnr 2020-10-14 359
    # 按用户导出
    expdp system/oracle@orcl schemas=$user dumpfile=$dbname.dmp logfile=$dbname.log directory=DATA_PUMP_DIR
    # 按表名导出
    expdp system/oracle@orcl tables=($TABLE1,$TABLE2) dumpfile=$dbname.dmp logfile=$dbname.log directory=DATA_PUMP_DIR
    # 按用户导入(表覆盖)
    impdp system/oracle@orcl schemas=$user dumpfile=$dbname.dmp logfile=$dbname.log directory=DATA_PUMP_DIR table_exists_action=REPLACE
    # 按用户导入(转换空间)
    impdp system/oracle@orcl schemas=$user TRANSFORM=segment_attributes:n dumpfile=$dbname.dmp logfile=$dbname.log directory=DATA_PUMP_DIR table_exists_action=REPLACE
    
    # 导入导出包权限设置
  • netsh-http.bat netsh命令监听IP(可实现IIS、nginx共用80端口)
    netnr 2020-09-18 378
    :: 显示监听的IP列表
    netsh http show iplisten
    
    :: 添加监听IP
    netsh http add iplisten ipaddress=127.0.0.1
    
    :: 删除监听IP
    netsh http delete iplisten 127.0.0.1
  • aspnet_regiis.bat Framework注册IIS
    netnr 2020-09-18 344
    @echo off
    title .NET Framework Register IIS
    color 5f
    
    echo.---------- .NET Framework v2 Register IIS
    echo.
    
    %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
    %windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i
  • install-iis.bat 一键安装IIS
    netnr 2020-09-18 360
    @echo off
    title Install IIS
    color 5f
    
    echo.---------- Install IIS about 3-5 Minutes
    echo.
    
    dism /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment	/FeatureName:IIS-ASP	/FeatureName:IIS-ASPNET    /FeatureName:IIS-BasicAuthentication    /FeatureName:IIS-CGI    /FeatureName:IIS-ClientCertificateMappingAuthentication    /FeatureName:IIS-CommonHttpFeatures    /FeatureName:IIS-CustomLogging    /FeatureName:IIS-DefaultDocument    /FeatureName:IIS-DigestAuthentication   /FeatureName:IIS-DirectoryBrowsing   /FeatureName:IIS-FTPExtensibility   /FeatureName:IIS-FTPServer   /FeatureName:IIS-FTPSvc   /FeatureName:IIS-HealthAndDiagnostics   /FeatureName:IIS-HostableWebCore   /FeatureName:IIS-HttpCompressionDynamic   /FeatureName:IIS-HttpCompressionStatic   /FeatureName:IIS-HttpErrors   /FeatureName:IIS-HttpLogging   /FeatureName:IIS-HttpRedirect   /FeatureName:IIS-HttpTracing   /FeatureName:IIS-IIS6ManagementCompatibility   /FeatureName:IIS-IISCertificateMappingAuthentication   /FeatureName:IIS-IPSecurity   /FeatureName:IIS-ISAPIExtensions   /FeatureName:IIS-ISAPIFilter   /FeatureName:IIS-LegacyScripts   /FeatureName:IIS-LegacySnapIn   /FeatureName:IIS-LoggingLibraries   /FeatureName:IIS-ManagementConsole   /FeatureName:IIS-ManagementScriptingTools   /FeatureName:IIS-ManagementService   /FeatureName:IIS-Metabase   /FeatureName:IIS-NetFxExtensibility   /FeatureName:IIS-ODBCLogging   /FeatureName:IIS-Performance   /FeatureName:IIS-RequestFiltering   /FeatureName:IIS-RequestMonitor   /FeatureName:IIS-Security   /FeatureName:IIS-ServerSideIncludes   /FeatureName:IIS-StaticContent   /FeatureName:IIS-URLAuthorization   /FeatureName:IIS-WebDAV   /FeatureName:IIS-WebServer   /FeatureName:IIS-WebServerManagementTools   /FeatureName:IIS-WebServerRole   /FeatureName:IIS-WindowsAuthentication   /FeatureName:IIS-WMICompatibility   /FeatureName:WAS-ConfigurationAPI   /FeatureName:WAS-NetFxEnvironment   /FeatureName:WAS-ProcessModel   /FeatureName:WAS-WindowsActivationService
    dism /online /enable-feature /featurename:IIS-ISAPIFilter
    dism /online /enable-feature /featurename:IIS-ISAPIExtensions
  • npm install ...
    吐槽 netnr 2020-09-17 100
  • NSFWJS 鉴黄
    netnr 2020-09-13 27
  • locale.sh CentOS 修改语言环境为中文
    netnr 2020-09-07 364
    locale # 当前语言包
    
    locale -a # 系统拥有语言包(zh_CN.UTF-8是简体中文,如果没有zh_CN.UTF-8,就安装语言包,如果存在可以直接设置)
    
    # CentOS 7
    yum install kde-l10n-Chinese # 安装简体中文语言包
    
    # CentOS 8
    dnf search langpacks # 搜索语言包
    dnf install langpacks-zh_CN.noarch # 安装中文语言
  • fdisk-lsblk.sh Linux 挂载磁盘、分区、扩容
    netnr 2020-09-04 340
    lsblk # 检查磁盘
    fdisk -l # 查看所有磁盘信息(含未加载磁盘)
    
    fdisk /dev/sdb # 对磁盘分区,大于2T时,用parted
    # 输入 m 显示菜单,选择 n 创建分区,再选择 p(主分区)或 e(扩展分区),再确认 2048 ,再确认(默认整个磁盘)或自定义 +100G,再输入 w
    partprobe /dev/sdb # 内核重新读取分区表
    mkfs.ext4 /dev/sdb1 # 格式化分区(磁盘分区,非整个磁盘)
    mkdir /mnt/package1 # 创建挂载目录
    mount /dev/sdb1 /mnt/package1 # 临时挂载目录
    vi /etc/fstab # 编辑 永久挂载,追加如下内容:
  • mysql-datadir.sh CentOS 更改 MySQL 数据存储路径(datadir)
    netnr 2020-09-03 333
    # 登录mysql,查看默认存储路径,一般在 /var/lib/mysql
    show global variables like '%datadir%';
    
    # 停止数据库
    systemctl stop mysqld
    # 创建新的数据存储目录
    mkdir -p /package/mysqldata
    # 拷贝到新目录
    cp -a -r /var/lib/mysql/* /package/mysqldata
    # 修改属主为 mysql 设置权限 chmod 750 /package/mysqldata
  • install-mysql8.sh 安装 MySQL8
    netnr 2020-09-03 358
    ### 清理
    
    # 查找并删除mysql(原本的残留)
    rpm -qa | grep mysql # 查找
    yum remove 软件包名 # 删除
    
    # 查找并删除mariaDB
    rpm -qa | grep mariadb # 查找
    rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 # 删除
  • update-git.sh CentOS 升级 git
    netnr 2020-09-01 5
    git --version   # 当前版本
    
    vi /etc/yum.repos.d/wandisco-git.repo   # 启用Wandisco GIT存储库,在此之前我们先写入新yum存储库配置文件,输入以下内容:
    
    [wandisco-git]
    name=Wandisco GIT Repository
    baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
  • docker-oracle.sh 基于 docker 快速安装 oracle
    netnr 2020-08-21 417
    wget -qO- get.docker.com | bash # 一键安装 docker 容器
    systemctl start docker  # 启动服务
    
    docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:2.0
    docker run -itd --restart=always --name lhrora11204 -h lhrora11204 --shm-size=1G -p 1521:1521 --privileged=true lhrbest/oracle_11g_ee_lhr_11.2.0.4:2.0 init
    docker exec -it lhrora11204 bash # 进入容器
    su - oracle
    lsnrctl start
    sqlplus / as sysdba
    startup
  • yarn.sh yarn 命令使用
    netnr 2020-08-19 6
    yarn init   # 初始化一个新项目
    
    # 添加依赖包
    yarn add [package]
    yarn add [package]@[version]
    yarn add [package]@[tag]
    yarn global add [package] # 添加全局包
    
    # 将依赖项添加到不同依赖项类别中
    # 分别添加到 devDependencies、peerDependencies 和 optionalDependencies 类别中: