Slashdot Mirror


World's Shortest P2P App: 15 Lines

soren.harward writes "The New Scientist has an article about TinyP2P, the world's smallest P2P app. It's 15 lines of Python code brought to us by Edward Felten, CS Professor at Princeton and outspoken supporter of the digital rights the Slashdot community holds so dear. He wrote the program as a proof-of-concept that P2P apps are really easy to write, don't have to be complicated, and thus banning them (a la the INDUCE Act) is pointless and silly."

34 of 443 comments (clear)

  1. bet i could write a 15 line by catbutt · · Score: 5, Funny

    dupe checker for slashdot

    1. Re:bet i could write a 15 line by jarich · · Score: 5, Funny
      All slashdot editors have to do is search through their archive

      Have you ever tried to find anything on /. with the built in search engine?

      Heck, for all we know, the editors ~are~ looking, but the search engine tells them it's a new article!

      It's a joke! Laugh! :)

    2. Re:bet i could write a 15 line by lukewarmfusion · · Score: 2, Funny

      Yeah, and we could use a meta-dupe-checking group to ensure that the dupe-checkers were honestly and accurately checking for duplicates. And it would be a real success, just like the other checks and balances here on Slashdot!

    3. Re:bet i could write a 15 line by Anonymous Coward · · Score: 1, Funny

      It wouldn't be difficult to automate.

      Really? How? Computers have a really hard time parsing human language, and comparing two paragraphs to see if they are about the same subject would be quite difficult




      Here ya go, slash dupe-checker in around 15 lines of code:


      \ cmt {d-bank} -- text of slashdot article including subjct
      \ end inpt {d-bank} c %VAR = $SUBJ
      \ inpt DATE c %VAR = $DATE $$N-1 $$$n-365
      \ bg inpt c %VAR = $DATEn $$SUBJ {d-bank}
      \ end inpt c %VAR = $OLD {d-bank};n $$ OLD {d-bank)n-1; n-365
      \ cmt -- assumes value of 15 redundant words = redunant story, can be adjusted to taste
      \ bg inpt char = $ {d-bank} $AVG $$AVG = (n-1);(n-365) $$$ !avg \1\ !max \15\
      \ end impt $AVG $$AVG = 1 \TRUE\ $$$AVG = 1 \FALSE\
      \ pipe $1 \Story is dupe {d-bank (n-VAR1}}\ $$2 \Story is unique\ pipe end

    4. Re:bet i could write a 15 line by EnronHaliburton2004 · · Score: 2, Funny

      ok, fine. I owe you a beer.

    5. Re:bet i could write a 15 line by BorgCopyeditor · · Score: 4, Funny
      fails to take into account the level of abstraction the language itself provides

      Exactly. To wit:

      import java.net.p2p.*;
      class Dukester {
      ..public static void main (String[] args) throws IOException {
      ....new java.net.p2p.Client();
      ..}
      }
      Piece of cake!
      --
      Shop as usual. And avoid panic buying.
  2. I can do better by krbvroc1 · · Score: 5, Funny

    10 wget http://localhost/warez/\* 20 pause 10 30 goto 10

  3. Thank god! by ozric99 · · Score: 2, Funny

    I've been waiting for a suprnova replacement for a while!

  4. Instead of talking about the repost by ian+rogers · · Score: 2, Funny

    Why don't you guys just write a 15 line program that checks the first 50 replies to stories, and filter out 49 of them that say anything about it being a repost.

  5. Re:Speaking of dupes... by Anonymous Coward · · Score: 2, Funny

    I can't wait for all the dupe posts in this story.

  6. Re:1 line? by prodangle · · Score: 5, Funny

    Lines cannot be longer than 80 chars - it's the law :)

  7. Shortest lawsuit... by dogmatixpsych · · Score: 2, Funny

    And to go along with this the MPAA and RIAA will quickly hit the programmer with the world's shortest lawsuit. It will be written in English.

  8. how come no one by geekoid · · Score: 2, Funny

    has mentioned that this story is a dupe?

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  9. Re:Why TinyP2P when you have MoleSter by Anonymous Coward · · Score: 1, Funny

    Oh Please.

    Perl is Barbaric.

    People who use Perl are Barbarians.

  10. Python? by Psychor · · Score: 4, Funny

    Python? That code is so hard to read I thought it was Perl!

  11. Re:Duplicate... by thhamm · · Score: 4, Funny

    your dupe post is da dupe too. ugh.

  12. repost comments! by Anonymous Coward · · Score: 5, Funny

    heres some +5 comments for your viewing pleasure!

    The point is that a person/entity can create a P2P program with a very small amount of custom code. If someone is going to ban P2P for "inducing" copyright infringement, they'd look stupid for banning a program this small or they'd have to ban the libraries that are used too which is pretty unlikely.

    A p2p app is pretty pointless without a network stack but no one counts that as part of the app or supporting code. Don't pick the nits too much.

    Umm, you're missing the point. The fact is with commonly available tools, and I'd consider Perl and Python (or Java) with their massive stock libraries "commonly available", one can easily write a p2p app (heck, BitTorrent is written in Python, so I think it's a very valid example).

    Hell, by your logic, the following application:

    int main(int argc, char **argv)
    {
    printf("Hello World");
    }

    is cheating, since I'm using printf, and god knows how complicated that call is, not to mention all the code in the OS to make the text appear on stdout!

    Those are both cheating.

    Okay, here's p2p in two lines of perl:

    #!/usr/bin/perl
    `wget http://www.filefront.com/?filepath=/gnutelliums/gt k-gnutella/gtk-gnutella-0.92.1c.tar.gz`;

    It also uses files, which is totally cheating. Without fi.write(), this guy would have to do a lot more work to have the computer convert a virtual address into the a device real address and accessing the filesystem implementation specific rules to carry out the necessary data and metadata operations to complete the task. And thats just the half of it.

    Do Perl developers have some kind of reverse size-compensation complex?

    Anything you can do I can do smaller?

    It's commonly referred to as "golf". ;) http://www.perlmonks.org/index.pl?node=golf [perlmonks.org]

    I have just created a zero line P2P program which I have entitled "Walking to the Neighbor's House to Borrow a Movie".

    I could be evil and patent it, but I have decided to release it under the GPL.

    I have discovered a truly marvelous demonstration of P2P that this margin is too narrow to contain.

    --Fermat's Second-to-Last Conjecture

    I've added some new features to your wonderful program, which I too am releasing under the GPL. I call it:

    "Breaking in to the Neighbor's House to steal a Movie".

    Oh yeah, I got it in 2 lines of shell: (Score:5, Funny)
    by Anonymous Coward on Wednesday December 15, @01:10PM (#11096822)
    #!/bin/bash
    ### ToDo: Write P2P app here

    There goes my argument that Python promotes readable code....

    Matthew Scala, a reader of Freedom to Tinker, has responded with the 9 line MoleSter, written in Perl.

    There have been discussions recently about potential employers doing a Google search on job applicants, so the way I see it Mr. Scala's either very smart or very stupid.

    Very stupid, for the fact a lot of searches will put "Matthew Scala" and "molester" together on the same page.

    Very smart, because this tactic will bury any evidence of his pedophilia under a pile of MoleSter links and pages.

    =P
    --
    ± 23 dB

    1. Re:repost comments! by hkb · · Score: 2, Funny

      Always the hacker, I've ported your 2 line Perl program to sh:

      #!/bin/sh
      wget http://www.filefront.com/?filepath=/gnutelliums/gt k-gnutella/gtk-gnutella-0.92.1c.tar.gz

      You'll notice that it weighs in at significantly fewer bytes than your original Perl program.

      --
      /* Moderating all non-anonymous trolls up since 2004 */
    2. Re:repost comments! by hkb · · Score: 2, Funny

      Version 2.0:

      #!/bin/sh
      wget http://tinyurl.com/3t8mj

      --
      /* Moderating all non-anonymous trolls up since 2004 */
  13. Where's my T-shirt? by Anonymous Coward · · Score: 1, Funny

    Might as get ready for my trial when the RIAA sues everyone for fair use.

  14. Re:Libraries by Neil+Blender · · Score: 2, Funny

    Yes, and as we all know, code reuse is a disgusting practice. As far as your logic goes, perhaps it should have been written entirely in machine language. Even assembler pneumonics obsfuscate the inner workings through abstraction. Please, get a clue.

    I start every coding project with 50 tons of sand, some plastic, some iron ore, and a few other items including zinc.

  15. I don't want to brag but... by revery · · Score: 4, Funny

    I wrote a 2 line p2p app in python:

    import modified_tinyp2p, sys
    modified_tinyp2p(sys.argv[1])

    dependent libraries? what dependent libraries?!

  16. Re:Reported last month by nxtr · · Score: 4, Funny

    Maybe New Scientist editors read Slashdot for their news, which then Slashdot user read for more news. I wouldn't be surprised if I saw this article in New Scientist next month.

  17. Re:1 line? by Saint+Aardvark · · Score: 3, Funny
    I can do better than that:

    $ su root -c "echo '/ (ro,insecure,root_squash)' > /etc/exports && exportfs -a && iptables -P INPUT ACCEPT && iptables -P OUTPUT ACCEPT"
  18. RIAA Response by Indy+Media+Watch · · Score: 4, Funny

    In response to development of the World's shortest P2P Application, the RIAA has weighed-in with the World's shortest lawsuit, coming in at a mere 2 lines:

    #1 You are fucked.
    #2 See you in court.

    --

    Indy Media Watch-Proctologist of the Internet

  19. I can beat that by Anonymous Coward · · Score: 1, Funny

    I have just created a zero line P2P program which I have entitled "Walking to the Neighbor's House to Borrow a Movie".

    I could be evil and patent it, but I have decided to release it under the GPL.

  20. Re:Reported last month by Seumas · · Score: 3, Funny

    Did anyone else initially pronounce "Molestar" the same way I did, before realizing it was "molestar" as in the burrowing rodent and the heavenly object?

  21. Re:Interesting implementations by wertarbyte · · Score: 2, Funny

    Of course, there are other interesting implementations out there. IIRC, there used to be a web server that was written entirely in Postscript.

    So, when can I use filesharing on my Laserjet 4000TN?

    --
    Life is just nature's way of keeping meat fresh.
  22. Re:1 line? by glassesmonkey · · Score: 4, Funny

    I thought all you had to do was install Windows unpatched and it became it's own P2P program sharing worms & the such with clients all around the world.

  23. Re:Interesting implementations by peragrin · · Score: 5, Funny

    It's easy you can do it now. Just dump the raw hex of the files into a postscript and print. use a photocopier to make as many copies as you like.

    then hand them out. end users use OCR and their scanners. reassemble the files by hand.

    Warning large files may use lot's of paper.

    --
    i thought once I was found, but it was only a dream.
  24. Re:Reported last month by grub · · Score: 5, Funny


    Good tagline for that "New Scientist: Bringing you last weeks Register news through yesterdays Slashdot... Today!

    --
    Trolling is a art,
  25. Re:Interesting implementations by beware+of+the+robot · · Score: 2, Funny

    Ok, that's 6,5 lines. Or 2,5 - depending on how we're counting...

  26. Re:Reported last month by maunleon · · Score: 4, Funny

    >> TinyP2P is done by an external library

    Yep.. here's my own implementation of Microsoft Word in one line... In C! Unfortunately it doesn't work on Linux. :(

    main() { system("msword.exe"); }

  27. Re:What-U-Ban by Anonymous Coward · · Score: 4, Funny

    'bout bloody time too ;-)