共有 261 篇文章
Clipboard
2023-02-23 - 2024-09-18
向剪切板写入 图片等任意的数据到剪贴板。 这个方法可以用于实现剪切和复制的功能,是异步的 document.body.addEventListener( 'click', async (e) => { await navigator.clipboard.writeText('Yo') } ) Clipboard.read()用于读取剪切板的数据,也
Xterm
2023-02-15 - 2024-09-18
vim ~/.Xresource 填写配置 xterm.termName: xterm-256color xtermlocale:true xterm.utf8: true xtermutf8Title: true !fix alt key input !xtermeightBitInput: false !xtermaltSendsEscape: true !xtermscrollBar: true !xtermrightScrollBar: true xtermSaveLines: 4096 !xtermbackground: black !xtermforeground: green xtermprintAttributes: 0 xtermprinterCommand: cat > ~/xtermdump !xtermVT100.translations: #override <Btn1UP>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) xtermVT100.translations: #override \ Ctrl <KeyPress> V: insert-selection(CLIPBOARD,PRIMARY,CUT_BUFFER0) \n\ <BtnUp>: select-end(CLIPBOARD,PRIMARY,CUT_BUFFER0) \n\ Ctrl <KeyPress> P: print() \n xtermfaceName: Ubuntu Bold:antialias=True:pixelsize=12 xterm*faceNameDoublesize:Noto Sans Mono CJK SC:antialias=True:pixelsize=12
Sudo
2023-02-15 - 2024-09-18
apt install sudo cd /etc/sudoers.d vim user # Akvicor ALL=(ALL)NOPASSWD:ALL
Ufw
2023-02-15 - 2024-09-18
https://wiki.ubuntu.org.cn/Ufw%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97 安装 默认UFW的规则是放通全部端口 apt-get install ufw 设置默认规则 首先设置拒绝所有传入并允许所有传出。 请勿运行以下命令后直接应用,否则会直接锁定你的服务器。确保在应用默认规
Notepad Compile
2023-02-15 - 2024-09-18
Environment Add MinGW environment to Path: C:\MinGW\bin Open Notepad++ Plug->Plugin Manager->Show Plugin Manager at Available, double click ‘downloading list’ Search ‘Nppexec’, install and restart Open Console Plug->NppExec->Show Console Compile Plug->NppExec->Execute Compile input: g++ $(FULL_CURRENT_PATH) -g -o $(CURRENT_DIRECTORY)$(NAME_PART).exe click save, input: Compile Run input: $(CURRENT_DIRECTORY)$(NAME_PART).exe click save, input: Run GDB input: gdb $(CURRENT_DIRECTORY)$(NAME_PART).exe click save, input: GDB Add to Macros submenu Plug->NppExec->Advanced Options at Associated script: Add-> Compile and Run and GBD Menu items -> Place to the Macros submenu
Networking timeout
2023-02-15 - 2024-09-18
1 vim /etc/systemd/system/network-online.target.wants/networking.service TimeoutStartSec=2sec 2 vim /etc/dhcp/dhclient.conf timeout 15 1 change auto eth0 to allow-hotplug eth0
Analyzeblame
2023-02-15 - 2024-09-18
开机时间 systemd-analyze
Netstat
2023-02-15 - 2024-09-18

查看系统tcp连接中各个状态的连接数。 netstat -an|awk '/^tcp/ {++s[$NF]} END {for(a in s ) print a,s[a]}' # 查看和本机23端口建立连接并状态在established的所有ip netstat -an|grep 80|grep ESTA|awk '{print $5}'|awk 'BEGIN {FS=":"} {print $1 "\n"}'|sort|uniq -c

Iptables deny ip
2023-02-15 - 2024-09-18
only permit china ip systemctl stop firewalld.service systemctl disable firewalld.service yum install ipset yum install iptables-services 清空之前的规则 iptables -P INPUT ACCEPT iptables -F 创建一个名为cnip的规则 ipset -N cnip hash:net ipset save # 下载国家IP段,这里以中国为例 wget -P . http://www.ipdeny.com/ipblocks/data/countries/cn.zone # 将IP段添加到cnip
Debian 笔记本合盖和电源键作用
2023-02-15 - 2024-09-18
取消笔记本合盖后挂起 vim /etc/systemd/logind.conf 修改 # HandleLidSwitch=suspend HandleLidSwitch=ignore # HandlePowerKey=poweroff HandlePowerKey=ignore 修改屏幕保护
GDB Usage
2023-02-15 - 2024-09-18
连接远程调试 target remote localhost:1234 查看内存 x/<n/f/u> <addr> x /8xb 0xffff80000002fff0 # 以16进制方式查看0xffff80000002fff0处8字节内容 n 从当前地址往后请求的字节数,如果不指定的话,GDB默认