0%

启动时加载bat

运行: shell:startup -> startup.vbs

1
2
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "C:\auto_run\startup\start.bat /start",0

命令行工具

windows curl

下载地址:https://curl.haxx.se/windows/

计算文件Hash值:

在Windows中可以通过以下方式:

1
2
3
certutil -hashfile yourfilename MD5
certutil -hashfile yourfilename SHA1
certutil -hashfile yourfilename SHA256

而在Linux下,命令为:

1
2
3
md5sum yourfilename
sha1sum yourfilename
sha256sum yourfilename

windows命令行工具 nircmd

下载地址:http://www.nirsoft.net/utils/nircmd.html

关闭监视器:

1
nircmd.exe monitor off

锁屏:

1
nircmd.exe lockws

截屏:

1
nircmd.exe savescreenshotfull "f:\tmp\shot.png"

设置鼠标在屏幕位置:

1
nircmd.exe setcursor 100 50

按鼠标键:

1
2
3
4
5
6
① sendmouse right click 右键鼠标
② sendmouse left click 左键鼠标
③ sendmouse left dblclick 双击鼠标左键
④ sendmouse left down 按下鼠标左键
⑤ sendmouse left up 松开鼠标左键
⑥ sendmouse middle click

工具集

视频下载工具 annie

https://github.com/iawia002/annie

视频转码工具 FFmpeg

https://www.ffmpeg.org/

比如mp4转mp3: ffmpeg -i xx.mp4 xx.mp3

tcping

https://elifulkerson.com/projects/index.php

nircmd,wake_on_lan,GUIPropView

http://www.nirsoft.net/utils/index.html

网络唤醒wol

https://www.depicus.com/wake-on-lan/wake-on-lan-cmd

设置分辨率 QRes

http://www.softpedia.com/progDownload/QRes-Download-618.html

1
QRes.exe /x:1920 /y:1080

windows开启关闭防火墙

1
2
3
NetSh Advfirewall set allprofiles state off   #关闭防火墙
NetSh Advfirewall set allprofiles state on #开启防火墙
Netsh Advfirewall show allprofiles #查看防火墙状态

在 Windows 10 中启用可匿名访问的共享

就是不用输入用户名和密码,直接通过网上邻居可以访问的共享。

1
2
3
4
5
6
7
1、打开本地组策略编辑器(快捷键Win+R,打开运行,输入gpedit.msc,确定);
2、打开:“本地计算机策略->计算机配置->Windows设置->安全设置->本地策略->用户权限分配”;
3、找到:“拒绝从网络访问这台计算机”,将列表中的“Guest”删除;
4、打开:“本地计算机策略->计算机配置->Windows设置->安全设置->本地策略->安全选项”;
5、找到:“网络访问:本地帐户的共享和安全模型”,改为:“仅来宾 - 对本地用户进行身份验证,其身份为来宾”;
6、找到:“网络访问:将 Everyone 权限应用于匿名用户”,改为:“已启用”;
7、找到:“账户:来宾账户状态”,改为:“已启用”;

注意:如果访问共享文件夹时出现“你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问,这些策略可帮助保护你的电脑免受网络上不安全设备或者恶意设备的威胁” 需要如下操作:

1
2
3
1、打开本地组策略编辑器(快捷键Win+R,打开运行,输入gpedit.msc,确定);
2、在“计算机配置”中找到“管理模板”->“网络”->“Lanman工作站”;
3、在本地策略编辑器的右侧双击“启用不安全的来宾登录”。选择“已启用”,并点击确定,解决问题。

Win10 开机自动登录

方法一:

1
control userpasswords2

方法二:

1
netplwiz

方法三:

1
rundll32 netplwiz.dll,UsersRunDll

方法四:

创建autologin.reg文件,双击导入

1
2
Windows Registry Editor Version 5.00

Win10 右键菜单Intel图形属性删除

管理员权限打开cmd,输入

1
regsvr32 /u igfxDTCM.dll

恢复

1
regsvr32 igfxDTCM.dll

windows 删除进程

查看指定端口的连接信息:

1
netstat -ano  findstr "8080"

查看进程列表:

1
tasklist  findstr "java"

通过上面的方式可以查看占用端口号的进程ID:

1
taskkill -PID 进程号 -F

win10

安装

微软官方下载地址:https://www.microsoft.com/zh-cn/software-download/windows10

激活

序列号

1
2
3
4
5
6
7
8
9
10
Home: TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
Home N: 3KHY7-WNT83-DGQKR-F7HPR-844BM
Home Single Language: 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
Home Country Specific: PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
Professional: W269N-WFGWX-YVC9B-4J6C9-T83GX
Professional N: MH37W-N47XK-V7XM9-C7227-GCQG9
Education: NW6C2-QMPVW-D7KKK-3GKT6-VCFB2
Education N: 2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
Enterprise: NPPR9-FWDCX-D2C8J-H872K-2YT43
Enterprise N: DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4

激活步骤:

1
2
3
slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr /skms kms8.msguides.com
slmgr /ato

win11

安装

微软官方下载地址:https://www.microsoft.com/zh-cn/software-download/windows11

绕过 TPM 2.0 检测

Win11 会提示“该电脑无法运行 Win11”解决办法:

1、注册表大法

在安装界面按 Shift+F10,打开命令行界面,输入 regedit 打开注册表,然后定位到:

HKEY_LOCAL_MACHINE\SYSTEM\Setup

创建一个名为“LabConfig”的项,接着在“LabConfig”下创建两个 DWORD 值:

  • 键为“BypassTPMCheck”,值为“00000001”
  • 键为“BypassSecureBootCheck”,值为“00000001”
  • 键为“BypassRAMCheck”,值为“00000001”

保存退出后,上图的提示就消失了,就可以正常安装 Win11。

2、修改 ISO 镜像

如果想通过直接从 Win11 ISO 镜像运行 setup.exe 程序来升级系统,而非全新安装,还有另一种简单的解决方法。

需要找到 Win10 ISO 的 appraiserres.dll 文件,替换 Win11 ISO 的同名文件。完成后,需要使用第三方工具(如 Rufus 或 AnyBurn)重新创建 ISO 镜像,然后再次运行安装文件。

激活

win11激活工具

https://github.com/zbezj/HEU_KMS_Activator

脚本重连蓝牙耳机

首先去该网站下载:蓝牙命令行管理工具

然后打开命令行,输入

1
btdiscovery -s  # 扫描蓝牙设备,需要等待一会

获取到设备的 DEVICE_ADDRESS 和 SERVICE_UUID

DEVICE_ADDRESS 是蓝牙设备的mac地址

SERVICE_UUID 是设备的服务ID,比如耳麦是1108,免提网关111E

自动重新连接bat脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@echo off

rem The following line is needed only if you haven't added Bluetooth Command Line Tools to system PATH
REM set PATH=C:\Program Files (x86)\Bluetooth Command Line Tools\bin;%PATH%

rem Change the following 2 lines to match your device
set DEVICE_ADDRESS=1C:52:16:58:8F:95
set SERVICE_UUID=1108

rem If your device requires PIN code other than '0000', uncomment and change the following line
set PIN=0000

rem Remove the device. Ignoring possible error here
btpair -u -b"%DEVICE_ADDRESS%"

rem Pair the device
btpair -p%PIN% -b"%DEVICE_ADDRESS%"
if errorlevel 1 goto error

rem Enable the service
REM btcom -c -b"%DEVICE_ADDRESS%" -s%SERVICE_UUID%
REM if errorlevel 1 goto error

goto success

rem Allow user to read error message before window is closed
:error
pause
exit

查看AC电源状态

1
WMIC Path Win32_Battery Get BatteryStatus

操作系统中查看硬件制造商和BIOS版本

1
dxdiag

或者cmd里输入:

1
wmic bios get biosversion

1
wmic bios get SMBIOSBIOSVersion

查看磁盘硬件名称

1
wmic diskdrive get caption

查看内存

查看内存信息

1
wmic memorychip

查看内存硬件厂商

1
wmic memorychip get Manufacturer

利用Windows内置工具测试硬盘速度

测试默认磁盘

1
winsat disk

指定磁盘进行测速

1
winsat disk -drive d 

注:请使用管理员权限打开cmd,否则在win10下面最终测试结果会一闪而过

windows下查看wifi信息

进入cmd输入:

1
netsh wlan show interface

Win7下格式化成 FAT32

右键管理员身份打开cmd

如果你格式化的是E盘

输入format E: /fs:fat32

回车后会提示输入卷标,就是指该分区名称

win8远程连接win10

1.账户前面需跟计算机名,如:计算机名\用户名.

2.win10上,运行gpedit.msc-计算机配置-Windows设置-安全设置-本地策略-安全选项-网络访问:本地账户的共享安全模型

设置成:经典-对本地用户进行身份验证,不改变其本来身份

指定用户访问共享samba

清除用户记录:

1
net use \\192.168.1.1 /del

指定用户登录(需要输入密码)

1
net use \\192.168.1.1 /user:malu

携带密码登录:

1
net use \\192.168.1.1 "password" /user:malu /persistent:yes

查看状态:

1
net use

自动登录脚本:

1
2
3
4
@echo off
net use \\192.168.0.1 /delete
net use \\192.168.0.1 "password" /user:malu /persistent:yes
explorer \\192.168.0.1\

指定DNS

1
2
3
4
5
6
7
@echo off
netsh interface ip set dns name="本地连接" source=dhcp
netsh interface ip set dns name="以太网" source=dhcp
netsh interface ip add dns "以太网" 192.168.11.200
netsh interface ip add dns "本地连接" 192.168.11.200
netsh interface ip add dns "以太网" 61.177.7.1 index=2
netsh interface ip add dns "本地连接" 61.177.7.1 index=2

本文记录nvm、node、npm、yarn安装过程

Windows下安装

nvm-windowns下载 https://github.com/coreybutler/nvm-windows/releases

切换nvm安装源:

在 nvm 的安装路径下,找到 settings.txt,在后面加上这两行

1
2
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

切换npm安装源:

1
npm config set registry https://registry.npm.taobao.org

Linux下安装

官方地址:https://github.com/creationix/nvm

Linux下推荐使用nvm来安装nodejs

安装nvm

1
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh  bash

脚本会自动把以下执行环境写入.bashrc:

1
2
3
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

安装nodejs

1
nvm install 10.8.0

国内使用淘宝node镜像,加速nodejs安装过程:

1
2
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node/
nvm install 10.11.0

或者:

1
NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node/ nvm install 10.11.0

Linux使用淘宝NPM镜像:

编辑 ~/.npmrc,添加

1
registry=https://npm.taobao.org/mirrors/npm/

若不想将本源设置为默认源,只想使用本源安装某个软件包,可在安装包时采用以下用法:

1
npm --registry https://npm.taobao.org/mirrors/npm/ install <packagename>

windows下安装

直接去github下载msi安装包: https://github.com/coreybutler/nvm-windows/releases

windows使用淘宝node镜像:

1
nvm node_mirror https://npm.taobao.org/mirrors/node/

windows使用淘宝npm镜像:

1
nvm npm_mirror https://npm.taobao.org/mirrors/npm/

CNPM

安装方法:

1
npm install -g cnpm --registry=https://registry.npm.taobao.org

YARN

下载地址:https://github.com/yarnpkg/yarn/releases

使用文档:https://yarnpkg.com/zh-Hans/docs

升级自身yarn

1
npm install yarn -g

查看yarn版本

1
yarn -v

Yarn 设置淘宝镜像

1.查询当前配置的镜像

1
2
yarn config get registry

2.设置成淘宝镜像

1
yarn config set registry http://registry.npm.taobao.org/

3.显示当前安装的全局yarn依赖库

1
yarn global list

npm与yarn CLI 命令比较

npm (v5)

Yarn

npm install

yarn install

(不适用)

yarn install –flat

(不适用)

yarn install –har

npm install –no-package-lock

yarn install –no-lockfile

(不适用)

yarn install –pure-lockfile

npm install [package]

yarn add [package]

npm install [package] –save-dev

yarn add [package] –dev

(不适用)

yarn add [package] –peer

npm install [package] –save-optional

yarn add [package] –optional

npm install [package] –save-exact

yarn add [package] –exact

(不适用)

yarn add [package] –tilde

npm install [package] –global

yarn global add [package]

npm update –global

yarn global upgrade

npm rebuild

yarn install –force

npm uninstall [package]

yarn remove [package]

npm cache clean

yarn cache clean [package]

rm -rf node_modules && npm install

yarn upgrade

异常处理: 使用yarn升级vue cli后显示 ‘vue’ 不是内部或外部命令,也不是可运行的程序

解决办法:把yarn的包执行目录添加到系统环境变量里。

处理方式:

1.执行yarn global dir 显示出yarn安装路径

2.定位到Yarn\bin目录,把该路径复制到系统环境变量Path里

nvm使用方法

列出全部可以安装的版本号

1
nvm ls-remote

(windows下为)

1
nvm list available

安装指定版本nodejs

1
nvm install 9.3.0

切换指定版本,切换效果是全局的

1
nvm use v8.0.0

查看当前使用的版本

1
nvm current

查看本地安装版本,这个命令也能看到当前使用的是哪个版本

1
nvm ls --depth 0

清空模块

1
rm -rf node_modules/ && npm cache clean && npm prune

npm的常用命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
npm ci                #使用安装package.lock.json安装,锁定依赖版本

npm -v #显示版本,检查npm 是否正确安装。

npm install express #安装express模块

npm install -g express #全局安装express模块

npm list #列出已安装模块

npm show express #显示模块详情

npm update #升级当前目录下的项目的所有模块

npm update express #升级当前目录下的项目的指定模块

npm update -g express #升级全局安装的express模块

npm uninstall express #删除指定的模块

生成package.json文件

1
node init

其他安装方式 old

快速安装过程:

1
2
3
4
apt-get install -y nodejs npm
npm config set registry http://registry.npm.taobao.org #使用淘宝源
npm install -g n #安装n模块
n stable#升级到nodejs最新稳定版

n后面也可以跟随版本号比如:

1
2
n v0.10.26
n 0.10.26

编译安装:

nodejs下载地址:https://nodejs.org/dist/

1
2
3
4
5
6
wget https://nodejs.org/download/rc/v4.0.0-rc.1/node-v4.0.0-rc.1.tar.gz
tar -zxvf node-v4.0.0-rc.1.tar.gz
cd node-v4.0.0-rc.1
./configure
make && make install
node -v

源码安装:

1
2
3
4
5
6
7
8
9
10
11
12
cd /tmp && \
wget http://nodejs.org/dist/node-latest.tar.gz && \
tar xvzf node-latest.tar.gz && \
rm -f node-latest.tar.gz && \
cd node-v* && \
./configure && \
CXX="g++ -Wno-unused-local-typedefs" make && \
CXX="g++ -Wno-unused-local-typedefs" make install && \
cd /tmp && \
rm -rf /tmp/node-v* && \
npm install -g npm && \
printf '\n# Node.js\nexport PATH="node_modules/.bin:$PATH"' >> /root/.bashrc

ERROR

MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。

解决方法:npm install –global –production windows-build-tools (全局安装windows构建工具)

Module build failed: Error: ENOENT: no such file or directory, scandir node-sass

解决办法:npm rebuild node-sass

首先网络唤醒需要硬件支持,目前大部分主流的板载网卡都支持,只需在bios里开启即可,笔记本中thinkpad全系列都支持,部分品牌的部分型号是不支持的,比如我有2台acer笔记本不支持。(很多时候wol是为了节电考虑,但是电源插座是必须通电的,笔记本也是)

路由器下安装

路由器中有相关插件可以直接进行唤醒,比如OpenWRT提供了wol和etherwake两个包来实现WOL功能

1
2
opkg update
opkg install wol etherwake

使用方法:

1
2
/usr/bin/wol 00:1D:5C:1F:5D:16
/usr/bin/etherwake 00:1D:5C:1F:5D:16

ubuntu下安装:

1
apt-get install wakeonlan

使用方法:

1
wakeonlan 00:1D:5C:1F:5D:16

windows下安装:

下载地址:https://www.depicus.com/downloads/wolcmd.zip

使用方法:

打开cmd,CD到下载wolcmd的文件路径

1
wolcmd [mac address] [ip address] [subnet mask] [port number]

比如:

1
WolCmd.exe 1016932061F0 192.168.0.255 255.255.255.0 80

公网唤醒内网主机

外网进行唤醒,前提是路由器上得设置端口映射,和mac绑定。

原理是这样的:

1.魔术包数据发送到外网地址的映射端口上。

2.由于做了映射,路由器会找到对应的IP地址。

3.IP与对应的mac地址绑定了,所以路由器自然得将数据包发到对应mac地址上。

4.此时数据包已经发到内网待唤醒主机上了,网卡判断数据帧符合唤醒内容,就把机器启动。

公网唤醒工具:http://ip.malu.me/wol/

附录

断电后再通电自动唤醒:在BIOS中电源设置,Restore on AC设置为Last Stste。

运行环境:

线上:RDS(内网)+ECS

本地:xampp

由于本地只能访问ECS,需要在ECS上架设mysql代理:

参考这篇笔记:http://git.malu.me/MySQL-Proxy/

mysql线上与本地实现主从同步

ECS配置(作为主服务器master):

修改配置文件:

1
2
#vim /etc/my.cnf

重启mysql:

1
/etc/init.d/mysql restart

在主服务器上建立帐户mysync并授权给slave主机:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mysql -uroot -h localhost

mysql> GRANT REPLICATION SLAVE ON *.* to 'mysync'@'%' identified by 'passwd';

mysql> show master status; #查看master的状态
+------------------+----------+--------------+------------------+
File Position Binlog_Do_DB Binlog_Ignore_DB
+------------------+----------+--------------+------------------+
mysql-bin.000002 532
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

注:执行完此步骤后不要再操作主服务器MYSQL,防止主服务器状态值Position变化

mysql> show master logs; #查看master二进制日志位置

mysql> show variables like 'server_id'; #查看server_id

本地xampp配置(作为从服务器slave):

修改配置文件:

1
2
X:\Xampp\mysql\bin\my.ini   #xampp默认配置文件

配置Slave:

1
2
3
4
5
6
7
8
mysql> change master to  master_host='mysql.malu.me',master_port=3306,master_user='mysync',master_password='passwd',master_log_file='mysql-bin.000001',master_log_pos=532;

mysql> start slave; #启动从服务器复制功能

注:master_log_pos即为master主机状态里的Position

mysql> show slave status\G #检查slave的状态

接下来往RDS写入数据的时候会自动同步到本地mysql

mysql线上与本地实现主主同步

双主架构需要mysql双方能互相通讯,但是本地mysql在内网,所以必须先让ECS穿透到内网:

内网穿透参考这篇笔记:http://git.malu.me/二级proxy部署/

ECS (作为master-A):

1
2
3
4
5
6
7
8
9
10
11
[mysqld]
log-bin=mysql-bin #开启二进制日志功能
server-id=1 #注意server-id的唯一性
binlog-ignore-db = mysql,information_schema #忽略写入binlog日志的库
relay-log=/app/mysql/relaylogs/relay-bin #指定中继日志路径
log_slave_updates=1 #开启从库更新操作写入二进制日志功能*
auto_increment_increment=2 #双主复制中自增长字段的步长*
auto_increment_offset=1 #双主复制中自增长字段的起始值,主为1 副为2*
sync_binlog = 1 #可保证事务日志及时写入磁盘文件
binlog-do-db = TestXXX #指定binlog日志记录哪个db
slave-skip-errors #定义复制过程中从服务器可以自动跳过错误

本地xampp(作为master-B):

1
2
3
4
5
6
7
8
9
10
11
[mysqld]
log-bin=mysql-bin #开启二进制日志功能
server-id=2 #注意server-id的唯一性
binlog-ignore-db = mysql,information_schema #忽略写入binlog日志的库
relay-log=/app/mysql/relaylogs/relay-bin #指定中继日志路径
log_slave_updates=1 #开启从库更新操作写入二进制日志功能*
auto_increment_increment=2 #双主复制中自增长字段的步长*
auto_increment_offset=2 #双主复制中自增长字段的起始值,主为1 副为2*
sync_binlog = 1 #可保证事务日志及时写入磁盘文件
binlog-do-db = TestXXX #指定binlog日志记录哪个db
slave-skip-errors #定义复制过程中从服务器可以自动跳过错误

ECS执行:

1
2
3
4
5
6
mysql> GRANT REPLICATION SLAVE ON *.* to 'mysync'@'%' identified by 'passwd';
mysql> flush privileges;
mysql> change master to master_host='127.0.0.1',master_port=3307,master_user='mysync',master_password='passwd',master_log_file='mysql-bin.000001',master_log_pos=532;

注:3307为隧道入口

本地xampp执行:

1
2
3
4
5
6
mysql> GRANT REPLICATION SLAVE ON *.* to 'mysync'@'%' identified by 'passwd';
mysql> flush privileges;
mysql> change master to master_host='mysql.malu.me',master_port=3306,master_user='mysync',master_password='passwd',master_log_file='mysql-bin.000001',master_log_pos=532;

mysql> start slave; #启动master-B复制功能

接下来写入数据试试吧!

附录:

mysql主从自动切换脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
cat << README
#####################################################################################################
#Step 1: point the slave IP #
#Step 2: check the master and slave information whether good for change #
#Step 3: stop old slave,then get new master binlog name and postation,then execute change master to #
#Step 4: start slave,and show whether change successed. #
#####################################################################################################
README
User=root
PW=123456
read -p "-- Please input the slave IP:" Slave
Master=$(mysql -u${User} -h${Slave} -p${PW} -e "show slave status \G;"awk '/Master_Host/{print $2}')
if [ -n "${Master}" ]
then
echo -e "--Master IP:${Master},Slave IP:${Slave}"
M=$(mysql -u${User} -h${Master} -p${PW} -e "show master status;"awk 'NR==2{print $2}')
S=$(mysql -u${User} -h${Slave} -p${PW} -e "show slave status \G;"awk '/Read_Master_Log_Pos/{print $2}')
echo -e "-- master pos:${M};slave pos is:${S}"
else
echo "-- Slave IP input wrong,please input again ! "
exit 1
fi
if [ "${M}" -eq "${S}" ]
then
read -p "-- Master-Slave is accordance,input Yes to start changing:" var
case "$var" in
[Yy]es)
mysql -u${User} -h${Slave} -p${PW} -e "stop slave;reset slave;change master to master_host='';"
Pos=$(mysql -u${User} -h${Slave} -p${PW} -e "show master status;"awk 'NR==2{print $2}')
File=$(mysql -u${User} -h${Slave} -p${PW} -e "show master status;"awk 'NR==2{print $1}')
mysql -u${User} -h${Master} -p${PW} -e "stop slave;
change master to master_user='ideal',master_host='${Slave}',master_password='123456',master_log_file='${File}',master_log_pos=${Pos};
start slave;"
;;
*)
echo "-- error input .... exit!"
;;
esac
echo "-- changing, please wait 3s...."
sleep 3
echo "-- change successfull,the new master is:${Slave},new slave is ${Master}"
SlaveIOStatus=$(mysql -u${User} -h${Master} -p${PW} -e "show slave status \G;"awk '/Slave_IO_Running/{print $2}')
SlaveSQLStatus=$(mysql -u${User} -h${Master} -p${PW} -e "show slave status \G;"awk '/Slave_SQL_Running/{print $2}')
printf "The new master is: \n Slave_IO_Running=${SlaveIOStatus}\n"
printf "Slave_SQL_Running=${SlaveSQLStatus}\n"
else
echo "node change failed please change again ! "
exit 1
fi

github.com SSH 加速访问

修改 C:\Users\Dell\.ssh\config 文件,添加如下内容:

1
2
3
4
5
6
7
Host github.com
User git
Port 22
Hostname github.com
IdentityFile "C:/Users/Dell/.ssh/id_ecdsa"
TCPKeepAlive yes
ProxyCommand connect -S 127.0.0.1:7891 -a none %h %p

全局设置 GPG 签名工具

GPG4Win 下载地址:https://www.gpg4win.org/

1
git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe"

列举 GPG Key

1
gpg --list-secret-keys --keyid-format=long

针对 Git Repo 启用 GPG 签名

1
2
git config --local user.signingkey [YOUR GPG KEY]
git config --local commit.gpgsign true

github走proxy

1.首先开启代理,这种方式只支持https方式,ssh不行

2.给全局git-config配置代理

1
git config --global http.https://github.com.proxy socks5://127.0.0.1:50001

3.clone的时候使用proxy

1
git clone https://github.com/xxx.git -c http.proxy=socks5://127.0.0.1:50001

4.取消全局代理

1
git config --global --unset http.https://github.com.proxy

直接用git下载Gist ID内容

1
git clone git@github.com:cc13e0fcf2c348cc126f918e4a3917eb.git

github与七牛云持续集成

七牛云的CDN提供API刷新缓存服务,我们可以使用github的webhooks来触发刷新。

1.首先配置github的hook:

在项目里找到settings->Webhooks

设置:Payload URL 项为我们服务器的地址,然后保存

2.生成token,如下:

1
echo "/v2/tune/refresh" openssl dgst -binary -hmac "用户SK" -sha1 base64  tr + -  tr / _

3.编写服务端脚本,来触发七牛API:

比如我用PHP来触发http://git.malu.me:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
#七牛刷新缓存函数
function refresh_qiniu($path){
$message = exec('curl -X POST -H "Authorization: QBox <用户AK>:<生成的token>" http://fusion.qiniuapi.com/v2/tune/refresh -d \''.json_encode($path).'\' -H \'Content-Type: application/json\' 2>&1');
return $message;
}
$getin = file_get_contents("php://input");
#追加写入日志
file_put_contents('file.log',$getin, FILE_APPENDLOCK_EX);
$getinarr = json_decode($getin);
$getinarr = $getinarr->commits[0];
$path = array();
#添加文章
if(!empty($getinarr->added) !empty($getinarr->removed)){
echo '刷page:';
$path['urls']=array('http://git.malu.me','http://git.malu.me/index.html');
$path['dirs']=array('http://git.malu.me/page/*');
echo refresh_qiniu($path);
}
#修改文章
if(!empty($getinarr->modified)){
echo '刷url:';
foreach($getinarr->modified as $key=>$value){
//echo $value;
#匹配出文章名
if(preg_match('/-\d\d-\d\d-(.*?)\.md/is', $value, $out)){
//var_dump($out);
echo $out[1];
#对中文编码
$renewurl = 'http://git.malu.me/'.urlencode($out[1]).'/';
$path['urls']=array($renewurl);
echo refresh_qiniu($path);
}
}
}

七牛对象存储301跳转

1
qrsctl redirect <Bucket> <Key> <RedirectUrl> [<RedirectCode>]

记录日常使用到的脚本

Git切换开关

cat git-proxy

1
2
3
4
5
6
#!/bin/bash
if [[ $1 == "no" ]];then
git config --global --unset https.proxy
else
git config --global https.proxy socks5://192.168.2.2:10808
fi

放入/usr/local/bin/git-proxy

1
2
git-proxy     #开启代理
git-proxy no #关闭代理

本地hosts模拟实现DNS轮询脚本

cat auto_change_hosts.sh

1
2
3
4
#!/bin/bash
MY_PATH=$(cd "$(dirname "$0")"; pwd)
cd $MY_PATH

cat iplist

1
2
3
4
5
11.5.100.20010
11.5.100.20100
11.5.200.20200
11.5.200.20300
11.5.300.20400

cat /etc/hosts

1
11.5.100.200 malu.me

使用方法:

1
auto_change_hosts.sh [error]

如果加参数error,则iplist最后一列数值会累加,用于调用次数统计。

创建低权限用户脚本

首先添加用户boy并修改sshd_config文件

1
2
useradd boy
passwd boy

如果遇到无法找到/bin/sh的提示,则修改/etc/passwd文件中boy的shell

1
把 /bin/sh 改成 /bin/bash

vim /etc/ssh/sshd_config

1
2
Match User boy
ChrootDirectory /home/test

cat create_low_user.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
CHROOT_PATH='/home/test'
mkdir -p ${CHROOT_PATH}/dev/
cd ${CHROOT_PATH}/dev/
mknod -m 666 null c 1 3
mknod -m 666 tty c 5 0
mknod -m 666 zero c 1 5
mknod -m 666 random c 1 8

chown root:root ${CHROOT_PATH}
chmod 0755 ${CHROOT_PATH}
ls -ld ${CHROOT_PATH}

mkdir -p ${CHROOT_PATH}/bin
cp -v /bin/bash ${CHROOT_PATH}/bin/

ldd /bin/bash
mkdir -p ${CHROOT_PATH}/lib64
cp -v /lib64/ld-linux-x86-64.so.2 ${CHROOT_PATH}/lib64/
mkdir -p ${CHROOT_PATH}/lib/x86_64-linux-gnu/
cp -v /lib/x86_64-linux-gnu/{libtinfo.so.5,libdl.so.2,libc.so.6} ${CHROOT_PATH}/lib/x86_64-linux-gnu/

把本地文件夹备份至远程服务器

1.通过scp拷贝目录

1
2
3
#!/bin/bash
dd=`date '+%Y-%m-%d-%H%M%S'`
scp -i /root/.ssh/id_rsa -P 22 -r /local root@malu.me:/backup/${dd}

2.拷贝目录至windows共享 (如果有防火墙,需允许445, 135, 137, 138, 139 UDP和TCP)

1
2
3
#!/bin/bash
dd=`date '+%Y-%m-%d-%H%M%S'`
smbclient -c "mkdir ${dd};prompt OFF;recurse ON;lcd /local;cd ${dd};mput *" //IP/share -U username%password

切换到当前目录执行脚本

1
2
3
#!/bin/bash
MY_PATH=$(cd "$(dirname "$0")"; pwd)
cd $MY_PATH

防止脚本重复执行(每次只有一个脚本在执行)

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
function run_only_one(){
PID=$$
snum=`ps -efgrep $0grep -v grepgrep -v " $PPID "grep -v " $PID "wc -l`
if [ $snum -lt 1 ]; then
echo "start process....."
else
echo "runing....."
exit
fi
}
run_only_one

scp拷贝最近3天日期命名的tar.z文件,并删除本地6天前的tar.z文件

1
2
3
4
5
6
7
8
#!/bin/bash
for((i=0;i<=3;i++)); do
datefile=`date -d"$i day ago" +%Y%m%d`.tar.z
if [ ! -f "$datefile" ]; then
scp malu.me:/backup/$datefile /home/backup/
fi
done
find ./ -mtime +6 -type f -name "*.tar.z"xargs rm -f

合并指定目录下的所有文本,并去除重复行,并过滤^M字符 (生成超级字典)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
if [ $# != 1 ] ; then
echo "USAGE: $0 FLODER"
exit 1;
fi
root_dir=$1
NEWFILE=newfile_dic.txt
NEWFILE_TMP=newfile_dic.txt.tmp
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
function getdir(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
echo -n $dir_or_file
cat $dir_or_file sed 's/^M//g'>> $NEWFILE_TMP
echo ' ok'
fi
done
}
getdir $root_dir
IFS=$SAVEIFS
sort $NEWFILE_TMPuniq > $NEWFILE
rm -f $NEWFILE_TMP

注意:^M的输入方式是 Ctrl + v ,然后Ctrl + m

杀死进程及其所有子进程

1
pstree -p PID  grep -oP '(?<=\()[0-9]+(?=\))'xargs kill -9

杀死包含关键字的进程,及其所有子进程

1
2
3
4
5
6
#!/bin/bash
PID=`ps -efgrep [n]ameawk '{print $2}'`
expr 1 + $PID > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
pstree -p $PID grep -oP '(?<=\()[0-9]+(?=\))'xargs kill -9
fi

将目录下所有文件名改成小写

1
for i in `find ./`;do mv $i `echo $i tr [A-Z] [a-z]`;done

防御CC攻击脚本

1
2
3
4
5
6
7
8
9
10
#!/bin/sh
status=`netstat -naawk '$5 ~ /[0-9]+:[0-9]+/ {print $5}' awk -F ":" -- '{print $1}' sort -nuniq -c sort -ntail -n 1`
NUM=`echo $statusawk '{print $1}'`
IP=`echo $statusawk '{print $2}'`
result=`echo "$NUM > 150" bc`
if [ $result = 1 ]
then
echo IP:$IP is over $NUM, BAN IT!
/sbin/iptables -I INPUT -s $IP -j DROP
fi

向进程发送按键指令

其实用C写的,算不上脚本。需要先编译:

gcc key.c -o key.bin

运行:

./key.bin PID cmd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <sys/ioctl.h>
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>

void stackchar(int fd,char c)
{
if (ioctl(fd, TIOCSTI, &c) < 0) {
perror("ioctl");
exit(1);
}
}

int main(int argc, char *argv[])
{
int i, j;
char c;
char proc_file[20];
int mixer_fd=0;

strcpy(proc_file,"/proc/");
strcat(proc_file,argv[1]);
strcat(proc_file,"/fd/1");

if ((mixer_fd = open(proc_file,O_WRONLY))){
for (i = 2; i < argc; i++) {
if (i > 1) stackchar(mixer_fd,' ');
for (j=0; (c = argv[i][j]); j++) {
stackchar(mixer_fd,c);
}
}
}

向本地监听的所有匹配端口发送curl请求

1
netstat -lnt4pgrep sshdgrep -v ':22 'awk -F '0.0.0.0:' '{print $2}'awk '{print $1}'xargs -t -i curl localhost:{}

生产力工具集

https://u.tools/

Windows 子系统

直接安装WSL2

适用于之前没有安装过WSL

1.如果之前没有用过 WSL,那么首先需要为Linux启用Windows子系统:

1
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2.安装 WSL2 之前,必须启用“虚拟机平台”可选功能

1
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

重新启动计算机以完成WSL安装并更新到 WSL2

3.安装适用于 x64 计算机的 WSL2 Linux 内核更新包

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

4.完成之后,以管理员身份运行 PowerShell,执行如下命令来设置wsl使用的默认版本

1
wsl --set-default-version 2

这里我们将默认设置为 WSL2

5.接下来通过访问 Microsoft Store 来安装分发版 https://aka.ms/wslstore

6.查看 WSL 版本

1
wsl -l -v

Win 10下开启Windows子系统WSL

1.程序和功能 - 启动或关闭Windows功能 - 适用于Linux的Windows子系统 勾选后确定,重启系统。

2.打开cmd,输入bash回车,提示访问一个网址,使用浏览器访问,

重定向到应用商店,然后可以获取需要的Linux子系统,比如Ubuntu

3.阿里云官方镜像站:https://developer.aliyun.com/mirror/

从WSL 1切换到WSL 2

WSL 2相比WSL 1有着更完整的虚拟环境,而且一些数据库比如mongodb在WSL 1下默认是无法使用的,所以果断升级:

升级步骤参考微软官方文档:https://docs.microsoft.com/zh-cn/windows/wsl/install-win10

升级过程需要注意2点:

1.使用power shell 管理员权限执行命名。

2.如果WSL 1已经有Linux环境,升级后要重启电脑。

windows ubuntu子系统设置默认root用户

1
ubuntu config --default-user root

WSL2 固定IP

在Windows 10中,以管理员权限运行CMD或Powershell,然后执行以下两个命令:

1.在Ubuntu中添加IP地址192.168.50.2,名为eth0:1

1
wsl -d Ubuntu -u root ip addr add 192.168.50.2/24 broadcast 192.168.50.255 dev eth0 label eth0:1

2.在Win10中添加IP地址192.168.50.1

1
netsh interface ip add address "vEthernet (WSL)" 192.168.50.1 255.255.255.0

将来,访问Ubuntu时将使用192.168.50.2,访问Win10时将使用192.168.50.1。 您可以将上述两行命令另存为.bat文件,然后将其放入引导区,并使其每次自动执行。

Windows Terminal

您可以从Microsoft Store安装Windows Terminal:https://aka.ms/terminal

官方文档:https://docs.microsoft.com/en-us/windows/terminal/

快速打开:运行 wt

快速启动ssh:wt -w 0 new-tab cmd /k ssh root@172.16.2.223

设置-打开JSON文件 settings.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// This file was initially generated by Windows Terminal Preview 1.5.3242.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",

"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",

// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings

// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,

// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,

// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl"
},
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},

// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [],

// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": "closeTab", "keys": "ctrl+w" },
{ "command": "newTab", "keys": "ctrl+t" },
{ "command": "scrollUpPage", "keys": "alt+pageup" },
{ "command": "scrollUpPage", "keys": "shift+pageup" },
{ "command": "scrollDownPage", "keys": "alt+pagedown" },
{ "command": "scrollDownPage", "keys": "shift+pagedown" },
{ "command": { "action": "switchToTab", "index": 0 }, "keys": "ctrl+1" },
{ "command": { "action": "switchToTab", "index": 1 }, "keys": "ctrl+2" },
{ "command": { "action": "switchToTab", "index": 2 }, "keys": "ctrl+3" },
{ "command": { "action": "switchToTab", "index": 3 }, "keys": "ctrl+4" },
{ "command": { "action": "switchToTab", "index": 4 }, "keys": "ctrl+5" },
{ "command": { "action": "switchToTab", "index": 5 }, "keys": "ctrl+6" },
{ "command": { "action": "switchToTab", "index": 6 }, "keys": "ctrl+7" },
{ "command": { "action": "switchToTab", "index": 7 }, "keys": "ctrl+8" },
{ "command": { "action": "switchToTab", "index": 8 }, "keys": "ctrl+9" },
{ "command": { "action": "switchToTab", "index": 0 }, "keys": "alt+1" },
{ "command": { "action": "switchToTab", "index": 1 }, "keys": "alt+2" },
{ "command": { "action": "switchToTab", "index": 2 }, "keys": "alt+3" },
{ "command": { "action": "switchToTab", "index": 3 }, "keys": "alt+4" },
{ "command": { "action": "switchToTab", "index": 4 }, "keys": "alt+5" },
{ "command": { "action": "switchToTab", "index": 5 }, "keys": "alt+6" },
{ "command": { "action": "switchToTab", "index": 6 }, "keys": "alt+7" },
{ "command": { "action": "switchToTab", "index": 7 }, "keys": "alt+8" },
{ "command": { "action": "switchToTab", "index": 8 }, "keys": "alt+9" },
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },

// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },

Windows SVN

https://tortoisesvn.net/downloads.zh.html

Windows GIT

https://tortoisegit.org/

接口调试工具

postman

https://www.postman.com/downloads/

PostmanCanary

https://www.postman.com/downloads/canary/

insomnia

https://insomnia.rest/download/

ApiPost

https://www.apipost.cn/download.html

Git bash

https://git-scm.com/download/win

配置

默认打开路径

修改文件:C:\Program Files\PortableGit\etc\profile

在底部加入

1
2
3
# set Project Path
proj="你的项目文件目录"
cd $proj

加入Alias

进入 C:\Users\username目录

添加3个文件(.bash_profile,.bashrc,git-prompt.sh):

.bash_profile

1
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

.bashrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
alias s='screen -d -R'
alias mp='git commit -am "autopush" && git push'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

alias ls='ls -hFG'
alias l='ls -lFah'
alias ll='ls -alF'
alias lt='ls -ltrF'
alias ll='ls -alF'
alias lls='ls -alSrF'
alias llt='ls -altrF'

alias tarc='tar cvf'
alias tarcz='tar czvf'
alias tarx='tar xvf'
alias tarxz='tar xvzf'

alias g='git'
alias less='less -R'
alias os='lsb_release -a'
alias vi='vim'

# Colorize directory listing
alias ls="ls -ph --color=auto"

# Colorize grep
alias grep="grep --color=auto"

# Shell
export CLICOLOR="1"
if [ -f "$HOME/git-prompt.sh" ]; then
source $HOME/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE="1"
export PS1="\[\033[40m\]\[\033[34m\][ \[\033[36m\]\w\$(__git_ps1 \" \[\033[35m\]{\[\033[32m\]%s\[\033[35m\]}\")\[\033[34m\] ]$\[\033[0m\] "
# export PS1="\[\033[40m\]\[\033[34m\][ \u@\H:\[\033[36m\]\w\$(__git_ps1 \" \[\033[35m\]{\[\033[32m\]%s\[\033[35m\]}\")\[\033[34m\] ]$\[\033[0m\] "
else
export PS1="\[\033[40m\]\[\033[34m\][ \[\033[36m\]\w\[\033[34m\] ]$\[\033[0m\] "
# export PS1="\[\033[40m\]\[\033[34m\][ \u@\H:\[\033[36m\]\w\[\033[34m\] ]$\[\033[0m\] "
fi

下载 git-prompt.sh

执行bat

git-bash下执行RUN.bat

1
cmd /cRUN.bat

编辑器

Markdown编辑器

Typora

https://www.typora.io/

Typora Beta 0.11.18 下载地址:

markdownpad

http://markdownpad.com/

Email:

Soar360@live.com

License Key:

GBPduHjWfJU1mZqcPM3BikjYKF6xKhlKIys3i1MU2eJHqWGImDHzWdD6xhMNLGVpbP2M5SN6bnxn2kSE8qHqNY5QaaRxmO3YSMHxlv2EYpjdwLcPwfeTG7kUdnhKE0vVy4RidP6Y2wZ0q74f47fzsZo45JE2hfQBFi2O9Jldjp1mW8HUpTtLA2a5/sQytXJUQl/QKO0jUQY4pa5CCx20sV1ClOTZtAGngSOJtIOFXK599sBr5aIEFyH0K7H4BoNMiiDMnxt1rD8Vb/ikJdhGMMQr0R4B+L3nWU97eaVPTRKfWGDE8/eAgKzpGwrQQoDh+nzX1xoVQ8NAuH+s4UcSeQ==

VScode

下载:https://code.visualstudio.com/Download

同步配置

文件 - 首选项 - 设置同步 (可使用live账户)

插件

css压缩插件css-minify

https://marketplace.visualstudio.com/items?itemName=DiegoMolina.css-minify

终端下使用的字体(等宽字体)

https://github.com/abertsch/Menlo-for-Powerline

右键使用vscode打开.reg

1
2
3
4
5
6
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\VSCode]
@="VSCode"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe"

EmEditor

超大文件编辑器

https://www.rjsos.com/archives/emurasoft19.html

浏览器

Chrome

Chrome:

注意下载地址长期不变,但下到的始终是当前最新的Stable版。

32位:直接下载

64位:直接下载

Chrome Canary:

64位直接下载

Chrome Dev:

64位直接下载

Chrome Stable for Linux

64位

https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

chrome代理插件:https://github.com/FelisCatus/SwitchyOmega/releases

FireFox

下载地址:

https://www.mozilla.org/en-US/firefox/all/

Opera

Opera浏览器桌面版历史版本下载

http://get.opera.com/ftp/pub/opera/desktop/

http://get.geo.opera.com/pub/opera/desktop/

Vmware

Vmware Workstation Pro 下载 15-14

https://my.vmware.com/group/vmware/info?slug=desktop_end_user_computing/vmware_workstation_pro/15_0

1
2
3
4
5
6
激活许可证
UY758-0RXEQ-M81WP-8ZM7Z-Y3HDA
VF750-4MX5Q-488DQ-9WZE9-ZY2D6
UU54R-FVD91-488PP-7NNGC-ZFAX6
YC74H-FGF92-081VZ-R5QNG-P6RY4
YC34H-6WWDK-085MQ-JYPNX-NZRA2

Vmware Workstation Pro 历史版本下载 12-9

https://my.vmware.com/group/vmware/info/slug/desktop_end_user_computing/vmware_workstation_pro/12_0

清理VMware.bat

1
2
3
4
5
6
net stop VMwareHostd
net stop VMAuthdService
net stop VMnetDHCP
net stop VMUSBArbService
net stop "VMware NAT Service"
taskkill /F /im vmware-tray.exe

远程桌面

RustDesk

http://rustdesk.com/

VNC

VNC Server

VNC Viewer

TeamViewer

https://www.teamviewer.cn/cn/download/windows/

向日葵

https://sunlogin.oray.com/download/

ToDesk

https://www.todesk.com/download.html

清理远程.bat

1
2
3
4
5
6
7
8
sc stop "SunloginService"
sc stop "ToDesk_Service"
sc stop "teamviewer"
sc stop "vncserver"
taskkill /F /im SunloginClient.exe
taskkill /F /im todesk_service.exe
taskkill /F /im todesk.exe
REM start "" "C:\Program Files\RealVNC\VNC Server\vncserver.exe" -service -stop

启动远程.bat

1
2
3
4
sc start "SunloginService"
sc start "ToDesk_Service"
sc start "teamviewer"
sc start "vncserver"

虚拟组网

蒲公英 https://pgy.oray.com/download/

zerotier https://zerotier.com/download/

Win10启动时候加载bat

运行: shell:startup -> startup.vbs

1
2
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "C:\auto_run\startup\start.bat /start",0

Beyond Compare

http://www.ucbug.com/soft/40421.html

安装说明:https://www.rjsos.com/archives/beyondcompare4.html

Adobe Photoshop CS6

http://xiazai.zol.com.cn/detail/15/146785.shtml

补丁 (将 amtlib 覆盖掉相应软件的源文件) http://xiazai.zol.com.cn/detail/45/440347.shtml

Adobe Premiere Pro 2020

https://www.rjsos.com/archives/premiere2020.html

Everything

Windows桌面搜索引擎 (快速搜索文件工具)

https://www.voidtools.com

思维导图

XMind

https://www.xmind.cn/download/ 破解1 破解2

MindMaster

https://www.edrawsoft.cn/mindmaster/ 破解

Virtual Audio Cable

混音软件,可实现多音频设备同时输出

https://software.muzychenko.net/eng/vacselect.htm

翻译

https://appdownload.deepl.com/windows/full/DeepLSetup.exe

Hyper

https://hyper.is/

安装主题

1
hyper i hyper-material-theme

配置文件路径:C:\Users\malu\AppData\Roaming\Hyper.hyper.js

1
2
3
shell: 'C:\\Program Files\\PortableGit\\bin\\bash.exe',
...
plugins: ["hyper-material-theme"],

SQL

Windows Redis

https://github.com/microsoftarchive/redis/releases

Redis 分析工具客户端

https://redislabs.com/redisinsight/

PowerDesigner v16.5

http://onlinedown.rbread04.cn/huajunsafe/powerdesigner1029.zip

ODBC for MySQL

(注意powerdesigner是用java32位的,所以ODBC也下32位

https://dev.mysql.com/downloads/connector/odbc/

BIOS

bios修改工具mmtool https://softradar.com/static/products/mmtool/distr/0/mmtool_softradar-com.zip

win10适配修改器 http://www.angusj.com/resourcehacker

也可以直接下修改好的mmtool http://www.smxdiy.com/thread-1995-1-1.html

技嘉B85主板BIOS https://www.gigabyte.com/tw/Motherboard/GA-B85-HD3-A-rev-10/support#support-dl-bios

B85芯片组主板也能用上NvmeSSD https://zhuanlan.zhihu.com/p/40367807

其他

https://www.rjsos.com/

linux nslookup安装

1
apt install dnsutils

DNSmasq安装

1
apt install dnsmasq

使用本地hosts做解析

小方转存SAMBA技巧

1.使用一台开有samba匿名共享的服务器

2.建立匿名目录TDDOWNLOAD

3.把手机里的网关指向该服务器

4.进入小方转存即可

使用 useradd 命令创建 SSH 用户:

1
useradd boy

也可以用高级交互式命名创建用户

1
adduser boy

根据提示一步步操作

使用 mknod 命令创建 /dev 下的文件。在下面的命令中,-m 标志用来指定文件权限位,c 意思是字符文件,两个数字分别是文件指向的主要号和次要号。

1
2
3
4
5
6
mkdir -p /home/test/dev/      
cd /home/test/dev/
mknod -m 666 null c 1 3
mknod -m 666 tty c 5 0
mknod -m 666 zero c 1 5
mknod -m 666 random c 1 8

对于交互式会话,这需要至少一个 shell,通常为 sh 和基本的 /dev 节点,例如 null、zero、stdin、stdout、stderr 和 tty 设备:

1
ls -l /dev/{null,zero,stdin,stdout,stderr,random,tty}

在 chroot 中设置合适的权限。注意 chroot 和它的子目录以及子文件必须被 root 用户所有,并且对普通用户或用户组不可写:

1
2
3
chown root:root /home/test
chmod 0755 /home/test
ls -ld /home/test

为 SSH chroot 设置交互式 shell,创建 bin 目录并复制 /bin/bash 到 bin 中:

1
2
mkdir -p /home/test/bin
cp -v /bin/bash /home/test/bin/

识别 bash 所需的共享库,如下所示复制它们到 lib64 和 lib 中

1
2
3
4
5
ldd /bin/bash
mkdir -p /home/test/lib64
cp -v /lib64/ld-linux-x86-64.so.2 /home/test/lib64/
mkdir -p /home/test/lib/x86_64-linux-gnu/
cp -v /lib/x86_64-linux-gnu/{libtinfo.so.5,libdl.so.2,libc.so.6} /home/test/lib/x86_64-linux-gnu/

创建 chroot 通用配置目录 /home/test/etc 并复制已更新的账号文件(/etc/passwd 和 /etc/group)到这个目录中:

1
2
mkdir /home/test/etc
cp -vf /etc/{passwd,group} /home/test/etc/

注意:每次向系统添加更多 SSH 用户时,都需要将更新的帐户文件复制到 /home/test/etc 目录中。

配置 SSH 来使用 chroot

打开 sshd_config 文件

1
vim /etc/ssh/sshd_config

文件中添加或修改下面这些行

1
2
3
4
# 定义要使用 chroot 的用户
Match User boy
# 指定 chroot
ChrootDirectory /home/test

重启sshd

1
2
systemctl restart sshd 或者

参考文章

https://linux.cn/article-8313-1.html

相关脚本

创建低权限用户脚本

给用户sudo权限

方法一:

修改/etc/sudoers文件,添加 “malu ALL=(ALL) ALL”

方法二:

先查看sudo组ID

cat /etc/group grep sudo

把用户加入sudo组

usermod -G 27 malu

方法三:

直接编辑/etc/group,在sudo组后面添加malu用户,多个用户用逗号”,”分割