Open bGZo opened 2 years ago
win+r
-> mspaint
前者是表情包, 后者是备忘. 之前一直混着用😭
(also ymmv) written abbreviation for your mileage may vary: used, for example on social media and in text messages and emails, to mean that you understand people may have a different opinion or experience to yours: Their first album is better, but of course YMMV.
看不懂的迷幻操作
cmd
的 python
默认指向微软商店
Fuck Windows Defend => fuck Antimalware Service Executable
# administrator mode
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /d 1 /t REG_DWORD /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /d 0 /t REG_DWORD /f
# via: https://answers.microsoft.com/zh-hans/windows/forum/all/%E5%A6%82%E4%BD%95%E5%BD%BB%E5%BA%95%E5%85%B3/f71fbc7f-9604-4493-a6b1-6c907664dc83
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware
# via: https://www.thewindowsclub.com/virus-threat-protection-is-managed-by-your-organization
之前我移除过到期的 Onedrive 账号, 因为图方便就直接把东西挪到回收站了, 但是今天发现里面部分的缓存是删不掉的. 位置在C:\$Recycle.Bin\S-1-5-21-3804606499-716401209-922194820-1001\$R0Y1A2M\xxxx
, 附带报错代码0x8007016A
. 这就导致了一个死循环
PE
进系统, 因为还是找不到这个文件夹, 就直接把C:\$Recycle.Bin
这个文件夹也删掉了. 系统好像会自动生成? 开机自启动居然只需要添加快捷方式到 Shell:common startup
/Shell:startup
就可以. via: https://answers.microsoft.com/en-us/windows/forum/all/autostart-a-program-in-windows-10/940682ae-8872-47ce-964d-8b1e820d9a5a
昨天类似的翻译的项目找了很久也没有找到, 不限于已经停更或关站的
当然这也看得出还是活跃在Github比较好, 起码项目不做了, 记录都还留着, 服务器一清理了什么都没了; 而且貌似技术社区中掘金还算好的? 淦噢😂
痛点
[前者] 我觉得这是基本的道德良心吧,毕竟DC口插三孔插座有接地,typeC往往是插二孔插座就没接地了. via: https://www.zhihu.com/question/381287746/answer/1637537271
这里今天翻到一个电脑牌子推荐的帖子, 回复如下:
DELL - 入门商务 Vostro ,进阶 Inspiron ,高级 Latitude ,顶级 XPS/Precision
联想 - 入门 Yoga/ThinkBook/Thinkpad L14 ,进阶 Thinkpad T14/T14s ,高级 T15p ,顶级 Thinkpad X1 Carbon / X1 Extreme / P1 / P15 / P17
HP - 入门 Pavilion ,进阶 Probook/Zhan66 ,高级 EliteBook ,顶级 ZBook / ZBook Studio / ZBook via: https://www.v2ex.com/t/830186#87
笔电要在合盖实现开机可以说是有点难了, Thinkpad 拓展坞自带电源键, 或是其他品牌自带解决方案
小白用户(自己)能做的已经算是很少了...
[插电唤醒] Restore after AC Power Loss
, 笔电精简了 BIOS, 没有这个选项...
[网络唤醒] WOL
, wake on lan
, 只限于有线网线.
[芯片飞线] 难度拉满, 从引脚飞线出来一个按键(EC芯片). via: https://www.zhihu.com/question/53771647/answer/1566583028
[ ] 所以暂时无解...
也不是小气, 只是发现自己的 star 已经失去控制了, 太广泛了, 有的可能已经不再需要了, 但是再筛自己需要的又太多太难了, 简直是大海捞针, 索性全取消从头来过. 专注自己真正用到的几个仓库才是王道, 把精力放在刀刃上...
当然一开始想自己写的, 抓包发现发送的居然是 post
, 而不是 delete
有点意外, 当然被 REST 思想弄得有点魔怔了. post
在 https
下似乎更加安全..
然后发现自己开启了 Authy
二部验证真的 py
不知道怎么实现, 放弃了, 发现 GithubAPI
取关居然是 delete
请求, 真的是不怎么理解啊😂
最后发现了 npm 得 user-unstar, 问题解决...
via:
安装哈希校验失败, 但是搜 issue 发现版本已经落后作者更新的 json
了, 执行安装该版本发现还是可以安装的...
因为 scoop 依赖 git, 所以我之前翻过对应的 repo, 可能不小心修改过文件, 都会让 git pull
不下来仓库信息, 所以放弃更改就行了. 具体为以下报错信息
# error: Your local changes to the following files would be overwritten by merge:
# /xxxx/xxxx.json
git reset --hard
git pull
scoop config proxy 127.0.0.1:7890
scoop config aria2-enabled false
一度认为 TeamViewer
是最优解, 但是今天发现国区也需要绑定 +86
的手机号... 之后发现手机号绑到另一个号上了, 得嘞, 上另外一个号, excuse me??? You have no switches left??? 合着我这辈子就只能在这个账户下用两台设备是吗??? 官方也没个回复, 嫖不到服务, delete account, 走了...
笑死, 挂了 SG 的节点, todesk 不让注册了(表现为那个滑块纹丝不动), tmd, 也是必须绑定 +86
手机号, 然后发现 V2-安全漏洞 的帖子, 啼笑皆非.
最终确定了 VNC Viewer
(从 这里 拿到了专业版试用) & Windows Remote Desktop
两个软件, 但是前者无法传输 Audio 后者无法跨平台使用都挺操蛋的. 唯一都不识别的键位就是 win
了, 需要单独调出虚拟键盘拿到, 有点繁琐.
两个软件的差别现在列举如下
走完一遍下来基本感觉稳在 50-60
之间了,反正比之前30帧舒服得多。
gpedit.msc
-> 计算机配置->管理模板->Windows组件->远程桌面服务->远程桌面会话主机->远程会话环境
-> enable 硬件图形适配器应用于所有远程桌面服务会话
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations
-> DWORD (32位)
-> DWMFRAMEINTERVAL
-> 15
(十进制)via https://blog.csdn.net/csdn_life18/article/details/108250846 & https://v2ex.com/t/746154
注意不要用 UDP 代替 TCP, 连接有时会断得很离谱. via: https://www.v2ex.com/t/507173 & https://www.nextofwindows.com/troubleshoot-and-improve-rdp-connections-with-udp
如下我叙述的那样,将远程路由变成中继
静态路由, 设置遇到另一个网段的地址, 直接转发到目的网段的路由器处理,此处类似转发的操作无需端口转发,直接用静态路由去做。
Lan To Lan, 实现网络的拓展,本质还是中继(PS:Wan To Lan 的路由器连接方法需要关闭 Lan 入口路由器的 DHCP功能,并设置网关为 Wan 出口路由 IP)
via: wikihow & https://zhuanlan.zhihu.com/p/85129768 & https://www.zhihu.com/question/26598324
更多链接:
今天发现没办法用远程桌面了, 才意识到去年搬家网络链路也变了(之前我电脑做服务器是直接连接交换机的, 现在电脑已经成了三级设备), 虽然知道网络层已经把两个网络独立开了, 还是傻逼般折腾了好一会儿, 换局域网的 IP, 用小米路由的转口转发什么的, 都不成. 中途关了 DHCP 直接连后台都进不去了, 最后还是走的重置路由. 真🐶.
所以现在要么是复现当时的链路连接方法, 要么另寻他法, 因为自己没有找到合适的解决方案. 而且官方路由无法单独设置子网掩码, 永远是255.255.255.0
, 所以产生了要刷路由固件的想法.
个人买路由器是在 2006 的时候, 所以固件版本为 1.0.14-stable
也不用折腾去降级了, 直接跟着 B站视频 做, 一个小时连拆带刷, 再带探索, 一气呵成, 最后实现了也就是 对指定 IP(设备) 科学上网 和 去广告这两个馋了我好久的功能了...
大概流程也就是像它那个 脑图 那样.
firewall
, via: 火绒怎么完全退出? - 知乎windows
开启 telnet
winpcap
C:\WINDOWS\system32\npf.sys
的错, 问题不大, 因该是权限问题, 复写完了大小也一样..telnet 192.168.31.1
&& cd /tmp&&wget http://192.168.31.177:8081/busybox&&chmod a+x ./busybox&&./busybox telnetd -l /bin/sh
&& telnet 192.168.31.1
&& cd /tmp
&& wget http://192.168.31.177:8081/breed-mt7621-xiaomi-r3g.bin&&nvram set uart_en=1&&nvram set bootdelay=5&&nvram set flag_try_sys1_failed=1&&nvram commit
&& mtd -r write breed-mt7621-xiaomi-r3g.bin Bootloader
reset
后开机直到闪烁进入 不死 breed
, 最后在里面刷上老毛子的固件, 版本当然还是2019年, 但是暂时够用了, nice.另外 安山的旧蓝奏的链接一般都是 lanzous.com
, 用的时候全换成 lanzoux.com
就能用了
家里还有台之后买的 ac2100
, 回头有机会也一并刷上去吧
突然发现小米路由器有中继功能, 什么都不用设置, 直接在网络连接里开启中继, 本来想着用 lan to lan
+ DHCP
, 没想到小米直接可以, 太棒了. 最后后台变成了 192.168.2.164
. 在考虑 IP 冲突的问题 这样不会冲突吧
固件差别 (via: https://www.right.com.cn/forum/thread-4009551-1-1.html)
中继、无线桥接、级联、HyFi、AP/AC (via: https://service.tp-link.com.cn/detail_article_458.html)
SSID (Service Set Identifier): 无线名称
RSSI (Received Signal Strength Indicator): 接收信号的强度指示,在反向通道基带接收滤波器之后进行的
因为刷固件的时候把火绒卸载了, 现在就出现了另一个问题,我不想装回去了。
task manager
/startup
.C:\Windows\System32\Drivers\etc\hosts
Traffic Monitor
git submodule add https://github.com/yyy/xxx.git
[submodule "xxx"]
path = xxx
url = git@github.com:yyy/xxx.git
git filter-branch --force --index-filter \
'git rm -r --cached --ignore-unmatch public/photos' \
--prune-empty --tag-name-filter cat -- --all
echo public/photos >> .gitignore
git add .gitignore && git commit -m "ignore rule for photos"
git push origin branch -f
// via: https://stackoverflow.com/questions/25458306/git-rm-fatal-pathspec-did-not-match-any-files
git rm readme
Git log Corrupt
# via: https://stackoverflow.com/questions/11706215/
error: object file .git/objects/c1/1f7a16a52bc71a318650710c1fa1e82e72a2ce is empty
fatal: loose object 1f7a16a52bc71a318650710c1fa1e82e72a2ce (stored in .git/objects/c1/1f7a16a52bc71a318650710c1fa1e82e72a2ce) is corrupt
Well, above methods maybe helpful, yet I need the simplest way... While my repo has serveal submodules so when I move dir .git
to origin, it throws error fatal: Not a git repository
.
# backup your old repo, seriously!!!
# via: https://stackoverflow.com/questions/41718822/
$ git clone git@github.com:user/repo.git
$ git submodule update --init --recursive
So my fool method is to git clone origin repo and submodule and move the old repo to my new repo. Also it will throws error mv: Directory not empty
. Then, just
# via: https://stackoverflow.com/questions/29135986/
$ cp -R source/* destination/
$ rm -R source/
git rebase
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
git log --all --decorate --oneline --graph
via: git log - Pretty Git branch graphs - Stack Overflow
- [git rebase 成功之后如何撤销_AndyCheng_hgcc的博客-CSDN博客_git rebase 回退](https://blog.csdn.net/chengde6896383/article/details/83418488 )
git reflog
> The reflog is strictly local and isn’t part of the repository. It’s also not included in pushes, fetches, or clones.
The most significant distinction between git reflog and log is that the log is a public record of the repository’s commit history, whereas the reflog is private. After a push, fetch or pull, the git log is duplicated as part of the git repository. The git reflog, on the other hand, is not included.
via: [How to use git reflog - reflog vs. log - Blog | GitProtect.io](https://gitprotect.io/blog/how-to-use-git-reflog-reflog-vs-log/ )
- `git rebase` 会刷新此刻时间线往后的所有 Commit, 因为 Git 中, `author (the person who wrote the code)` & `committer (the person who committed it to the repository)` 是分离的, 在 Github 上显示的就是前者;
more via: [What does "authored 7 days ago; committed 14 hours ago" mean on GitHub? - Web Applications Stack Exchange](https://webapps.stackexchange.com/questions/70383/what-does-authored-7-days-ago-committed-14-hours-ago-mean-on-github )
[git rebase,看这一篇就够了 - 掘金](https://juejin.cn/post/6969101234338791432 )
[Git 更安全的强制推送,--force-with-lease - walterlv](https://blog.walterlv.com/post/safe-push-using-force-with-lease.html )
[Git合并那些事——神奇的Rebase - 晴耕小筑](https://morningspace.github.io/tech/git-merge-stories-6/ )
---
git show -20
/ git show hash-value
more via: git查看历史记录及修改内容_AlbertS的博客-CSDN博客_git查看文件修改记录类 github 表格 CSS.
/* via: typora github theme */
table {
padding: 0;
word-break: initial;
border-collapse: collapse;
}
table tr {
border: 1px solid #dfe2e5;
margin: 0;
padding: 0;
}
table tr:nth-child(2n),
thead {
background-color: #f8f8f8;
}
table th {
background:#bec1c4;
font-weight: bold;
border: 1px solid #dfe2e5;
border-bottom: 0;
margin: 0;
padding: 6px 13px;
}
table td {
border: 1px solid #dfe2e5;
margin: 0;
padding: 6px 13px;
}
table th:first-child,
table td:first-child {
margin-top: 0;
}
table th:last-child,
table td:last-child {
margin-bottom: 0;
}
tr:nth-child(n):hover td {
background:#D7C4BB;
}
目录 Css
/* via: sspai.com */
.contents{
font-size: 16px;
overflow: auto;
max-height: 400px;
max-width: 300px;
border: 1px solid #a2a9b1;
background-color: #f8f9fa;
padding: 10px;
}
.contents>ul{
list-style: none;
margin-left: -20px;
}
via: https://www.youtube.com/watch?v=riWyEKS4d-M
using android feature via https://android-developers.googleblog.com/2019/04/improving-app-performance-with-art.html
腾讯会议 在 win7虚拟机 下绘制图形失败, 必须重启电脑
就算是开启3d加速, 显卡拉到 256M 还是收效甚微. 所以打算换个系统 win11.
配置的时候记得开启如下选项
系统
-> 主板
-> 内存4G
& 启用EFI
系统
-> 处理器
-> 处理器数4
& 启用PAE/NX
显示
-> 屏幕
-> 硬件加速
& 256M
进去系统在安装前 shief+F10
打开 cmd
敲 regedit
在 HKEY_LOCAL_MACHINE\SYSTEM\Setup
下新建一个 LabConfig
的 key
, 其下新建 BypassTPMCheck
, BypassRAMCheck
, BypassSecureBootCheck
三个 DWORD (32位) 值,赋值均为 1. 骗过校验之后就能直接安装了.
之后发现还是很卡, 在 系统
-> 硬件加速
-> Hype-V
(win) / KVM
(linux) 会有所好转. Mac 则有 PD备胎 可选
而且硬件居然显示的不是 SSD, 而是HDD. 暂时不知道要怎么做....
I'm sorry that I couldn't found any related from offical wiki and other site. The only I found helpful site is unavailable now(via https://www.isitdownrightnow.com/ttrss.info.html).
And I found some shortcuts by myself except arrow keys and j
/k
/n
(j = previous category. · k = next category. · n = next unread article). 😂
Shortcuts | Mean |
---|---|
Shift + q |
Mark All Readed. |
o |
Open Origin Url in new tab |
space |
Scroll |
netsh interface ip show address "WLAN" | findstr "IP Address" | Select-String -Pattern '([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*)' | %{ $_.matches.Value }
via: networking - How to get network ip address via windows command prompt? - Super User
After I learn some usage of windows command line, It's weird that man xxx
/Get-Help xxx
useless than xxx ?
, like following:
PS C:\Users\15517> man netsh
NAME
Netsh-Lan
SYNTAX
Netsh-Lan
PARAMETERS
None
INPUTS
None
OUTPUTS
System.Object
ALIASES
None
REMARKS
None
PS C:\Users\15517> netsh ?
Usage: C:\windows\system32\netsh.exe [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]UserName] [-p Password | *]
[Command | -f ScriptFile]
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a list of entries.
advfirewall - Changes to the `netsh advfirewall' context.
branchcache - Changes to the `netsh branchcache' context.
bridge - Changes to the `netsh bridge' context.
delete - Deletes a configuration entry from a list of entries.
dhcpclient - Changes to the `netsh dhcpclient' context.
dnsclient - Changes to the `netsh dnsclient' context.
dump - Displays a configuration script.
exec - Runs a script file.
firewall - Changes to the `netsh firewall' context.
help - Displays a list of commands.
http - Changes to the `netsh http' context.
interface - Changes to the `netsh interface' context.
ipsec - Changes to the `netsh ipsec' context.
lan - Changes to the `netsh lan' context.
mbn - Changes to the `netsh mbn' context.
namespace - Changes to the `netsh namespace' context.
netio - Changes to the `netsh netio' context.
p2p - Changes to the `netsh p2p' context.
ras - Changes to the `netsh ras' context.
rpc - Changes to the `netsh rpc' context.
set - Updates configuration settings.
show - Displays information.
trace - Changes to the `netsh trace' context.
wcn - Changes to the `netsh wcn' context.
wfp - Changes to the `netsh wfp' context.
winhttp - Changes to the `netsh winhttp' context.
winsock - Changes to the `netsh winsock' context.
wlan - Changes to the `netsh wlan' context.
The following sub-contexts are available:
advfirewall branchcache bridge dhcpclient dnsclient firewall http interface ipsec lan mbn namespace netio p2p ras rpc trace wcn wfp winhttp winsock wlan
To view help for a command, type the command, followed by a space, and then
type ?.
她有没有曾为我做些什么 为什么总是要我去做她做不来的事情 自己去做不就好了 不要什么事情都找我 很烦
我不想听别人的废话 太费我的精力了
一点点的东西就把我的精力打散了 好无奈
怎么破除这样脆弱的状态
果然应该为明天做更加具体的计划吗
当然计划应该有剩余
via: https://www.youtube.com/watch?v=Oe40pxcjPpM
wget --mirror --page-requisites --convert-link --no-clobber --no-parent --domains (root-domain) (url you want)
Using pip-date · PyPI make sure what you want to uninstall.
pip freeze > requirements.txt
pip uninstall -r requirements.txt [-y]
python -m site
pip install -r requirements.txt -t .
#pip.ini
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
proxy = <proxy:port>
http_proxy = xxx
https_proxy = xxx
# pipfile
[[source]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
ArrayList
常规
// 1
ArrayList<T> obj = new ArrayList<T>();
obj.add("o1");
obj.add("o2");
// 2
ArrayList<T> obj = new ArrayList<T>();
List list = Arrays.asList("o1","o2",...);
obj.addAll(list);
ArrayList<T> obj = new ArrayList<T>() {{
add(Object o1);
add(Object o2);
...
...
}};
ArrayList<Type> obj = new ArrayList<Type>(Arrays.asList(Object o1, Object o2, Object o3, ....so on));
ArrayList<T> obj = new ArrayList<T>(Collections.nCopies(count,element));//把element复制count次填入ArrayList中
// 1. basic
Collections.sort(list);
// 2. user based
class classname implements Comparable<classname>{}
// 3. 匿名内部类
Collections.sort(list, new Comparator<User>() {
@Override
public int compare(User u1, User u2) {
int diff = u1.getAge() - u2.getAge();
if (diff > 0) {
return 1;
}else if (diff < 0) {
return -1;
}
return 0; //相等为0
}
}); // 按年龄排序
// 4.
list.sort(Comparator.comparing(User::getAge));
set
)
String[] myArray = new String[list.size()];
list.toArray(myArray);
Array
int[] x;// 1
int x[];// 2
int []x;// 3
int[] array=new int[]{10,20,30,40,50};
int[] array=new int[50];
- to list
```java
List<String> list = new ArrayList<String>(Arrays.asList(myArray));
Set<String>set = new HashSet<>(Arrays.asList(arr));
// via: https://stackoverflow.com/questions/1073919
// Stream on Java 8+
int[] ints = {1,2,3};
List<Integer> list = Arrays.stream(ints).boxed().collect(Collectors.toList());
// Stream on Java 16+
List<Integer> list = Arrays.stream(ints).boxed().toList();
// Manual
List<Integer> intList = new ArrayList<Integer>(ints.length);
for (int i : ints)
intList.add(i);
HashMap 五种遍历方式
class Solution {
public List<Integer> findDuplicates(int[] nums) {
HashMap<Integer, Integer> lg = new HashMap<>();
for (int i: nums){
lg.put(i, lg.getOrDefault(i, 0)+1);
}
List<Integer> ans = new LinkedList<>();
//// 1. forEach lg.forEach((k, v) -> { if(v > 1) ans.add(k); }); //2. Iterator Iterator it = lg.entrySet().iterator(); while(it.hasNext()){ Map.Entry <Integer, Integer> ele = (Map.Entry) it.next(); if(ele.getValue()>1) ans.add(ele.getKey()); } //3.Map.Entry for(Map.Entry <Integer, Integer> ele : lg.entrySet()){ // Map.Entry ele : lg.entrySet() if(ele.getValue()>1) ans.add(ele.getKey()); } //4.map.keySet() for (Integer key : lg.keySet()) { if(lg.get(key)>1) ans.add(key); } //5.keySet() + Array Object key[] = lg.keySet().toArray(); // incompatible types: Object[] cannot be converted to Integer[] int len = key.length; for(int i = 0; i<len ; i++){ if( lg.get(key[i]) > 1 ) ans.add((int)key[i]); // ... }
return ans;
}
### convert an integer to binary
Integer.toBinaryString(int i)
via: How to convert an integer to binary in Java
String.format()
method. Then, replace spaces with 0s using the String.replaceAll(String str, String replacement)
String.format("%32s", binaryString).replaceAll(" ", "0");
StringBuffer sb = new StringBuffer();
for (int i = 0; i< binaryString.length(); i++ ) {
sb.append(binaryString.charAt(i));
if (i%4 == 3 && i != binaryString.length() - 1)
sb.append(separator);
}
chown -R mysql:mysql /var/lib/mysql/
mysqld --initialize
sudo service mysql start # systemctl start mysqld
sudo mysqladmin -u root
mysql -u (username) -p
mysql> show global variables like 'port';
grant all privileges on *.* to 'user'@'localhost' [identified by 'pass'];
flush privileges;
CREATE DATABASE database_name;
USE database_name;
UPDATE mysql.user SET authentication_string=PASSWORD('password') WHERE User='root' --ssl-mode=required; #error
sudo mysqladmin -u root -p password #successful
8.0.26
& mysql-connector-java version: 5.1.37
冲突; 和 8.0.25
就可以via: MySQL :: MySQL Connector/J 5.1 Developer Guide :: 2 Connector/J Versions, and the MySQL and Java Versions They Require | Connector/J version | JDBC version | MySQL Server version | JRE Required | JDK Required for Compilation | Status |
---|---|---|---|---|---|---|
5.1 | 3.0, 4.0, 4.1, 4.2 | 5.61, 5.71, 8.01 | JRE 5 or higher1 | JDK 5.0 AND JDK 8.0 or higher2, 3 | General availability | |
8.0 | 4.2 | 5.6, 5.7, 8.0 | JRE 8 or higher | JDK 8.0 or higher2 | General availability. Recommended version. |
Establishing SSL connection without server's identity verification is not recommended
, seem like appear since mysql 8.0. via: MySQL :: MySQL 8.0 Reference Manual :: 6.3.1 Configuring MySQL to Use Encrypted Connections, so just use following via:
jdbc:mysql://localhost:3306/Peoples?verifyServerCertificate=false&useSSL=true
sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcat
sudo apt update && sudo apt install default-jdk
cd /tmp
wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.20/bin/apache-tomcat-10.0.20.tar.gz
sudo tar xzvf apache-tomcat-10*tar.gz -C /opt/tomcat --strip-components=1
sudo chown -R tomcat:tomcat /opt/tomcat/
sudo chmod -R u+x /opt/tomcat/bin
sudo vim /opt/tomcat/conf/tomcat-users.xml
# set user password
sudo vim /opt/tomcat/webapps/manager/META-INF/context.xml
# remove the restriction for the Manager page, open its config file for editing
# <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
sudo vim /opt/tomcat/webapps/host-manager/META-INF/context.xml
#like above
sudo nano /etc/systemd/system/tomcat.service
[Unit]
Description=Tomcat
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=$JAVA_HOME" #here config!!!
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
sudo /opt/tomcat/bin/startup.sh
It's not supported at the moment, I've submitted a request at https://youtrack.jetbrains.com/issue/IDEA-265214.
Tomcat >=10, servlet from javax to jakarta
Apache Tomcat 9 and 10 are equivalent products. The only difference is support for changes for the package names in the Jakarta Servlet and related technologies from javax. to jakarta.. via: How to update Apache Tomcat Embed from 9.0.35 to 10.0.4 in Java application - Stack Overflow
$ sudo apt-get install openjdk-8-jdk
$ sudo apt install default-jdk # 11
$ readlink -f $(which java)
# /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
$export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# /usr/lib/jvm/java-11-openjdk-amd64
servlet-api.jar
file in your classpath.servlet-api.jar
from the folder lib
at (THIS IS IMPORTANT:) the container where you're deploying your application (in my case, apache-tomcat-8.5.31):JSP 自动刷新
<!-- 1 content=”5″ 是时间控制,表示每隔5秒刷新一次页面 -->
<meta http-equiv=”refresh” content=”5″>
<!-- 2 -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*" %>
<html>
<head>
<title>自动刷新实例</title>
</head>
<body>
<h2>自动刷新实</h2>
<%
// 设置每隔5秒刷新一次
response.setIntHeader("Refresh", 5);
// 获取当前时间
Calendar calendar = new GregorianCalendar();
String am_pm;
int hour = calendar.get(Calendar.HOUR);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
if(calendar.get(Calendar.AM_PM) == 0)
am_pm = "AM";
else
am_pm = "PM";
String CT = hour+":"+ minute +":"+ second +" "+ am_pm;
out.println("当前时间为: " + CT + "\n");
%>
</body>
</html>
<!-- via: https://www.runoob.com/jsp/jsp-auto-refresh.html-->
<meta http-equiv=”refresh” content=”1;url=index.jsp”>
<!-- ontent=”1 是时间控制,表示1秒后自动跳转到要跳转的页面.
content=”0 表示打开该页后立即跳转到你要跳转的页面 -->
<div id="divUser">
Welcome ${FirstName} ${LastName}
</div>
File
-> Project Structure...
.<pluginManagement>
<plugins>
<plugin><!-- don't pack the war -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<phase>none</phase>
</execution>
<execution>
<id>war-exploded</id>
<phase>package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
chmod 755 -R apache-tomcat-<>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope></dependency>
<dependency>
pom.xml
:MySQL 5.6, 5.7, 8.x
and Java >= 8
use;
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.25</version>
</dependency>
MySQL <= 5.5
or Java <= 7
or JDBC < 4.2
use;
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
via: 廖雪峰
项目需要
src
目录存放Java源码,resources
目录存放配置文件,bin
目录存放编译生成的.class
文件需要的是一个标准化的Java项目管理和构建工具
a-maven-project # 根目录, 项目名
├── pom.xml # 项目描述文件
├── src
│ ├── main
│ │ ├── java # Java源码
│ │ └── resources # 资源文件
│ └── test
│ ├── java # 测试源码
│ └── resources
└── target # 所有编译、打包生成的文件
pom.xml
的内容
<project ...>
<modelVersion>4.0.0</modelVersion>
<groupId>com.itranswarp.learnjava</groupId>
<artifactId>hello</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
...
</properties>
<dependencies>
<dependency>
<groupId>commons-logging</groupId> <!-- Java的包名, 公司或组织名称 -->
<artifactId>commons-logging</artifactId> <!-- Java的类名,通常是项目名称 -->
<version>1.2</version>
</dependency>
</dependencies>
</project>
标准化的构建流程(编译,测试,打包,发布……);
mvn + phase
default: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy package ...package compile ...compile clean pre-clean, clean, post-clean
frequestly clean compile, clean test, clean package
- 插件
- maven-shade-plugin:打包所有依赖包并生成可执行jar;
- cobertura-maven-plugin:生成单元测试覆盖率报告;
- findbugs-maven-plugin:对Java源码进行静态分析以找出潜在问题。
- 模块管理
single-project ├── pom.xml └── src
mutiple-project ├── module-a │ ├── pom.xml │ └── src ├── module-b │ ├── pom.xml │ └── src └── module-c ├── pom.xml └── src
- 模块可以提取出共同部分作为`parent`
multiple-project ├── pom.xml ├── parent │ └── pom.xml ├── module-a │ ├── pom.xml │ └── src ├── module-b │ ├── pom.xml │ └── src └── module-c ├── pom.xml └── src
无需研究依赖之间的依赖关系; Maven 中央仓库 . | scope | 说明 | 示例 |
---|---|---|---|
compile | 编译时需要用到该jar包(默认) | commons-logging | |
test | 编译Test时需要用到该jar包 | junit | |
runtime | 编译时不需要,但运行时需要用到 | mysql | |
provided | 编译时需要用到,但运行时由JDK或某个服务器提供 | servlet-api |
.m2
目录, 创建 settings.xml
配置文件
<settings>
<mirrors>
<mirror>
<id>aliyun</id>
<name>aliyun</name>
<mirrorOf>central</mirrorOf>
<!-- 国内推荐阿里云的Maven镜像 -->
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
</mirrors>
</settings>
Docker 部署 TTRSS, 端口转发和防火墙
$ sudo docker-compose --env .env up -d
--env
is environment each we deploy. mainly to replace ${HTTP_PROXY}
in docker-compose.yml
environment:
...
.env
file like this, each I open the terminal proxy I will refreah this file using zsh. (cause wsl2's Ip is not fixed.
$ cat .env
HTTP_PROXY=172.27.176.1:7890
$ docker-compose down
$ docker-compose rm # 删除已停止的 Docker 容器 ???
$ docker-compose up -d
Feature(via: mircosoft) | WSL 1 | WSL 2 |
---|---|---|
Integration between Windows and Linux | ✅ | ✅ |
Fast boot times | ✅ | ✅ |
Small resource foot print compared to traditional Virtual Machines | ✅ | ✅ |
Runs with current versions of VMware and VirtualBox | ✅ | ✅ |
Managed VM | ❌ | ✅ |
Full Linux Kernel | ❌ | ✅ |
Full system call compatibility | ❌ | ✅ |
Performance across OS file systems | ✅ | ❌ |
BTW,
SELF_URL_PATH
is really hard. when I not realize the problem is wsl network, I search it on google as much as I can. (Hundreds of tabs). Route DNS Hijacking/domain DNS in cloudflare. At most is addingdefine('_SKIP_SELF_URL_PATH_CHECK',true)
toconfig.php
, via: offical. But appearly they are not the same problem, of course I failed. Haha, hard really... till i found LAN could work well from v2ex.# on wsl $ ip addr show eth0 # get v4ip likely: 192.168.97.228/20 -> 192.168.97.228, then switch windows ps $ sudo netsh interface portproxy add v4tov4 listenport=4040 listenaddress=0.0.0.0 connectport=4040 connectaddress=192.168.97.228 protocol=tcp # or -> sudo netsh interface portproxy add v4tov4 listenport=4040 listenaddress=* connectport=4040 connectaddress=192.168.97.228 protocol=tcp # check what you set $ netsh interface portproxy show all
firewall & network protection
-> advanced settings
-> inbound rules
-> new rules
: port
-> TCP&&4040
-> defalut
... :w !clip.exe
win10 GUI
sudo apt install -y tasksel
sudo tasksel install xubuntu-desktop
sudo apt install gtk2-engines
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
- Win10 Config: `“Multiple Windows” -> “Start no client” -> “Disable access control”`
- [ ] memory using seem okay, from `500M` -> `1100M` ->`900M`, 🤣seem enough debug programming...
what if using win11?
- So After Import Env in Jetbrains Idea, java Swing works well.
- via: https://blog.meathill.com/tools/install-wsl2-on-windows-10-and-config-gui-for-applications.html & https://www.shogan.co.uk/how-tos/wsl2-gui-x-server-using-vcxsrv/
This script requires Node v12.14.0 or higher, but you are using v10.19.0
sudo apt update -y
, I do not find the choose to upgrade my low version nodejs. So I try Microsoft Doc to do. That works well. 😁curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm ls # check
nvm install --lts
jpegoptim --stdout a.jpg > b.jpg
cat a.jpg | jpegoptim --stdin > b.jpg
//via: https://github.com/tjko/jpegoptim/issues/14
# open administer power
powercfg.exe /hibernate on
Power Option (Battery Plan) -> Choose what the power button do -> Change settings that are currently unavailable -> Hibernate.
via: https://adersaytech.com/kb-article/enable-hibernate-mode.html
alt-shift-{1..9}
: move focused window to workspace {1..9} | 移动窗口到工作台alt-{1..9}
: switch to workspace {1..9} | 换当前工作区
alt-{wer}
: focus monitor {123}alt-t
: toggle tiling for focused window | 释放控制窗口alt-h/alt-l
: shrink/expand primary area | 左右调整窗口alt-shift-j
: swap focus and next window | 专注下一窗口alt-shief-e
check_hostname requires server_hostname
Raindrop.io — All-in-one bookmark manager
javascript: (() => {document.getElementById('rdhs').innerHTML = '.rdhnav:before,mark[data-rdhid]{background:var(--rdhc,#fe0)!important}mark[data-rdhid]{background-image:linear-gradient(180deg,hsla(0,0%,100%,.7) 0,hsla(0,0%,100%,.7))!important;color:#000!important;-webkit-text-fill-color:#000!important;cursor:pointer!important}.rdhni{display:inline!important;padding:0!important;border:0!important;color:inherit!important;opacity:.5!important;fill:currentColor!important;background:transparent!important;border-radius:0!important;margin:0 .3em!important;width:.85em!important;height:.85em!important}.rdhnav{position:fixed!important;right:0!important;padding:10px 6px 10px 10px!important;cursor:pointer!important}.rdhnav:before{content:""!important;display:block!important;width:10px!important;height:10px!important;border-radius:10px!important;box-shadow:0 0 0 .5px ButtonShadow,0 5px 30px rgb(0 0 0/30%)!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,.2) 0,hsla(0,0%,100%,.2))!important}.rdhnav:hover:before{background-image:linear-gradient(180deg,hsla(0,0%,100%,.5) 0,hsla(0,0%,100%,.5))!important}.rdhnav:active{filter:brightness(50%)!important}';})();
[ ] Script: Raindrop 用的 mark[data-rdhid]
, js 选中了 mark
也没用, 不知道为什么里面的 style>user-select
为什么是空, 没有定义.
mark = document.getElementsByTagName('mark');
for(var i=0;i<mark[i].length;i++){
mark[i].style.removeProperty('-webkit-user-select');
mark[i].style.removeProperty('user-select');
}
for(var i=0;i<mark[i].length;i++){
mark[i].style.setProperty('-webkit-user-select', 'text !important');
mark[i].style.setProperty(('user-select', 'text !important');
}
全部都无效, 然后又尝试了 parentNode.removeChild
也还是不行, Chrome Extension 又会再次把 CSS 注入进来.
也尝试用 Stylish, 但是应该是 css 加载顺序的问题, 总是不生效...
Add a Back2Top Button
//... also with tampermonkey beta
(function() {
'use strict';
var newHTML=document.createElement ('div');
newHTML.innerHTML='<style>#kotori{position:fixed;bottom:-10px;left:-10px;height:70px;width:70px;cursor:pointer;transition:.2s all;display:block;z-index:100}#kotori:hover{transform:translate(10px,-10px)}</style><img id="kotori" src="https://s1.ax1x.com/2022/05/11/OUqj3D.png" onclick="smoothscroll()">';
document.body.appendChild (newHTML);
var scriptElem = document.createElement('script');
scriptElem.innerHTML = 'window.addEventListener("scroll",handleScroll);function handleScroll(){var scollTop=document.documentElement.scrollTop||document.body.scrollTop;var clientHeight=document.documentElement.clientHeight;if(scollTop>=clientHeight){document.querySelector("#kotori").style.display="block"}else{document.querySelector("#kotori").style.display="none"}}function smoothscroll(){var currentScrollTop=document.documentElement.scrollTop||document.body.scrollTop;if(currentScrollTop>0){window.requestAnimationFrame(smoothscroll);window.scrollTo(0,currentScrollTop-currentScrollTop/10)}};';
document.body.appendChild(scriptElem);
var code = 'window.addEventListener("scroll",handleScroll);function handleScroll(){var scollTop=document.documentElement.scrollTop||document.body.scrollTop;var clientHeight=document.documentElement.clientHeight;if(scollTop>=clientHeight){document.querySelector("#kotori").style.display="block"}else{document.querySelector("#kotori").style.display="none"}}function smoothscroll(){var currentScrollTop=document.documentElement.scrollTop||document.body.scrollTop;if(currentScrollTop>0){window.requestAnimationFrame(smoothscroll);window.scrollTo(0,currentScrollTop-currentScrollTop/10)}};';
eval(code);
let script_tag = GM_addScript('alert("works!");');
})();
// more details via: https://github.com/Tampermonkey/tampermonkey/issues/296
javascript: (() => { let i = 0; var times = prompt("Input how many times to scroll?"); if (times == ""){ times = 1000; } function scrollDownTillEnd(countryDropdownList) { let scrollingInterval = setInterval(function () { window.scrollTo(0, document.body.scrollHeight || document.documentElement.scrollHeight); if(i >= times) clearInterval(scrollingInterval); console.log(i++ + "Times."); }, 200); } scrollDownTillEnd(); })();
<a>
标签, 但是 HTML 文档里面没有出现).
PS C:\Users\xxx\Desktop\review> nslookup.exe github.com 222.74.1.200
Server: 200.1.74.222.broad.hh.nm.dynamic.163data.com.cn
Address: 222.74.1.200
Non-authoritative answer:
Name: github.com
Addresses: ::
0.0.0.0
PS C:\Users\xxx\Desktop\review> nslookup.exe github.com 222.74.126.230
Server: 230.126.74.222.broad.tl.nm.dynamic.163data.com.cn
Address: 222.74.126.230
Non-authoritative answer:
Name: github.com
Addresses: ::
0.0.0.0
PS C:\Users\xxx\Desktop\review> nslookup.exe github.com 222.74.59.65
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown
Address: 222.74.59.65
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
PS C:\Users\xxx\Desktop\review> nslookup.exe github.com 219.148.162.31
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown
Address: 219.148.162.31
PS C:\Users\xxx\Desktop\review> nslookup.exe github.com 219.148.162.31
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown
Address: 219.148.162.31
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out
PS C:\Users\xxx\Desktop\review> nslookup.exe github.com 222.74.39.50
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown
Address: 222.74.39.50
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out
via: 如何选择适合的公共 DNS
DNSPod | Anycast | Export | Address | TCP | DoT | DoH | ECS | Mark |
---|---|---|---|---|---|---|---|---|
腾讯 | 上海 / 天津 / 广州 / 香港 | 同左 | 119.29.29.29 / 119.28.28.28 |
❌ | ✔ | ✔ | ❌ | 国内 |
阿里云 | 成都 / 深圳 / 杭州 | 同左 | 223.6.6.6 / 223.5.5.5 |
❌ | ✔ | ✔ | ❌ | |
南京信风 | 南京 / 济南 / 芝加哥 | N/A | 114.114.114.114 / 114.114.115.115 |
❌ | ❌ | ❌ | ❌ | |
CNNIC | 北京 / 杭州 / 香港 | CNNIC / 阿里云 | 1.2.4.8 / 210.2.4.8 |
❌ | ❌ | ❌ | ❌ | |
百度 | 北京 / 南京 / 深圳 | 同左 | 180.76.76.76 |
❌ | ✔ | ✔ | ❌ | |
36+ 数据中心 | 边缘网络 | 8.8.8.8 / 8.8.4.4 |
✔ | ✔ | ✔ | ✔ | 国外 | |
OpenDNS | 32+ 数据中心 | N/A | 208.67.222.222 / 208.67.220.220 |
✔ | ❌ | ❌ | ✔ | |
Cloudflare DNS | 160+ 数据中心 | 同左 | 1.0.0.1 / 1.1.1.1 |
✔ | ✔ | ✔ | ❌ | |
Freenom World | Transit | 80.80.80.80 / 80.80.81.81 |
✔ | ❌ | ❌ | ✔ | ||
DNS.sb | SB Network | 185.222.222.222 / 185.184.222.222 |
✔ | ✔ | ✔ | ❌ |
nslookup
的结果和电脑不一样, 是和 安卓/iOS 代理机制有关吗?(xxx) > task.log 2>&1 &
# 最后一个 & 需要注意
&
, the call operator, executes scripts and functions in a child scope, which is the typical use case: functions and scripts are typically expected to execute without side effects:
Set-Location
to change the current location, explicitly modifying the parent scope (Set-Variable -Scope 1 ...
) or the global scope ($global:...
) or defining process-level environment variables.%TEMP
directorycd $env:temp
env
dir env
$env:<variableName>
, as in:get-childitem $env:temp
(a = b)
is the value of b
, so you can chain them this way. They are also right-associative, so it all works out.ArcChar = ArcBit = 0;
is (approximately1) the same as
ArcBit = 0;
ArcChar = 0;
0
.ArcBit
is an unsigned char
the result of the assignment will get widened to int
.If you can't see the "Update" folder it might be because Spotify hasn't downloaded those files yet. Try waiting until you see the blue dot in the top right of Spotify (that indicates an update is ready to be applied) and then the folder should be there. via: https://www.reddit.com/r/spotify/comments/alw999/comment/egm5v34/
rm %localappdata%\Spotify\Update
mkdir %localappdata%\Spotify\Update
icacls %localappdata%\Spotify\Update /deny "%username%":D
icacls %localappdata%\Spotify\Update /deny "%username%":R
jingrong.wang/*
, Forwarding URL (Status Code: 301 - Permanent Redirect, Url: http://blog.bgzo.cc)via: 使用CloudFlare进行域名重定向-月光博客 & Understanding and configuring Cloudflare Page Rules (Page Rules Tutorial) – Cloudflare Help Center
Stage