首页 > 其他分享 >上线项目

上线项目

时间:2023-01-25 14:44:43浏览次数:64  
标签:上线 项目 int ++ strs 复制 steps aCells

配置服务器,增加用户

// 创建新用户 acs
adduser acs
usermod -aG sudo acs  # 给用户acs分配sudo权限

// 登录步骤
ssh springboot_server
// 在docker中创建新用户 acs。
// 挂载容器,不要用ctrl d--关掉容器

Linux终端下的复制方式:

(a)左键长按选中要复制的内容

​ 然后按ctrl+Ins复制 shift+Ins粘贴

(b)shift+鼠标左键长按选中

​ 然后按ctrl+Ins复制shift+Ins粘贴

(c)鼠标左键选中开头的若干字符

​ 按住Shift,同时鼠标左击要复制内容的末尾,此时会选中从开头到左键点击末尾位置的所有内容

​ 然后按ctrl+Ins复制shift+Ins粘贴


tmux内部复制/粘贴文本的通用方式:

(1) 按下Ctrl + a后松开手指,然后按[

(2) 用鼠标左键长按选中文本,被选中的文本会被自动复制到tmux的剪贴板

(3) 按下Ctrl + a后松开手指,然后按],会将剪贴板中的内容粘贴到光标处。

另外,复制整个文件的文本,可以退出tmux来复制,用Linux终端下的方式复制。


top显示的是现在的CPU进程,直接关闭即可,运行top后按一下"h"键,就会出现帮助信息,里面包括你需要操作按键,当然也包括退出
netstat -apn | grep 3306      关闭指定端口号, 3306就是我要关闭的端口号

重启容器后发现ssh连接不上了,尝试了重启云服务器和 newgrp docker 都不行。报错:
“ssh: connect to host ip地址 port 20000: Connection refused”
解决方法--重启服务器


数据库
sudo mysql -uroot -proot

springboot_server是自己租的服务器,spring是在租的服务器上面创建的服务器
Ctrl+shift+Esc 任务管理器快捷键
挂在容器 ctrl+p ctrl+q
sudo mysql service start

package com.kob.botrunningsystem.utils;

import java.util.ArrayList;
import java.util.List;

public class Bot implements com.kob.botrunningsystem.utils.BotInterface {
    static class Cell {
        public int x, y;
        public Cell(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    private boolean check_tail_increasing(int step) {  // 检验当前回合,蛇的长度是否增加
        if (step <= 10) return true;
        return step % 3 == 1;
    }

    public List<Cell> getCells(int sx, int sy, String steps) {
        steps = steps.substring(1, steps.length() - 1);
        List<Cell> res = new ArrayList<>();

        int[] dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};
        int x = sx, y = sy;
        int step = 0;
        res.add(new Cell(x, y));
        for (int i = 0; i < steps.length(); i ++ ) {
            int d = steps.charAt(i) - '0';
            x += dx[d];
            y += dy[d];
            res.add(new Cell(x, y));
            if (!check_tail_increasing( ++ step)) {
                res.remove(0);
            }
        }
        return res;
    }

    @Override
    public Integer nextMove(String input) {
        String[] strs = input.split("#");
        int[][] g = new int[13][14];
        for (int i = 0, k = 0; i < 13; i ++ ) {
            for (int j = 0; j < 14; j ++, k ++ ) {
                if (strs[0].charAt(k) == '1') {
                    g[i][j] = 1;
                }
            }
        }

        int aSx = Integer.parseInt(strs[1]), aSy = Integer.parseInt(strs[2]);
        int bSx = Integer.parseInt(strs[4]), bSy = Integer.parseInt(strs[5]);

        List<Cell> aCells = getCells(aSx, aSy, strs[3]);
        List<Cell> bCells = getCells(bSx, bSy, strs[6]);

        for (Cell c: aCells) g[c.x][c.y] = 1;
        for (Cell c: bCells) g[c.x][c.y] = 1;

        int[] dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};
        for (int i = 0; i < 4; i ++ ) {
            int x = aCells.get(aCells.size() - 1).x + dx[i];
            int y = aCells.get(aCells.size() - 1).y + dy[i];
            if (x >= 0 && x < 13 && y >= 0 && y < 14 && g[x][y] == 0) {
                return i;
            }
        }

        return 0;
    }
}


标签:上线,项目,int,++,strs,复制,steps,aCells
From: https://www.cnblogs.com/spock12138/p/17065283.html

相关文章