This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%%%%%%%%%%%%%%%% 参考文献 %%%%%%%%%%%%%%%%%%%%%% | |
% 自定义新命令\upcite, 使参考文献引用以上标出现 | |
\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}} | |
% 参考文献样式 | |
\bibliographystyle{data/gbt7714-2005} | |
%%% 目录设置 | |
\usepackage{tocloft} | |
\setcounter{tocdepth}{2} % 目录层级数 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu Linux | |
alias vi=nvim | |
alias cl=clear | |
alias vb='vi ~/.bashrc' | |
alias sb='source ~/.bashrc' | |
# for net | |
func_tcp() { firewall-cmd --zone=public --add-port=$1/tcp --permanent && iptables -I INPUT -ptcp --dport $1 -j ACCEPT; } | |
alias addtcp='func_tcp' | |
alias addudp='func_udp() { firewall-cmd --zone=public --add-port=$1/udp --permanent && iptables -I INPUT -pudp --dport $1 -j ACCEPT; };func_udp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH="/usr/local/texlive/2023/bin/universal-darwin:$PATH" | |
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" | |
# brew git mirrors: update for brew 4.0.0 | |
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles" | |
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// all container which support range-for-loop | |
template <typename T, template <typename> class Container> | |
ostream &operator<<(ostream &os, const Container<T>& v) { | |
for (auto i : v) os << i << " "; | |
return os << endl; | |
} | |
// ========================== vector ============================== | |
template <typename T> | |
ostream &operator<<(ostream &os, const vector<T>& v) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// calc factorial | |
auto f=[](int n) { | |
int ans{1}; | |
while (n > 1) ans*= n, --n; | |
return ans; | |
}; | |
// calc combination number | |
auto comb = [](int n, int k) { | |
int ans{1}; | |
for (int i{}; i < k; ++i) ans = ans * (n - i) / (i + 1); // can not `ans *= ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chrono> | |
using namespace std; | |
using namespace std::chrono; | |
auto start = system_clock::now(); | |
// do something... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 查找指定文件中包含某关键字的指定行(显示行号) | |
# -n 显示行号 | |
grep -n "home" /etc/passwd | |
# 需要先打印模式匹配然后打印行号, 比较麻烦 | |
sed -ne '/home/p' -e '/home/=' /etc/passwd | |
### 查找某些特定文件(例如通过扩展名)中出现的关键字的对应文件名和行号 | |
grep -rn "process" --include='*.cpp' . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############### for proxy accelerate network ############################ | |
# start_clash.sh: (may stdout in screen, you should use `nohup`) | |
: ' | |
#!/bin/bash | |
./clash -d . & | |
' | |
alias vpn='cd ~/opt/clash && ./start_clash.sh && cd -' | |
alias uvpn='pkill -9 clash' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cxxabi.h> | |
#include <iostream> | |
#if __cplusplus < 202002 | |
#define print_type(x) \ | |
std::cout << #x << typeid(x).name() << " => " \ | |
<< abi::__cxa_demangle(typeid(x).name(), NULL, NULL, NULL) \ | |
<< std::endl | |
#else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/homebrew/bin/python3 | |
import os | |
import re | |
import subprocess as sp # for get command return value(stdout) | |
base_path = "/Applications" | |
app_name = "Ghidra" | |
exec_file = "ghidraRun" |
OlderNewer