User Controls

I don't even know what the fuck I am doing anymore

  1. #1
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  2. #2
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  3. #3
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  4. #4
    aldra JIDF Controlled Opposition
    why

    0.0.0.0/0 oll
  5. #5
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  6. #6
    aldra JIDF Controlled Opposition
    why are you making a list of all possible ipv4 addresses

    you could use subnet notation to pass a range anywhere you might need to
  7. #7
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  8. #8
    aldra JIDF Controlled Opposition

    for(a=0;a<255;a++)
    {
    for(b=0;b<255;b++)
    {
    for(c=0;c<255;c++)
    {
    for(d=0;d<255;d++)
    {
    address="$a.$b.$c.$d";
    print(address);

    }
    }
    }
    }


    or something
    The following users say it would be alright if the author of this post didn't die in a fire!
  9. #9
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  10. #10
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  11. #11
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  12. #12
    filtration African Astronaut
    This post has been edited by a bot I made to preserve my privacy.
  13. #13
    Lanny Bird of Courage
    semi-oneliner for fun:

    n="0"; while [ $n -lt $((1 << 32)) ]; do; echo "$(((n & 0XFF000000) >> 24)).$(((n & 0XFF0000) >> 16)).$(((n & 0XFF00) >> 8)).$((n & 0XFF))"; n=$[$n + 1]; done
  14. #14
    Lanny Bird of Courage
    This was the fastest I managed to get:


    #define buflines 2048

    int main() {
    char *lu = malloc(3*256+1);
    for (int k=0; k<256; k++) {
    sprintf(lu+(k*3), "%03d", k);
    }
    lu[3*256+1] = '\0';

    char *buf = malloc(buflines * 16 + 1);
    for (int k = 0; k < buflines; k++) {
    buf[k*16 + 3] = '.';
    buf[k*16 + 7] = '.';
    buf[k*16 + 11] = '.';
    buf[k*16 + 15] = '\n';
    }

    int p;
    char *bufp;
    unsigned int i = 1 << 24;
    while (i) {
    bufp = buf;
    for (int k = 0; k < buflines; k++) {
    p = ((i & 0xff000000) >> 24) * 3;
    bufp[0] = *(lu+p);
    bufp[1] = *(lu+p+1);
    bufp[2] = *(lu+p+2);

    p = ((i & 0xff0000) >> 16) * 3;
    bufp[4] = *(lu+p);
    bufp[5] = *(lu+p+1);
    bufp[6] = *(lu+p+2);

    p = ((i & 0xff00) >> 8) * 3;
    bufp[8] = *(lu+p);
    bufp[9] = *(lu+p+1);
    bufp[10] = *(lu+p+2);

    p = (i & 0xff) * 3;
    bufp[12] = *(lu+p);
    bufp[13] = *(lu+p+1);
    bufp[14] = *(lu+p+2);

    bufp += 16;
    i--;
    }

    //printf("%s", buf);
    write(1, buf, buflines * 16);
    }
    return 0;
    }



    [lanny:~/killme]$ time ./a.out > /dev/null
    ./a.out > /dev/null 0.07s user 0.00s system 97% cpu 0.081 total


    16 million lines in ~0.5 seconds cold, ~0.08 on the second run. Interestingly `printf("%s", buf)` outperforms a direct write which surprised me, but I'm guessing printf has some buffering going on because when I added the internal buffer it got a lot faster.
    The following users say it would be alright if the author of this post didn't die in a fire!
  15. #15
    aldra JIDF Controlled Opposition
    lol I was just going to say don't perform the write for each line

    is the original code sh? I can't tell
  16. #16
    Lanny Bird of Courage
    Yee, or zsh, but I think it's all bash-compatible. No idea about classic borne.
  17. #17
    Sophie Pedophile Tech Support
    Originally posted by Lanny This was the fastest I managed to get:


    #define buflines 2048

    int main() {
    char *lu = malloc(3*256+1);
    for (int k=0; k<256; k++) {
    sprintf(lu+(k*3), "%03d", k);
    }
    lu[3*256+1] = '\0';

    char *buf = malloc(buflines * 16 + 1);
    for (int k = 0; k < buflines; k++) {
    buf[k*16 + 3] = '.';
    buf[k*16 + 7] = '.';
    buf[k*16 + 11] = '.';
    buf[k*16 + 15] = '\n';
    }

    int p;
    char *bufp;
    unsigned int i = 1 << 24;
    while (i) {
    bufp = buf;
    for (int k = 0; k < buflines; k++) {
    p = ((i & 0xff000000) >> 24) * 3;
    bufp[0] = *(lu+p);
    bufp[1] = *(lu+p+1);
    bufp[2] = *(lu+p+2);

    p = ((i & 0xff0000) >> 16) * 3;
    bufp[4] = *(lu+p);
    bufp[5] = *(lu+p+1);
    bufp[6] = *(lu+p+2);

    p = ((i & 0xff00) >> 8) * 3;
    bufp[8] = *(lu+p);
    bufp[9] = *(lu+p+1);
    bufp[10] = *(lu+p+2);

    p = (i & 0xff) * 3;
    bufp[12] = *(lu+p);
    bufp[13] = *(lu+p+1);
    bufp[14] = *(lu+p+2);

    bufp += 16;
    i--;
    }

    //printf("%s", buf);
    write(1, buf, buflines * 16);
    }
    return 0;
    }



    [lanny:~/killme]$ time ./a.out > /dev/null
    ./a.out > /dev/null 0.07s user 0.00s system 97% cpu 0.081 total


    16 million lines in ~0.5 seconds cold, ~0.08 on the second run. Interestingly `printf("%s", buf)` outperforms a direct write which surprised me, but I'm guessing printf has some buffering going on because when I added the internal buffer it got a lot faster.

    Damn, nice.
Jump to Top