【Setup:部署基于CentOS 7 X64 VPS】

  • 把网址搬到了 Bandwagon,一年 18.89USD,速度还行,直连CN2,默认安装带 BBR 的 CentOS 7,自己的 setup 如下
  • 部署LAMP
    yum -y install wget screen git
    git clone https://github.com/teddysun/lamp.git
    cd lamp
    chmod +x *.sh
    screen -S lamp
    ./lamp.sh
  • 部署Shadowsocks
    wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
    chmod +x shadowsocks-all.sh
    ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log
  • 部署VPN
    wget --no-check-certificate https://raw.githubusercontent.com/teddysun/across/master/l2tp.sh
    chmod +x l2tp.sh
    ./l2tp.sh
  • 【C语言 动态创建链表 Linked List】

    #include <stdio.h>
    #include <stdlib.h>
    
    typedef struct LinkedListNode
    {
        int data;
        struct LinkedListNode *next;
    } NODE;
    
    NODE *creatList(int n, int m)
    {
        NODE *temp=NULL;
        NODE *origin;
        NODE *extend;
    
        origin=(NODE*)malloc(sizeof(NODE));
        temp=origin;
        origin->next=NULL;
    
        for(int i=1;i<=n;i+=1){
            extend=(NODE*)malloc(sizeof(NODE));
            extend->data=i;
            extend->next=origin->next;
            origin->next=extend;
            origin=origin->next;
        }
        return temp;
    }
    
    void outputLink(NODE *head)
    {
        NODE *temp;
        temp=head->next;
    
        printf("HEAD");
        while(temp){
            printf("->%d",temp->data);
            temp=temp->next;
        }
    }
    
    int main() {
        NODE *head;
        head=creatList(10,10);
        outputLink(head);
        return 0;
    }

    【macOS终端使用代理Proxy】

    • 打开终端,运行
      
      open -t ~/.bash_profile   //.bash_profile 可以理解为Term打开后能够自动执行的脚本文件
      
    • 复制到.bash_profile
      
      export https_proxy=http://127.0.0.1:6152 //替换为你自己的代理
      export http_proxy=http://127.0.0.1:6152  //替换为你自己的代理
      
    • 保存配置,运行
      
      source ~/.bash_profile
      
    • 该方法配置好后,在IDEA等工具的终端下同样有用

    【C语言 大数加法 减法 乘法】

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    void stringReverse(char * p)//逆序字符串
    {
        int i,len;
        char temp;
        len = strlen(p);
    
        for(i=0; i<(len/2); i++)
        {
            temp = p[i];
            p[i] = p[len-1-i];
            p[len-1-i] = temp;
        }
    }
    
    char* getString()//动态字符串输入
    {
        char *str;
        char *_str;
        int i=1;
    
        str=(char*)malloc(sizeof(char)*(i+1));
    
        while((str[i-1]=getchar())!='\n'){
            i+=1;
    
            _str=(char*)malloc(strlen(str)+1);
            str[i-1]='\0';
    
            strcpy(_str,str);
            free(str);
    
            str=(char*)malloc(sizeof(char)*(i+1));
            if(str==NULL){
                free(_str);
                printf("Not enough memory!");
                return NULL;
            }
    
            strcpy(str,_str);
            free(_str);
        }
        str[i-1]='\0';
        return str;
    }
    
    char* remove_0(char *c)//删除0
    {
        char *temp,*ch;
        temp=c;
        while(*temp){
            if(*temp!='0') break;
            temp+=1;
        }
    
        ch=c;
        while(*temp){
            *ch=*temp;
            ch+=1;
            temp+=1;
        }
        *ch='\0';
    
        return c;
    }
    
    char* add(char *a,char *b)//加法
    {
        char *c;
        char *ch1,*ch2,*ch3;
        int len=0;
        int i=0,j=0;
        int x=0,y=0;
    
        len = strlen(a)>=strlen(b) ? strlen(a) : strlen(b);
    
        c=(char*)malloc(sizeof(char)*(len+1));
    
        stringReverse(a);
        stringReverse(b);
    
        ch1=a;
        ch2=b;
        ch3=c;
        while(*ch1!='\0' || *ch2!='\0'){
            if(*ch1!='\0') i=*ch1-'0';
            if(*ch2!='\0') j=*ch2-'0';
            x=i+j+y;
            *ch3=(x%10)+'0';
            ch3+=1;
            y=x/10;
            if(*ch1!='\0') ch1+=1;
            if(*ch2!='\0') ch2+=1;
            i=0;
            j=0;
        }
        *ch3='\0';
    
        stringReverse(c);
    
        return c;
    }
    
    
    char* minus(char *a,char *b)//减法
    {
        char *c;
        char *temp;
        char *ch1,*ch2,*ch3;
        int sign=0;
        int len=0;
        int i=0,j=0;
        int x=0,y=0;
    
        len = strlen(a)>=strlen(b) ? strlen(a) : strlen(b);
    
        c=(char*)malloc(sizeof(char)*len);
    
        if((strlen(a)==strlen(b) && strcmp(a,b)<0) || strlen(a)<strlen(b)){
            temp=a;
            a=b;
            b=temp;
            sign=1;
        }
    
        stringReverse(a);
        stringReverse(b);
    
        ch1=a;
        ch2=b;
        ch3=c;
        while(*ch1!='\0' || *ch2!='\0'){
            if(*ch1!='\0') i=*ch1-'0';
            if(*ch2!='\0') j=*ch2-'0';
            x=i-j-y;
            if(x<0){
                y=1;
                x+=10;
            }else{
                y=0;
            }
            *ch3=(x%10)+'0';
            ch3+=1;
            if(*ch1!='\0') ch1+=1;
            if(*ch2!='\0') ch2+=1;
            i=0;
            j=0;
        }
        *ch3='\0';
    
        stringReverse(c);
    
        remove_0(c);
    
        if(sign==0){
            return c;
        }else{
            printf("-");
            return c;
        }
    }
    
    
    char* by(char *a,char *b)//乘法
    {
        char *c;
        int len=0;
        int temp=0;
        int i=0,j=0;
        int x=0,y=0;
    
        len=strlen(a)+strlen(b);
    
        stringReverse(a);
        stringReverse(b);
    
        c=(char*)malloc(sizeof(char)*(len+1));
        memset(c,0,sizeof(char)*(len+1));
    
        for(i=0;i<strlen(b);i+=1){
            for(j=0;j<strlen(a);j+=1){
                x=a[j]-'0';
                y=b[i]-'0';
                temp=x*y;
                c[i+j]+=temp;
            }
        }
    
        x=0;
        for(i=0;i<len;i+=1){
            c[i]+=x;
            x=c[i]/10;
            c[i]%=10;
        }
    
        for(i=0;i<len;i+=1){
            c[i]+='0';
        }
    
        stringReverse(c);
    
        remove_0(c);
    
        return c;
    }
    
    int main(){
        char *a,*b,*operator;
    
        printf("Infinite Positive Integer Operation\n");
        printf("-----------------------\n");
    
        printf("Please enter the first positive integer:\n");
        a=getString();
    
        printf("Please enter the operator(+ - * /):\n");
        operator=getString();
    
        printf("Please enter the second positive integer:\n");
        b=getString();
    
        printf("The result is:\n");
    
        switch (*operator){
            case '+':
                puts(add(a,b));
                break;
            case '-':
                puts(minus(a,b));
                break;
            case '*':
                puts(by(a,b));
                break;
                /*case '/':
                    puts(divide(a,b));
                    break;*/
            default:
                printf("error");
                break;
        }
    
    
        return 0;
    }