缺省源

正常使用

可以把 bashrc 中

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' # 将\w 改成 \W 大写字母W
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' # \W
fi

其中的 \w 改成 \W 来折叠目录。

折叠后可以用 pwd 查看当前目录。

.vimrc

set nu
set sw=4 ts=4 sts=4
set mouse=a
set cin
set so=10
set sc
hi cError cterm=NONE ctermbg=415
func F6()
let If = getline(2)
let Of = getline(3)
return "w | !clear && ulimit -s unlimited && g++ % -o %< -std=c++14 -DLOCAL -Wall -Wextra && time ./%< < ".If." > ".Of." && size %<"
endfunc
func F7()
let If = getline(2)
let Of = getline(3)
return "w | !clear && ulimit -s unlimited && g++ % -o %< -std=c++14 -fsanitize=address,undefined -g -DLOCAL -Wall -Wextra && time ./%< < ".If." > ".Of." && size %<"
endfunc
func F8()
let Of = getline(3)
return "!echo && cat ".Of." && echo"
endfunc
map <F6> <Esc>:exec F6()<Cr>
map <F7> <Esc>:exec F7()<Cr>
map <F8> <Esc>:exec F8()<Cr>
map <F9> <Esc>:w<Cr> <Esc>:!gedit %<Cr>
map <C-Z> <Esc>:w<Cr>
imap <F6> <Esc>:exec F6()<Cr>
imap <F7> <Esc>:exec F7()<Cr>
imap <F8> <Esc>:exec F8()<Cr>
imap <F9> <Esc>:w<Cr> <Esc>:!gedit %<Cr>
imap <C-Z> <Esc>:w<Cr>

.gdbinit(一般不用,只是记录)

set print pretty on
define P
set $cnt = 0
while $cnt < $arg1
p $arg0[$cnt][0]@$arg2
set $cnt = $cnt + 1
end
end
define D
set $arg1 = ($arg0 *)malloc(sizeof($arg0))
end

tpl.cpp

/* Local File
in_out/in.in
in_out/out.out
*/
#include <bits/stdc++.h>
using namespace std;
using llt = long long;
using ull = unsigned long long;
using llf = long double;
#define endl '\n'
#ifndef LOCAL
#undef assert
#define assert 0 &&
#define cerr 0 && cerr
FILE *InFile = freopen("file.in", "r", stdin), *OutFile = freopen("file.out", "w", stdout);
#endif
int main(){
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

c++ 版

/* Local File
in_out/in.in
in_out/out.out
*/
#include <bits/stdc++.h>
using namespace std;
using llt = long long;
using ull = unsigned long long;
using llf = long double;
#define endl '\n'
#ifndef LOCAL
#undef assert
#define assert 0 &&
#define cerr 0 && cerr
#endif
int main(){
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

json 版

{
"#include": {
"prefix": "#include",
"body": [
"#include<bits/stdc++.h>",
"using namespace std;",
"using llt=long long;",
"using llf=long double;",
"using ull=unsigned long long;",
"#define endl '\\n'",
"#ifdef LOCAL",
"\tFILE *InFile=freopen(\"in_out/in.in\",\"r\",stdin),*OutFile=freopen(\"in_out/out.out\",\"w\",stdout);",
"#else",
"\tFILE *InFile=stdin,*OutFile=stdout;",
"#endif",
"",
"int main(){",
"\tios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);",
"\t$0",
"}",
],
}
}

upd:简洁的多线程对拍,编译时记得加 -pthread

#include<bits/stdc++.h>
using namespace std;
int S(const string &s){return system(s.c_str());}
const int T=20,N=50;
future<void> pt[T];
void Run(int id){
string p=" data/"+to_string(id),i=p+".in ",o=p+".out ",a=p+".ans ";
for(int k=1;k<=N;++k) if(S("./rnd >"+i+"&& ./1 <"+i+">"+o+"&& ./std <"+i+">"+a+"&& diff"+o+a+"-Z > /dev/null")) return puts("Wa"),void();
S("rm -f"+i+";rm -f"+o+";rm -f"+a);
}
int main(){
assert(!S("g++ 1.cpp -o 1 -O2 -std=c++14 -DPAI && g++ std.cpp -o std -O2 -std=c++14 -DPAI && g++ rnd.cpp -o rnd -O2 -std=c++14 -DPAI"));
assert(!S("cd data && rm -rf *")); for(int i=0;i<T;++i) pt[i]=async(Run,i);
}

设置:

在 settings.json 中写入:

{
"editor.fontSize": 15,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 10,
"editor.cursorSmoothCaretAnimation": "on",
"workbench.list.smoothScrolling": true,
"editor.smoothScrolling": true,
"terminal.integrated.smoothScrolling": true,
"editor.cursorBlinking": "smooth",
"editor.cursorStyle": "underline",
"editor.insertSpaces": false,
"[dockercompose]": {"editor.tabSize": 4, "editor.insertSpaces": false},
"[yaml]": {"editor.tabSize": 4, "editor.insertSpaces": false},
"[makefile]": {"editor.tabSize": 4, "editor.insertSpaces": false},
"editor.detectIndentation": false,
"editor.comments.insertSpace": false
}
{
"editor.fontSize": 15,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 10,
"editor.cursorSmoothCaretAnimation": "on",
"workbench.list.smoothScrolling": true,
"editor.smoothScrolling": true,
"terminal.integrated.smoothScrolling": true,
"editor.cursorBlinking": "smooth",
"editor.cursorStyle": "underline",
"editor.fontFamily": "'Jetbrains Mono', 'monospace', monospace",
"editor.fontLigatures": true,
"C_Cpp.clang_format_style": "{BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Attach, AllowShortIfStatementsOnASingleLine: true, IndentCaseLabels: true, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All, FixNamespaceComments: false ,AllowShortCaseLabelsOnASingleLine: true,AllowShortLoopsOnASingleLine: true,AllowShortBlocksOnASingleLine: true}",
"editor.insertSpaces": false,
"[dockercompose]": {"editor.tabSize": 4, "editor.insertSpaces": false},
"[yaml]": {"editor.tabSize": 4, "editor.insertSpaces": false},
"[makefile]": {"editor.tabSize": 4, "editor.insertSpaces": false},
"C_Cpp.errorSquiggles": "disabled",
"editor.detectIndentation": false,
"editor.comments.insertSpace": false
}

字体下载

插件下载

5k's


旧的(更多功能也更长):

#include<bits/stdc++.h>
using namespace std;
using llt=long long;
using llf=long double;
using ull=unsigned long long;
#define For(i,a,b,c) for(int i=(a);i<=(b);i+=(c))
#define For_(i,a,b,c) for(int i=(a);i>=(b);i-=(c))
#define For_it(i,a,b) for(auto i=(a);i!=(b);++i)
namespace Fast_IO{
#ifdef ONLINE_JUDGE
FILE *Fin(stdin), *Fout(stdout);
#else
FILE *Fin(fopen("in_out/in.in","r")), *Fout(fopen("in_out/out.out","w"));
#endif // File
#ifdef USE_C_PUT
#define Debug fwrite(buf,1,p,fp),p=0
#define printf(s,args...) fprintf(Fast_IO::Fout,s,##args)
#define puts(a) fputs(a,Fast_IO::Fout)
#else
#define Debug
#endif // C_output
class qistream{
private:
static constexpr size_t SIZE=1<<20,BLOCK=64; FILE *fp; char buf[SIZE]; int p; bool End;
void flush(){if(p+BLOCK>=SIZE) memmove(buf,buf+p,SIZE-p),fread(buf+SIZE-p,1,p,fp),p=0;}
char getch(){flush(); return buf[p++];} qistream &Set_End(){return End=0,*this;}
public:
qistream(FILE *_fp=stdin):End(1),fp(_fp),p(0){fread(buf+p,1,SIZE-p,fp);}
qistream &operator>>(char &str){str=getch(); while(isspace(str))str=getch(); return str<=0?Set_End():*this;}
template<class T>
typename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qistream>::type &operator>>(T &x){
x=0; flush(); bool flag=false; for(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}
for(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0'; x=flag?-x:x; return*this;
} template <class T> typename enable_if<is_floating_point<T>::value,qistream>::type &operator>>(T &x){
x=0; flush(); T unit = 1.0; bool flag=false;
for(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}
for(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0';
if (buf[p]=='.') for(++p;isdigit(buf[p]);++p) x+=(unit*=0.1)*(buf[p]-'0'); x=flag?-x:x; return *this;
} qistream &operator>>(char *str){
char ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}
int i; for(i=0;ch>' ';++i,ch=getch()) str[i]=ch; str[i]='\0'; return*this;
} qistream &operator>>(string& str){
str.clear(); char ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}
while(ch>' ') str.push_back(ch),ch=getch(); return*this;
} operator bool(){return End;}
friend qistream &getline(qistream& in,string& s){
s.clear(); char c=in.getch(); if(c<=0) return in.Set_End();
while(c!='\n'&&c>0) s.push_back(c),c=in.getch(); return in;
}
}cin(Fin);
class qostream{
static constexpr size_t SIZE=1<<20,BLOCK=64,FLSIZE=64; FILE *fp; char buf[SIZE]; int p;
char flbuf[FLSIZE]; int prec; unsigned long long flen;
void flush(){if(p+BLOCK>=SIZE) fwrite(buf,1,p,fp),p=0;} void putch(const char& ch){flush();buf[p++]=ch;}
public:
void Set_Persicion(const size_t& x){prec=x;flen=(unsigned long long)(pow(10,x));}
qostream(FILE *_fp=stdout,const size_t& p=6):fp(_fp),p(0){Set_Persicion(p);} ~qostream(){fwrite(buf, 1, p, fp);}
template<class T>
typename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qostream>::type &operator<<(T x){
int len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; do buf[p+len]=x%10+'0',x/=10,++len; while(x);
for(int i=0,j=len-1;i<j;++i,--j) swap(buf[p+i],buf[p+j]); p+=len; Debug; return*this;
} template<class T> typename enable_if<is_floating_point<T>::value,qostream>::type &operator<<(T x){
int len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; x*=flen; unsigned long long ret=x;
if(x-ret>=0.4999999999) ++ret; if(ret) do flbuf[len++]=ret%10+'0',ret/=10; while(ret);
if(len>prec){do buf[p++]=flbuf[--len]; while(len>prec); buf[p++]='.';} else{buf[p++]='0',buf[p++]='.';
for(size_t i=prec-len;i--;) buf[p++]='0';} do buf[p++]=flbuf[--len]; while(len); Debug; return*this;
}
qostream &operator<<(const char& x){putch(x); Debug; return*this;}
qostream &operator<<(const char *str){while(*str) putch(*str++); Debug; return*this;}
qostream &operator<<(const string& str){return *this<<str.c_str();}
}cout(Fout);
#define cin Fast_IO::cin
#define cout Fast_IO::cout
#define endl '\n'
}
namespace exIO{
bool read(char* s){return bool(cin>>s);} void write(char* s){cout<<s;}
template<class T> bool read(T& x){return bool(cin>>x);} template<class T> void write(T x){cout<<x;}
template<class T,class... Args> bool read(T& x,Args&... args){return bool(read(x)|read(args...));}
template<class T=int> T read(){T a; read(a); return a;}
template<class T> void Write(T x){write(x),cout<<' ';}
void Write(char c){write(c);if(c!='\n') cout<<' ';}
void Write(char *c){write(c);if(c[strlen(c)-1]!='\n') cout<<' ';}
void Write(string &c){write(c);if(c[c.size()-1]!='\n') cout<<' ';}
void Write(const char *c){write(c);if(c[strlen(c)-1]!='\n') cout<<' ';}
template<class T,class... Args> void write(T x,Args... args){write(x);write(args...);}
template<class T,class... Args> void Write(T x,Args... args){Write(x);Write(args...);}
} using namespace exIO;
int main(){
}

json 版

{
"#include": {
"prefix": "#include",
"body": [
"#include<bits/stdc++.h>",
"using namespace std;",
"using llt=long long;",
"using llf=long double;",
"using ull=unsigned long long;",
"#define Ct const",
"#define For(i,a,b,c) for(int i=(a);i<=(b);i+=(c))",
"#define For_(i,a,b,c) for(int i=(a);i>=(b);i-=(c))",
"#define For_it(i,a,b) for(auto i=(a);i!=(b);++i)",
"namespace Fast_IO{",
"#ifdef ONLINE_JUDGE",
"\tFILE *Fin(stdin), *Fout(stdout);",
"#else",
"\tFILE *Fin(fopen(\"in_out/in.in\",\"r\")), *Fout(fopen(\"in_out/out.out\",\"w\"));",
"#endif // File",
"#ifdef USE_C_PUT",
"\t#define Debug fwrite(buf,1,p,fp),p=0",
"\t#define printf(s,args...) fprintf(Fast_IO::Fout,s,##args)",
"\t#define puts(a) fputs(a,Fast_IO::Fout)",
"#else",
"\t#define Debug",
"#endif // C_output",
"\tclass qistream{",
"\tprivate: ",
"\t\tstatic constexpr size_t SIZE=1<<20,BLOCK=64; FILE *fp; char buf[SIZE]; int p; bool End;",
"\t\tvoid flush(){if(p+BLOCK>=SIZE) memmove(buf,buf+p,SIZE-p),fread(buf+SIZE-p,1,p,fp),p=0;}",
"\t\tchar getch(){flush(); return buf[p++];} qistream &Set_End(){return End=0,*this;}",
"\tpublic:",
"\t\tqistream(FILE *_fp=stdin):End(1),fp(_fp),p(0){fread(buf+p,1,SIZE-p,fp);}",
"\t\tqistream &operator>>(char &str){str=getch(); while(isspace(str))str=getch(); return str<=0?Set_End():*this;} ",
"\t\ttemplate<class T>",
"\t\ttypename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qistream>::type &operator>>(T &x){",
"\t\t\tx=0; flush(); bool flag=false; for(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}",
"\t\t\tfor(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0'; x=flag?-x:x; return*this;",
"\t\t} template <class T> typename enable_if<is_floating_point<T>::value,qistream>::type &operator>>(T &x){",
"\t\t\tx=0; flush(); T unit = 1.0; bool flag=false;",
"\t\t\tfor(;!isdigit(buf[p]);++p){if(buf[p]<=0) return Set_End(); flag=buf[p]=='-';}",
"\t\t\tfor(;isdigit(buf[p]);++p) x=x*10+buf[p]-'0';",
"\t\t\tif (buf[p]=='.') for(++p;isdigit(buf[p]);++p) x+=(unit*=0.1)*(buf[p]-'0'); x=flag?-x:x; return *this;",
"\t\t} qistream &operator>>(char *str){",
"\t\t\tchar ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}",
"\t\t\tint i; for(i=0;ch>' ';++i,ch=getch()) str[i]=ch; str[i]='\\0'; return*this;",
"\t\t} qistream &operator>>(string& str){",
"\t\t\tstr.clear(); char ch=getch(); while(ch<=' '){if(ch<=0) return Set_End(); ch=getch();}",
"\t\t\twhile(ch>' ') str.push_back(ch),ch=getch(); return*this;",
"\t\t} operator bool(){return End;}",
"\t\tfriend qistream &getline(qistream& in,string& s){",
"\t\t\ts.clear(); char c=in.getch(); if(c<=0) return in.Set_End();",
"\t\t\twhile(c!='\\n'&&c>0) s.push_back(c),c=in.getch(); return in;",
"\t\t}",
"\t}cin(Fin);",
"\tclass qostream{",
"\t\tstatic constexpr size_t SIZE=1<<20,BLOCK=64,FLSIZE=64; FILE *fp; char buf[SIZE]; int p;",
"\t\tchar flbuf[FLSIZE]; int prec; unsigned long long flen;",
"\t\tvoid flush(){if(p+BLOCK>=SIZE) fwrite(buf,1,p,fp),p=0;} void putch(const char& ch){flush();buf[p++]=ch;}",
"\tpublic:",
"\t\tvoid Set_Persicion(const size_t& x){prec=x;flen=(unsigned long long)(pow(10,x));}",
"\t\tqostream(FILE *_fp=stdout,const size_t& p=6):fp(_fp),p(0){Set_Persicion(p);} ~qostream(){fwrite(buf, 1, p, fp);}",
"\t\ttemplate<class T>",
"\t\ttypename enable_if<is_integral<T>::value|is_same<T,__int128_t>::value,qostream>::type &operator<<(T x){",
"\t\t\tint len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; do buf[p+len]=x%10+'0',x/=10,++len; while(x);",
"\t\t\tfor(int i=0,j=len-1;i<j;++i,--j) swap(buf[p+i],buf[p+j]); p+=len; Debug; return*this;",
"\t\t} template<class T> typename enable_if<is_floating_point<T>::value,qostream>::type &operator<<(T x){",
"\t\t\tint len=0; flush(); x<0?(x=-x,buf[p++]='-'):0; x*=flen; unsigned long long ret=x;",
"\t\t\tif(x-ret>=0.4999999999) ++ret; if(ret) do flbuf[len++]=ret%10+'0',ret/=10; while(ret);",
"\t\t\tif(len>prec){do buf[p++]=flbuf[--len]; while(len>prec); buf[p++]='.';} else{buf[p++]='0',buf[p++]='.';",
"\t\t\tfor(size_t i=prec-len;i--;) buf[p++]='0';} do buf[p++]=flbuf[--len]; while(len); Debug; return*this;",
"\t\t}",
"\t\tqostream &operator<<(const char& x){putch(x); Debug; return*this;}",
"\t\tqostream &operator<<(const char *str){while(*str) putch(*str++); Debug; return*this;}",
"\t\tqostream &operator<<(const string& str){return *this<<str.c_str();}",
"\t}cout(Fout);",
"#define cin Fast_IO::cin",
"#define cout Fast_IO::cout",
"#define endl '\\n'",
"}",
"namespace exIO{",
"\tbool read(char* s){return bool(cin>>s);} void write(char* s){cout<<s;}",
"\ttemplate<class T> bool read(T& x){return bool(cin>>x);} template<class T> void write(T x){cout<<x;}",
"\ttemplate<class T,class... Args> bool read(T& x,Args&... args){return bool(read(x)|read(args...));}",
"\ttemplate<class T=int> T read(){T a; read(a); return a;}",
"\ttemplate<class T> void Write(T x){write(x),cout<<' ';}",
"\tvoid Write(char c){write(c);if(c!='\\n') cout<<' ';}",
"\tvoid Write(char *c){write(c);if(c[strlen(c)-1]!='\\n') cout<<' ';}",
"\tvoid Write(string &c){write(c);if(c[c.size()-1]!='\\n') cout<<' ';}",
"\tvoid Write(const char *c){write(c);if(c[strlen(c)-1]!='\\n') cout<<' ';}",
"\ttemplate<class T,class... Args> void write(T x,Args... args){write(x);write(args...);}",
"\ttemplate<class T,class... Args> void Write(T x,Args... args){Write(x);Write(args...);}",
"} using namespace exIO;",
"",
"int main(){",
"\t$0",
"}"
],
}
}

jijidawang's 资料




posted @   5k_sync_closer  阅读(182)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
点击右上角即可分享
微信分享提示