World's Shortest P2P App: 15 Lines 443
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."
bet i could write a 15 line (Score:5, Funny)
I can do better (Score:5, Funny)
Thank god! (Score:3, Funny)
Instead of talking about the repost (Score:2, Funny)
Re:Speaking of dupes... (Score:2, Funny)
Re:1 line? (Score:5, Funny)
Shortest lawsuit... (Score:2, Funny)
how come no one (Score:3, Funny)
Re:Why TinyP2P when you have MoleSter (Score:1, Funny)
Perl is Barbaric.
People who use Perl are Barbarians.
Python? (Score:4, Funny)
Re:Duplicate... (Score:5, Funny)
repost comments! (Score:5, Funny)
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/g
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".
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
Where's my T-shirt? (Score:1, Funny)
Re:Libraries (Score:2, Funny)
I start every coding project with 50 tons of sand, some plastic, some iron ore, and a few other items including zinc.
I don't want to brag but... (Score:5, Funny)
import modified_tinyp2p, sys
modified_tinyp2p(sys.argv[1])
dependent libraries? what dependent libraries?!
Re:Reported last month (Score:4, Funny)
Re:1 line? (Score:4, Funny)
Re:bet i could write a 15 line (Score:5, Funny)
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! :)
RIAA Response (Score:5, Funny)
#1 You are fucked.
#2 See you in court.
I can beat that (Score:1, Funny)
I could be evil and patent it, but I have decided to release it under the GPL.
Re:bet i could write a 15 line (Score:3, Funny)
Re:Reported last month (Score:3, Funny)
Re:bet i could write a 15 line (Score:1, Funny)
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
Re:bet i could write a 15 line (Score:3, Funny)
Re:Interesting implementations (Score:3, 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?
Re:1 line? (Score:5, Funny)
Re:Interesting implementations (Score:5, Funny)
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.
Re:bet i could write a 15 line (Score:5, Funny)
Exactly. To wit:
Piece of cake!Re:repost comments! (Score:3, Funny)
#!/bin/sh
wget http://www.filefront.com/?filepath=/gnutelliums/g
You'll notice that it weighs in at significantly fewer bytes than your original Perl program.
Re:repost comments! (Score:3, Funny)
#!/bin/sh
wget http://tinyurl.com/3t8mj
Re:Reported last month (Score:5, Funny)
Good tagline for that "New Scientist: Bringing you last weeks Register news through yesterdays Slashdot... Today!
Re:Interesting implementations (Score:2, Funny)
Re:Reported last month (Score:5, Funny)
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"); }
Re:What-U-Ban (Score:4, Funny)