Skip to content

Instantly share code, notes, and snippets.

View shui's full-sized avatar

Shui Dujiang shui

View GitHub Profile
@shui
shui / 1.md
Last active April 2, 2018 08:27
openssh-client使登录方式

密码

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no user@host

openssh-client登陆服务器时,默认会依次尝试:

  • GSSAPI-based认证
  • host-based认证
  • public key认证
@shui
shui / 1.md
Last active August 16, 2018 18:50
Ubuntu 16安装XMind 8

安装XMind 8

下载安装包,解压。

删掉setup.sh中安装default-jre的操作(因为配置有JDK)。

XMind8不支持Java 9。

执行setup.sh安装依赖和字体。

@shui
shui / 1.md
Created March 21, 2018 01:28
Shell改变当前目录

方法一

脚本cdDes.sh

#!/bin/bash
cd /des

因为直接执行脚本是在当前shell进程的子进程中执行,所以并不能改变目录。执行的时候使用source在当前进程执行:

source cdDes.sh
@shui
shui / 1.md
Created March 5, 2018 03:24
Linux查找大文件和大目录

挂载/home的磁盘目录扩容了好几次但很快又没可用空间了,很烦。 之后发现是Gitlab自动备份文件堆积成山……

  • 查找大文件
# 查找超过800M大小文件
find . -type f -size +800M
# 查找超过800M大小文件,并显示文件信息
find . -type f -size +800M -print0 | xargs -0 ls -l
# 查找超过800M大小文件,并显示查找出来文件的具体大小
@shui
shui / after-install.md
Last active November 19, 2023 09:45
阿里云ECS安装后……

删除阿里云ECS登录欢迎信息

阿里云镜像修改了欢迎信息:

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-105-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
@shui
shui / install.md
Created January 29, 2018 06:17
Debian Jessie安装最新版Nginx

添加nginx的官方安装源:

# vim /etc/apt/sources.list

然后:

deb https://nginx.org/packages/debian/ jessie nginx
deb-src https://nginx.org/packages/debian/ jessie nginx

然后:

@shui
shui / debian-autostart.md
Created January 29, 2018 06:01
用update-rc.d命令给Debian添加开机启动项

用update-rc.d命令给Debian添加开机启动项 Linux系统设置开机启动有很多方法,网上也有许多详细教程。本文只关注用update-rc.d命令给Debian添加开机启动。

例如:将test.sh脚本添加到开机自启。

1.将test.sh脚本放到/etc/init.d/目录下

cp test.sh /etc/init.d/  
cd /etc/init.d/  
chmod +x test.sh 
@shui
shui / 1.md
Created January 17, 2018 04:53
MySQL用户管理

创建用户:

CREATE USER 'username'@'host' IDENTIFIED BY 'password';

删除用户:

DROP USER 'username'@'host';

授权:

@shui
shui / gist:58c3e5db451b91a63326d2790c2148cd
Last active January 16, 2018 07:59
ubuntu 登录界面屏蔽其他用户

查看用户组

cat /etc/group

查看所有用户

cat /etc/passwd
@shui
shui / Main.java
Created January 9, 2018 01:15
BFS demo
import java.util.LinkedList;
public class Main {
public static void main(String[] args) {
}
boolean bfs(Node start, Node end) {
LinkedList<Node> queue = new LinkedList<>();