2020年7月3日
在尝试了几个windows的终端后,还是觉得windows terminal最好用。
windows terminal 链接 https://github.com/microsoft/terminal
defaultProfile填写配置对应的guid就可以设置默认配置。所有的配置在profiles中。
安装好git之后,windows可以使用bash了。
{ "acrylicOpacity" : 0.9, "closeOnExit" : true, "colorScheme" : "Solarized Light", "commandline" : "C:\\Program Files\\Git\\bin\\bash.exe", "cursorColor" : "#1100fc", "cursorShape" : "bar", "fontFace" : "Consolas", "fontSize" : 12, "guid" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "historySize" : 9001, "icon" : "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico", "name" : "bash", "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "%USERPROFILE%", "useAcrylic" : true } ……
阅读全文
2020年6月5日
expect可以帮助我们 自动化完成一些交互操作。
使用expect来执行ssh命令
编写脚本 #!/usr/bin/expect #sshlogin.exp set timeout 30 set host "192.168.1.8" set username "your_username" set password "yout_password" spawn ssh $username@$host #expect "*password:*" {send "$password\r"} expect { "*password:" {send "$password\r"} } interact 给脚本权限
chmod 755 运行脚本
./sshlogin.exp 使用一行命令直接运行
expect -c 'spawn ssh {{username}}@{{host}}; expect "*password:*"; send "{{password}}\r"; interact' references:
https://en.wikipedia.org/wiki/Expect
https://stackoverflow.com/questions/3149367/how-to-get-expect-c-to-work-in-single-line-rather-than-script……
阅读全文
2020年6月2日
到戴尔官网下载驱动 https://www.dell.com/support/home/en-us/drivers/driversdetails?driverid=6wgwy
下载autohotkey https://www.autohotkey.com/
新建脚本
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ^F11:: Run, "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe" /1:SetActiveInput DP1 Return ^F12:: Run, "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe" /1:SetActiveInput HDMI Return /斜杠后面的数字是显示器的序号,有的情况下不能成功切换显示器,把后面参数1替换成2就可以了,目前不清楚序号的规律。……
阅读全文
2020年6月1日
安装
sudo apt-get install tmux 启动tmux
tmux 命令
tmux ls #查看到当前在运行的所有tmux sessions会话 tmux attach #进入上次退出的会话 tmux attach -t {{number}} #进入会话 tmux new -s <session-name> #新建会话 tmux kill-session -t {{number}} #结束会话 常用快捷键
先输入ctrl-b 然后用下面按键执行操作
d 离开会话,会话会运行在后台……
阅读全文
2020年3月13日
修改公网机器的配置
修改sshd_config vim /etc/ssh/sshd_config #GatewayPorts no => GatewayPorts yes #重启ssh服务 sudo /etc/init.d/ssh stop root@localhost:~# sudo /etc/init.d/ssh start 内网机器端口转发(假设内网的机器端口80要转发到公网机器的9091端口上)
ssh -NR 9091:0.0.0.0:80 root@remote_ip ……
阅读全文
2019年9月2日
安装uWSGI https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
apt-get install build-essential python3-dev pip3 install uwsgi 使用uWSGI 运行 运行uwsgi,假设有run.py并且使用python3 run.py可以运行项目
uwsgi --socket 0.0.0.0:5000 --protocol=http -w run:app 配置文件 创建uwsgi.ini
[uwsgi] module = run:app master = true processes = 5 http = 0.0.0.0:5000 使用配置文件运行
uwsgi --ini uwsgi.ini 如果要使用nginx,应该使用socket
[uwsgi] module = run:app master = true processes = 5 socket = /tmp/flask.sock chmod-socket = 666 chdir = {path} logto = {path} 添加一个服务 使用systemd
systemd 文件的路径在 /etc/systemd/system
创建一个文件uwsgiproject.service
[Unit] Description=uWSGI instance to serve myproject After=network.……
阅读全文
2019年9月2日
添加一个文件cf.conf,里面记录的是允许访问的ip
# https://www.cloudflare.com/ips # IPv4 allow 173.245.48.0/20; allow 103.21.244.0/22; allow 103.22.200.0/22; allow 103.31.4.0/22; allow 141.101.64.0/18; allow 108.162.192.0/18; allow 190.93.240.0/20; allow 188.114.96.0/20; allow 197.234.240.0/22; allow 198.41.128.0/17; allow 162.158.0.0/15; allow 104.16.0.0/12; allow 172.64.0.0/13; allow 131.0.72.0/22; # IPv6 allow 2400:cb00::/32; allow 2606:4700::/32; allow 2803:f800::/32; allow 2405:b500::/32; allow 2405:8100::/32; allow 2a06:98c0::/29; allow 2c0f:f248::/32; 修改 /etc/nginx/sites-available/default中的内容,添加include cf.conf和deny all
location / { include /etc/nginx/cf.conf; deny all; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404.……
阅读全文
2019年8月28日
angular中使用matSort对表格进行排序
https://material.angular.io/components/sort/overview
<ng-container matColumnDef="start_at"> <th mat-header-cell *matHeaderCellDef mat-sort-header class="table-header"> start time </th> <td mat-cell *matCellDef="let appointment"> {{appointment.start_at|date:'yyyy-MM-dd HH:mm'}} </td> </ng-container> ''' matColumnDef="start_at"和appointment.start_at|date:'yyyy-MM-dd HH:mm'中的start_at这个变量名称要相同,不然会出现已经使用了mat-sort-header出现了箭头,点击确没有反应的情况 ……
阅读全文
2019年8月26日
查看端口占用 lsof -i:{port}
netstat -anp|grep {port}
终止进程 kill -9 {PID}……
阅读全文
2019年8月20日
https://github.com/HappyZ/dpt-tools/wiki/The-Ultimate-Rooting-Guide
测试连接是否成功 python3 dpt-tools.py
=========== DPT Tools =========== Thanks for using DPT Tools. Type `help` to show this message. Supported commands: fw -- update firmware diagnosis -- enter diagnosis mode (to gain adb, su, etc.) exit/quit -- leave the tool [info] Please make sure you have charged your battery before this action. >>> Please enter the pkg file path: /Users/huweilun/FILES/test/sonydpt获取root权限/dpt-tools/fw_updater_packer_by_shankerzhiwu/pkg_example/hack_basics/fw.pkg >>> Pleae confirm /Users/huweilun/FILES/test/sonydpt获取root权限/dpt-tools/fw_updater_packer_by_shankerzhiwu/pkg_example/hack_basics/fw.pkg is the pkg file to use [yes/no]: yes >>> 获取adb权限……
阅读全文