春有百花秋有月

春有百花秋有月

夏有凉风冬有雪

windows bat from linux

1.将以下脚本写入bat文件:执行同步并且本地只保留一周的文件.

    start /min cmd /c "C:\Users\user1\AppData\Local\Programs\WinSCP\WinSCP.exe" /console /script=D:\gz\52.69\bak\bitwarden-backup\server_bak.txt
    set SrcDir=D:\gz\52.69\bak\bitwarden-backup\bak
    set DaysAgo=5
    forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo% /c "cmd /c rd /s /q @path"
    forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo% /c "cmd /c del /f /q /a @path"

2.定义server_bak.txt文件:

阅读剩余部分 →

typecho install and htpasswd config

  apt-get update
  apt-get install apache2-utils
  • 创建用户和密码:
      htpasswd -c /etc/nginx/.htpasswd gz
  • 修改用户密码:
      /etc/nginx/.htpasswd gz
  • 二、安装typecho

    https://docs.typecho.org/install

    下载php及相关依赖

    sudo apt-get install php7.4 php7.4-sqlite php7.4-fpm php-mbstring php7.4-gd  
  • 安装依赖
    sudo apt install php php-cli php-fpm php-mysql php-json php-opcache php-mbstring php-xml  
  • 启动php服务:查找对应的 PHP-FPM systemd 服务单元文件。在 /lib/systemd/system/ 目录下查找以 php{version}-fpm.service 命名的文件,例如:

        service php7.4-fpm start
  • 下载源码(可以在typecho官网找到)

         wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip

    解压源码

      unzip typecho.zip

    对整个源码目录赋予足够的权限

      chmod -R 777 /home/typecho
  • 配置nginx

      server{
          listen 80;
          server_name ****.xyz;
    
          root /var/www/typecho;
          index index.php;
    
          if (!-e $request_filename) {
              rewrite ^(.*)$ /index.php$1 last; 
          }
    
          location / {
              root html;
              index index.php index.html index.htm;
    
              set $path_info "";
              set $real_script_name $fastcgi_script_name;
              if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                  set $real_script_name $1;
                  set $path_info $2;
              }
              fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
              fastcgi_param SCRIPT_NAME $real_script_name;
              fastcgi_param PATH_INFO $path_info;
          }
    
          location /admin {
              index index.php;
              try_files $uri $uri/ /admin/index.php?$args;
          }
    
          location ~ .*\.php(\/.*)*$ {
                  include fastcgi.conf;
                  fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
          }
    
          # Typecho static files
          location ~* ^/(usr|admin|themes|plugins)/.*\.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
              expires 24h;
              add_header Cache-Control public;
              access_log off;
    
              try_files $uri $uri/ /index.php?$args;
          }
    
      }
  • 访问:http://****.xyz/install.php 选择sqlite数据库然后下一步...

    阅读剩余部分 →
  • linux crontab

    定时任务,自动更新证书和备份文件仅保留一周内的:

         [root@iZj6c69digospl6f2d3s45Z bitwarden-backup]# crontab -l
            21 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
            0 0 * * * /opt/bitwarden-backup/bw-data-backup.sh >> /opt/bitwarden-backup/backup.log && find /home/appadmin/bitwarden-backup/ -type f -name "bw-data_backup_*" -mtime +7 -exec rm {} \;

    编辑命令:

        crontab -e

    使之生效:

    阅读剩余部分 →

    share music - Una Mattina

    share mu

    sic - Una Mattina

    阅读剩余部分 →

    docker & docker-compose install

    how to install and use docker
    how to install and use docker compose

        sudo apt update
        curl -fsSL https://get.docker.com/ | sh
        sudo systemctl start docker
        sudo systemctl status docker
        sudo systemctl enable docker

    docker-compose:

    Check the Releases and if necessary, update it in the command below:

          sudo curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    或者

    阅读剩余部分 →

    linux vim command

    k 上 h l 左 右 j 下

    x 删除当前光标下的字符
    dw 删除光标之后的单词剩余部分。
    d$ 删除光标之后的该行剩余部分。
    D 从当前位置删除到行尾 (“d$” 的缩写)
    dd 删除当前行。
    db 从当前位置删除到前一个单词的开头
    dw 从当前位置删除到下一个单词开头

    c 功能和d相同,区别在于完成删除操作后进入INSERT MODE
    cc 也是删除当前行,然后进入INSERT MODE

    u 撤销最后执行的命令
    U 修正之前对该行的操作
    Ctrl+R Redo
    选块 先用v,C-v,V选择一块,然后用y复制,再用p粘贴。
    yy 复制当前整行
    nyy 复制当前行开始的n行内容

    通过vi的命令模式输入:set nu,这时候在文件中就会显示行数。(不显示行号用 :set nonu )

    阅读剩余部分 →

    Linux Server init

    绑定原IP或者使用新的IP,如绑定原IP需要先将原IP在原实例中解绑,然后在HOME-Networking中将原IP绑定到新的实例中。

        sudo su

    4.修改管理员和新建用户

        passwd root
        useradd appadmin
        passwd appadmin

    5.SSH配置:

        vim /etc/ssh/sshd_config
            - PermitRootLogin ~~yes~~                    //不允许root登录      
            - PasswordAuthentication yes                 //设置是否使用口令验证
        service sshd reload

    6.升级软件和系统内核(Centos或Debian):

        yum -y update 
        apt -y update
        apt -y upgrade

    7.常用工具安装:

        apt -y install lrzsz
        apt install net-tools
        apt install lsof
        vi /root/.bashrc
         . /root/.bashrc

    8.安装docker|nginx

    docker:

        curl -fsSL https://get.docker.com/ | sh
        sudo systemctl start docker
        sudo systemctl status docker
        sudo systemctl enable docker

    docker-compose:
    Check the Releases and if necessary, update it in the command below:

    阅读剩余部分 →

    update hosts for github

    在本机hosts文件中配置以下内容,可手动访问结尾处地址进行更新:

    Update url:

    Star me:

    GitHub520 Host Start

    140.82.114.26                 alive.github.com
    140.82.113.5                  api.github.com
    185.199.110.153               assets-cdn.github.com
    185.199.108.133               avatars.githubusercontent.com
    185.199.108.133               avatars0.githubusercontent.com
    185.199.108.133               avatars1.githubusercontent.com
    185.199.108.133               avatars2.githubusercontent.com
    185.199.108.133               avatars3.githubusercontent.com
    185.199.108.133               avatars4.githubusercontent.com
    185.199.108.133               avatars5.githubusercontent.com
    185.199.108.133               camo.githubusercontent.com
    140.82.113.22                 central.github.com
    185.199.108.133               cloud.githubusercontent.com
    140.82.113.9                  codeload.github.com
    140.82.113.21                 collector.github.com
    185.199.108.133               desktop.githubusercontent.com
    185.199.108.133               favicons.githubusercontent.com
    140.82.113.4                  gist.github.com
    54.231.236.113                github-cloud.s3.amazonaws.com
    54.231.202.153                github-com.s3.amazonaws.com
    52.216.44.33                  github-production-release-asset-2e65be.s3.amazonaws.com
    54.231.161.177                github-production-repository-file-5c1aeb.s3.amazonaws.com
    54.231.130.81                 github-production-user-asset-6210df.s3.amazonaws.com
    192.0.66.2                    github.blog
    140.82.112.3                  github.com
    140.82.113.18                 github.community
    185.199.109.154               github.githubassets.com
    151.101.65.194                github.global.ssl.fastly.net
    185.199.110.153               github.io
    185.199.108.133               github.map.fastly.net
    185.199.110.153               githubstatus.com
    140.82.113.26                 live.github.com
    185.199.108.133               media.githubusercontent.com
    185.199.108.133               objects.githubusercontent.com
    13.107.42.16                  pipelines.actions.githubusercontent.com
    185.199.108.133               raw.githubusercontent.com
    185.199.108.133               user-images.githubusercontent.com
    13.107.226.40                 vscode.dev
    140.82.113.21                 education.github.com
    阅读剩余部分 →

    数据库错误socketTimeout&Can 't connect to X11&connection reset

    2023-01-08
    多表联接复杂SQL在集群环境查询效率很低,接口会超时的问题。

    解决:2023-01-12号左右,人大金仓负责更新相关索引解决了。

    2023-01-09
    改数据库连接配置

        jdbc.url=jdbc:kingbase8://x.x.xx.x:54321/xxdb?currentSchema=public&ConfigurePath=/coredata/promo_config/myconfig/jdbc.conf

    2023-01-10
    新门户首页,登录成功之后访问业务动态--更多时,页面偶尔出现卡住,空白页

    面,无响应结果,等待时间过长之后报错:socketTimeout

    Ps:此问题持续时间较长,后续是修改索引或者修改防火墙配置好的未知。

    2023-01-10
    附件预览出错,提示:X11
    (ERROE] java.awt.AWTError: Can 't connect to X11' window server using localhost:10.0 ' as ...
     
    解决:
    /bin/catalina.sh 中所有的(请注意,是所有)-Dcatalina.home="$CATALINA_HOME" /
    下面都加上了-Djava.awt.headless=true

    2023-01-13
    更新人大金仓数据库驱动至:kingbase8-8.6.0.jar

    阅读剩余部分 →

    ffmpeg commond

    视频文件简单转换成另一个格式的视频文件, 会默认使用H264编码格式输出视频文件.

    ffmpeg -i input.avi output.mkv
  • 把一个视频文件my.avi和一个声音文件my.mp3合并成一个音视频文件my.mkv

    ffmpeg –i my.avi –i my.mp3 –vcodec copy –acodec copy my.mkv
  • 把音视频文件my.mkv里的声音数据去掉生成只有图像的my.avi文件, 并使用h264编码

    ffmpeg -i my.mk
    <!--more-->
    v -vcodec h264 -an my.avi
  • 把音视频文件my.mkv里的图像数据去掉生成只有声音的my.aac文件, 并使用aac编码

    ffmpeg -i my.mkv -acodec aac -vn my.aac
  • 把多个图像文件使用h264编码封装成avi文件,如有my0.jpg, my1.jpg ... my99.jpg

    
    ffmpeg -i my%d.jpg  -vcodec h264 my.avi
    ```xshell
  • 指定音视频文件把1分30秒到5分20秒的内容输出到另一个文件

    ffmpeg -ss 00:01:30 -i my.avi -to 00:05:20 -vcodec copy -acodec copy my.mkv
  • 把视频文件里内容输出成多张图像

    ffmpeg -i my2.avi -r 1 -f image2  my%d.jpg

    只输出一张图像

    阅读剩余部分 →