Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

post bits of code you like

Name: Anonymous 2005-08-02 1:52

i shall start:

open(F,"find -type f|");
while (<F>) {
 $_ = substr($_,2,-1);
 print "$_\n" if $v;
 push @{$dups{substr(`md5sum -b "$_"`,0,31)}}, $_;
}
close(F);

for every file in a directory it checksums the file, then adds the checksum as a key to a hash, the value being an array reference. the filename is then added to the array.

so basically the arrays have a list of files with the same checksum. i use this to find duplicates files.

Name: Anonymous 2006-04-24 5:13

>>154
MessageBox(NULL, "Fail", "Error", MB_OK | MB_ICONSTOP);

Name: Anonymous 2006-04-25 8:13

>>160
Perl is good for you, good for *nix, learn it or STFU.

Name: Anonymous 2006-04-25 8:17

>>162
Perl is bad for you, mediocre for *nix, learn it and waste your time.

Name: Anonymous 2006-04-25 8:19

You don't like Perl? Don't you use it, Larry Wall is not going to kick your ass if you don't use his language, duh.

Name: Anonymous 2006-04-25 8:20

>>163
Perl is good for me, why do you propose as a replacement? Can you do it for me? No? I knew it...

Name: Anonymous 2006-04-25 8:23

>>163
lol python fanboi is coming!!!!

Name: Anonymous 2006-04-25 8:52

>>165
It's not good for you. Pick any other popular scripting language; the fact they're all better is a testament of Perl's shittiness. Okay, fine, PHP sucks more than Perl. Happy?

>>166
I don't like Python much, and I'd never use it for sysadmin tasks or text munging (outside of unicode, because I can tell you from first-hand experience that Perl sucks balls at unicode). The "pythonic way" is for fags.

But hey, if thinking I like Python makes you feel better about Perl, go right for it. Take some more stabs in the dark, it'll clearly make Perl stop sucking, right? All those ugly symbols, hundreds of nuances in syntax, nightmarish syntax for anything fancier than the basic data types, painful OO, and a million things I hope I'll never need to touch again, all of it will go away.

The only thing Perl still has going for it is CPAN, and the others are slowly catching up.

Name: Anonymous 2006-04-25 10:21

>>165
I can't, but Guido Van Rossum can :P .

>>167
PHP sucks more than Perl.
I disagree. In functionality, surely, but not in syntax, and I'll take "ugly function names/params" over "completely unreadable and designed by a 12 year old". Sometimes I know what Perl will do but I really don't have a clue how is the parser able to tell. And this uncertainty is pretty uncomfortable and prone to errors. I'd tell the guys who designed Perl (if it was ever designed) to fucking grow up.

I'd never use it for sysadmin tasks or text munging
Of course, I don't like it much for that either, that's where I like PHP.

The "pythonic way" is for fags.
I use the Anonymousic way; I do it the way it pleases Anonymous, regardless of language.

Name: Anonymous 2006-04-25 10:57

>>168
PHP's syntax is certainly more sane than Perl's. My main gripe with PHP is more related to things like magic quotes, DB interfaces, and related security issues. You can also do some crazy thing in Perl that aren't possible in PHP.

However, my experience with PHP is limited, so I'll defer to your judgement.

Name: Anonymous 2006-04-25 12:10

>>169
Oh, yes, I understand. Magic quotes and register globals are pure evil and should be wiped from the face of Earth. For a standard DB interface I like ADODB Lite. It's fast and supports lots of DBs. You don't really need these crazy things except in very exceptional cases and there's always a workaround for them. I'll also add that some things like lambda functions are uncomfortable in PHP, but I think it's overall good for web hacks, web applications (as long as you don't write messy code, but that's a problem of most languages), and system scripts.

PHP has a bad name because it's easy to get started with it, and noobs get started and write really terrible code. A good programmer at Perl or Python would write good, maintainable code at PHP.

Name: Anonymous 2006-04-25 13:29

>>170
What is this "register global" thing? Sorry, I've only been using PHP for 5 years :( </sarcasm>

Name: Anonymous 2006-04-25 17:07

>>160
WARNING: LISP WEENIE

Name: Anonymous 2006-04-25 17:08

>>168
>Sometimes I know what Perl will do but I really don't have a clue how is the parser able to tell.
RTFM

Name: Anonymous 2006-04-25 19:14

>>173
You don't get the main point. The syntax is so obscure and ambiguous it's dangerous.

Name: Anonymous 2006-04-25 21:01

>>174
FUCKING SIGNED

Name: Anonymous 2006-04-25 23:50

#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_
            _-_-_-_
}

Name: Anonymous 2006-04-26 4:49

>>176
Beautiful, but at least the syntax is not ambiguous and I can easily tell what C will do. It's a pain in the arse because of the way you have written it, but it doesn't rely on terribly ugly hacks like while (<>) to name the most basic one.

Name: Anonymous 2006-10-21 17:49

factorial=function(f){
if(f-f+1) return arguments.callee(function(){return f});
else return f()<2?1:arguments.callee(function(){return f()-1})*f();
}

Name: Anonymous 2006-10-21 18:23

>>177
Exactly!

Name: Anonymous 2006-10-22 0:41

ackermann function

function Ack(M, N) {
    if (M == 0) return( N + 1 );
    if (N == 0) return( Ack(M - 1, 1) );
    return( Ack(M - 1, Ack(M, (N - 1))) );
}

Name: Anonymous 2006-10-22 1:44

>>180
better:
function Ack(M,N){
return M?Ack(M-1,N?Ack(M,N-1):1):N+1;
}

Name: Anonymous 2006-10-22 10:09

>>181
better:
function number_of_people_who_care_about_this_crap() {
    return 0;
}

Name: Anonymous 2006-10-22 14:45

>>181
better:
ack 0 n = n + 1
ack m 0 = ack (m - 1) 1
ack m n = ack (m - 1) (ack m (n - 1))

Name: Anonymous 2006-10-22 15:00

>>183
fails for not working in my browser.
also fails for shitty syntax.

Name: Anonymous 2006-10-22 17:14

>>184
Fail for shitty browser; Haskell rocks, bitch.

Name: Anonymous 2006-10-22 18:27 (sage)

>>185
what browser supports haskell? oh that's right, none. stfu, bitch.

>>183 is just as wrong-headed as >>180. that function is not that complicated, so stop trying to make it look like it is.

Name: Anonymous 2006-10-22 20:11

Addition function

function add(a, b) {
    return a+b
}

Name: Anonymous 2006-10-23 5:05

>>186
Firefox, ELinks.  You'd have to add Haskell support first though, but it's not very hard as ELinks already supports a dozen scripting languages, and Firefox supports Javascript and Python (lol).

Name: Anonymous 2006-10-23 6:50

Firefox, ELinks.  You'd have to add Haskell support first though,
rotflmao
i bet you're going to try to tell me w3m supports vbscript, too

Name: Anonymous 2006-10-23 7:18

>>189
Any browser with JavaShit support can support pretty much any language; you just have to write a foo->JS compiler/interpreter for it.

Name: Anonymous 2006-10-23 8:17

>>190
What?  Why, it's much easier to implement a scripting language normally than it is to translate it into JS lol.

>>189
I don't know about that, all I know is that w3m sucks.  And by sucks, I mean more than Lynx, which is known as the worst and most useless browser on the planet.  Unfortunately, some absolute retards have popularized it beyond what a single human can understand.  I want them all dead.  By noon tomorrow.

Name: Anonymous 2006-10-23 8:42 (sage)

>>191
w3m is much better than estinks and firefart.

Name: Anonymous 2006-10-23 9:15

>>192

YOU FAIL AT COMEDY

Name: jclark 2006-10-23 9:21

I set off one Sunday morning to do Jones, but the wind picked up so pre-apocalyptically I bailed and decided to try Leslieville’s new espresso bar. It was the least I could do to support my neighbourhood, which obviously I need to do more of.

I walk past the outside tables – don’t they need a fence? – and through the single door of this former Mr. Sub. A time machine assaults me in the form of mid-’90s indie punk rock played just one notch too loud. And so my troubles begin.

Who should be behind the counter but the severe, mysterious, formidable, deeply impressive and memorable barista from Balzac’s (q.v.) – the one with the rectangular glasses, the jet-black hair and hairless milky complexion, the zero-bodyfat forearms on whose insides are tattooed passages in Korean. (Hangul smatter?) I had chatted up this icy, unsmiling, offputting and alluring figure at Balzac’s, where he admitted the tattoos were “a gift” from former students. (How do you give a tattoo as a gift? The same way you give a pacemaker?)

This day, Korean Ink’s explanation for his presence at the new espresso bar amounted to a declaration this was his hood. (From an interview with Sting: “ ‘I read widely,’ he says in a tone that implies no one else does.”) I told him I recognized him from Balzac’s. Oh, that was two, three years ago, he replied dishonestly. I was served an excellent double espresso (long) for a mere $3. I had to ask for water, which I was instructed to pour myself. I used a communal spoon to strip-mine “organic cane sugar” from a hygienic uncovered jar. I sat and read my book.

Inopportunely, the book was The Underminer by Mike Albo, a glorified Web page with bad type that nonetheless is chillingly effective at connoting the kind of bound-for-success friend who stabs you in the chest with your own chopsticks. I read that thing in its entirety while sitting there and I kept thinking that life was imitating art. The uneven brown tiles; the tiny tables; the newspapers littering the counter and “bar” (more like a pew); the queasily atrocious off-beige of the “funky” used love seat and easy chair; and above all the third-rate washroom with its dirty floor (also tiled), too-small wastebasket, and toilet roll on a pipe jutting from the wall – it wasn’t shabby chic, it was just shabby. Jet Fuel looks like L’Auberge du Pommier by comparison.

But people streamed in. Streamed. A hopeful woman in her early 30s kept chatting up the tattooed proprietor for a job. Well, he said, he preferred to hire local. Supplicants come in but don’t always pass muster even if they live in the Beach or at Coxwell and Danforth – not quite Leslieville, local knowledge of which is apparently required to serve drinks invented across the Atlantic. (He gets his beans, not grown in Leslieville, from a facility, also not in Leslieville, run by the same arseholes who ran a shop at Danforth and Bowden. One day they instituted a $3.50 minimum purchase applicable solely to me. In a Pyrrhic victory, their other store burned down.)

While Korean Ink trained the plump teenage cashier with the multiple lip piercings and jet-black makeup that nothing must befall their one and only espresso machine, I sat there thinking: I know people act like this place is hip, but how can it be? I know I am not hip and never have been, and don’t actually care to be, and I am perfectly OK with all those facts, but how the fuck does this shit count as hip?

I dropped by a second time with a different book, Fun Home by Bechdel. Korean Ink wasn’t there, the music wasn’t making a statement, I was given what I wanted (I had to ask for water, but they poured it), there were now twice as many too-small garbage cans in the can, and I wondered what-all I had been worried about.

Yesterday was the tiebreaker. Guess who was back at work? I was last in line behind a newbie, who adopted the inexplicable but now-familiar tone of supplication and appeasement in asking for explanations of the various drinks. I ordered a double long. What’s a double long? he asked, looking up. It’s not on the menu… I guess you just have to know it? It’s an espresso but we run it through a bit more, Korean Ink expressionlessly repled. Ordinarily we don’t do that. Most of the time we serve espresso short, which is better for a minute-long sequence of ostensible reasons, including less of a need for sugar.

“That’s a matter of opinion,” I said as loudly as possible (only the cashier heard). I thought: Hadn’t you just finished defining a café americano as an espresso drink with the feel of regular coffee? How is quadruple the water OK but 20% more isn’t?

The hardest thing I drink is espresso. I am following the Lesliebucks and I attend the Starbucks 1 in the Beach when I really need to be treated especially well, but I am not an apologist. In fact, I plan my comings and goings to coincide with the high-quality joints. (I know who serves Illy in this town complete with the tiny musical-note spoons.) If I were an Italian businessman bouncing from bar to bar on my Vespa, sure, espresso short would be fine. For my purposes, it isn’t. No matter how vulgaire Korean Ink thinks it is, I know what I want. I also know what makes a proper coffee house. This place ain’t got it.

And, as with Tango Palace, my opinion will continue to seem hopelessly contrarian and outnumbered – until the first snowstorm makes the single front door rather impracticable and everyone flees across the street to the warmth and welcome of the Lesliebucks.

Here’s to you, Mercury.

http://blog.fawny.org/2006/10/22/hg/

Name: Anonymous 2006-10-23 10:25

>>191
JS is a standard which many browsers implement. You implement a language in JS, it's immediately available on any standards-compliant browsers.

Name: Anonymous 2006-10-23 11:38

lol at PHP people actually whining about Perl. EVER HEARD OF NAMESPACES YOU HORRIBLE FAGGOT.

Name: Anonymous 2006-10-23 12:10

>>196
Namespace, is that what you Perl guys call the underscore?

>>195
I see, but that is a most inefficient and stupid solution.

Name: Anonymous 2006-10-23 12:40

>>195

Or you could just write it in Javascript from the start.

Name: Anonymous 2006-10-24 16:00

Hmm, code that impresses me....
  inc <foo
  bne +
  inc >foo
+ *some other code*
(where foo is some 16 bit integer)

Name: Anonymous 2006-10-26 9:42

>>199

What the fuck is that supposed to do?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List