• Linux gedit配置


    编辑-首选项-插件 里打开外部工具

    编译:

    #!/bin/sh
    name=$GEDIT_CURRENT_DOCUMENT_NAME
    name2=${name%.*}
    g++ $name -o $name2 -g
    

    运行:

    #!/bin/sh
    name=$GEDIT_CURRENT_DOCUMENT_NAME
    name2=${name%.*}
    ulimit -s unlimited
    g++ $name -o $name2 -g
    gnome-terminal -x bash -c "time ./$name2;echo;read;"
    

    #!/bin/sh
    

    加高亮(?

    name=$GEDIT_CURRENT_DOCUMENT_NAME
    

    找到当前的文件名.cpp(可以在 工具-构建 里找到DIR=$GEDIT_CURRENT_DOCUMENT_DIR,改成NAME)

    name2=${name%.*}
    

    https://www.cnblogs.com/chengd/p/7803664.html

    ${string%ch*},意思是去掉string中最后一个ch及其后面的部分

    所以name=文件名.cpp,name2=文件名

    ulimit -s unlimited
    

    解除栈空间限制

    g++ $name -o $name2 -g
    

    编译,-o前面的是cpp后面是可执行文件,-g添加gdb

    gnome-terminal -x bash -c "time ./$name2;echo;read;"
    

    gnome-terminal是打开终端(可以在 工具-在此处打开终端 里找到)

    直接写是只打开,gnome-terminal -x表示打开并执行后面的所有命令,不用加其他符号

    https://blog.csdn.net/zong596568821xp/article/details/78623130

    问题是直接写gnome-terminal -x ./$name2运行结束后会直接退,所以再加上bash

    http://www.xckey.com/971.html

    bash -c "string"表示运行命令string,echo+空 是换行,read等于pause,命令用分号隔开

    加上time看运行时间

    然后就可以用♂了


    改一下得到一键gdb:

    #!/bin/sh
    name=$GEDIT_CURRENT_DOCUMENT_NAME
    name2=${name%.*}
    ulimit -s unlimited
    g++ $name -o $name2 -g
    gnome-terminal -x bash -c "gdb $name2"
    

    初始:

    #!/bin/sh
    printf '%s
    ' '#include <bits/stdc++.h>'
    printf '%s
    ' '#define fo(a,b,c) for (a=b; a<=c; a++)'
    printf '%s
    ' '#define fd(a,b,c) for (a=b; a>=c; a--)'
    printf '%s
    ' '#define ll long long'
    printf '%s
    ' '#define file'
    printf '%s
    ' 'using namespace std;'
    printf '%s
    ' ''
    printf '%s
    ' 'int main()'
    printf '%s
    ' '{'
    printf '%s
    ' '	freopen("a.in","r",stdin);'
    printf '%s
    ' '	#ifdef file'
    printf '%s
    ' '	freopen("a.out","w",stdout);'
    printf '%s
    ' '	#endif'
    printf '%s
    ' '	'
    printf '%s
    ' '	fclose(stdin);'
    printf '%s
    ' '	fclose(stdout);'
    printf '%s
    ' '	return 0;'
    printf '%s' '}'
    

    数据:

    #!/bin/sh
    printf '%s
    ' '#include <bits/stdc++.h>'
    printf '%s
    ' '#define fo(a,b,c) for (a=b; a<=c; a++)'
    printf '%s
    ' '#define fd(a,b,c) for (a=b; a>=c; a--)'
    printf '%s
    ' '#define ll long long'
    printf '%s
    ' 'using namespace std;'
    printf '%s
    ' ''
    printf '%s
    ' 'int random(int x,int y) {return (233333ll*rand()+rand())%(y-x+1)+x;}'
    printf '%s
    ' ''
    printf '%s
    ' 'ifstream f1;'
    printf '%s
    ' 'ofstream f2;'
    printf '%s
    ' 'int Seed;'
    printf '%s
    ' ''
    printf '%s
    ' 'int main()'
    printf '%s
    ' '{'
    printf '%s
    ' '	f1.open("test.txt");'
    printf '%s
    ' '	f1>>Seed;'
    printf '%s
    ' '	f1.close();'
    printf '%s
    ' '	srand(time(NULL)+Seed);rand();'
    printf '%s
    ' '	f2.open("test.txt");'
    printf '%s
    ' '	f2<<random(1,1000000000);'
    printf '%s
    ' '	f2.close();'
    printf '%s
    ' '	freopen("a.in","w",stdout);'
    printf '%s
    ' '	'
    printf '%s
    ' '	fclose(stdin);'
    printf '%s
    ' '	fclose(stdout);'
    printf '%s
    ' '	return 0;'
    printf '%s' '}'
    

    对拍:

    #!/bin/sh
    printf '%s
    ' '#include <bits/stdc++.h>'
    printf '%s
    ' '#define fo(a,b,c) for (a=b; a<=c; a++)'
    printf '%s
    ' '#define fd(a,b,c) for (a=b; a>=c; a--)'
    printf '%s
    ' '#define ll long long'
    printf '%s
    ' '#define file'
    printf '%s
    ' 'using namespace std;'
    printf '%s
    ' ''
    printf '%s
    ' 'int tot;'
    printf '%s
    ' ''
    printf '%s
    ' 'int main()'
    printf '%s
    ' '{'
    printf '%s
    ' '	while (1)'
    printf '%s
    ' '	{'
    printf '%s
    ' '		system("./_data");'
    printf '%s
    ' '		system("./_bl");'
    printf '%s
    ' '		system("./");'
    printf '%s
    ' '		if (system("diff a.out .out -b")) return 0;'
    printf '%s
    ' '		++tot;'
    printf '%s
    ' '		cout<<tot<<endl;'
    printf '%s
    ' '	}'
    printf '%s' '}'
    

    diff加个-b可以忽略空格的不同(windows/linux)

    神必1:

    #!/bin/bash
    st='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-_=+[]{};:/?,.<>1234567890'
    aa=$(($RANDOM%89))
    bb=$(($RANDOM%89))
    ch1=${st:$aa:1}
    ch2=${st:$bb:1}
    sed s/$ch1/$ch2/
    

    其他以后再加

  • 相关阅读:
    重写gallery 的 BaseAdapter
    excel数据导入DB
    更换 字体
    Android Activity跳转 Intent
    mpax5.0比mapx4.51多了些什么功能?
    [转载]INET控件的几点使用
    [转载]GIS基本概念集锦
    [转载]Microsoft.XMLHTTP对象
    等值线的绘制
    [转载]关于webbrowser,innet,xmlhttp获取网页源码的比较!
  • 原文地址:https://www.cnblogs.com/gmh77/p/14809437.html
Copyright © 2020-2023  润新知