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

Pages: 1-

pastebin@/prog/

Name: Anonymous 2008-07-28 18:06

I'm tired of using Pastebin and similar sites when I want to post code on the imageboards, so here's a thread for that kind of crap.

Name: Anonymous 2008-07-28 18:07

// ==UserScript==
// @name           Filter /u/
// @namespace      http://dis.4chan.org/prog
// @description    Makes /u/ browsable.
// @include        http://orz.4chan.org/u/*;
// ==/UserScript==

var regexp=/<span class="filesize">/;
var list=document.evaluate(
    '//blockquote',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
for(var i=0;i<list.snapshotLength;i++) {
    var elem=list.snapshotItem(i);
    if(!elem.parentNode.parentNode.parentNode.innerHTML.match(regexp)){
        elem.parentNode.parentNode.parentNode.removeChild(elem.parentNode.parentNode);
    } else {
        elem.parentNode.removeChild(elem);
    }
}

Name: Anonymous 2008-07-28 18:11

Name: Anonymous 2008-07-28 18:20

Superior version, doesn't censor comments from posts containing links.

// ==UserScript==
// @name           Filter /u/
// @namespace      http://dis.4chan.org/prog
// @description    Makes /u/ browsable.
// @include        http://orz.4chan.org/u/*;
// ==/UserScript==

var regexp=/<span class="filesize">/;
var list=document.evaluate(
    '//blockquote',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
for(var i=0;i<list.snapshotLength;i++) {
    var elem=list.snapshotItem(i);
    if(!elem.innerHTML.match(/http/)){
        if(!elem.parentNode.parentNode.parentNode.innerHTML.match(regexp)){
            elem.parentNode.parentNode.parentNode.removeChild(elem.parentNode.parentNode);
        } else {
            elem.parentNode.removeChild(elem);
        }
    }
}


>>3
Neat, thanks.
http://sprunge.us/hQid?js

Name: Anonymous 2008-07-28 18:39

<?php
print("ITT Expert programmers");
?>

Name: Anonymous 2008-07-31 2:11

<?php
print("ITT Expert Exchange programmers");
?>

Name: Anonymous 2008-08-31 16:55

sleep(2678400);
bampu();

Name: Anonymous 2008-08-31 17:09

cat /dev/random | perl

Name: Anonymous 2008-08-31 17:13

>>8 perl /dev/random
OMG OPTIMIZED

Name: Anonymous 2008-08-31 17:29

/* @split.c */
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define INBUF_SIZE 65536

int l=1000;
int a=2;
int mode;
char *fname;
char *g_nam;
char inbuf[INBUF_SIZE];

int main(int argc, char **argv) {
 int i;
 char *j;
 FILE *infile, *outfile=0;
 char *nl=inbuf;
 char *inbufptr;
 int nr=0,cl=0,ret=0;

 g_nam=argv[0];
 while((i=getopt(argc,argv,"a:b:l:"))!=-1) {
  switch(i) {
  case 'a':
   a=atoi(optarg);
   break;
  case 'b':
   l=0;
   while(isdigit(*optarg))
    l=l*10 + *(optarg++) - '0';
   if(*optarg=='k')
    l*=1024;
   else if(*optarg=='m')
    l*=1048576;
   if(mode)
    goto usage;
   mode=2;
   break;
  case 'l':
   l=atoi(optarg);
   if(mode)
    goto usage;
   mode=1;
   break;
  default:
  usage:
   fprintf(stderr,"usage: %s [-l line_count] [-a suffix_len] [file [name]]\n       %s -b n[k|m] [-a suffix_len] [file [name]]\n",g_nam,g_nam);
   return 1;
  }
 }
 if(!l || !a) {
  fprintf(stderr,"%s: positive nonzero number expected\n",g_nam);
  return 1;
 }
 if(!mode)
  mode=1;
 if(argc-optind>1) {
  if(!(fname=malloc(strlen(argv[optind+1])+a+1))) {
  err_oom:
   fprintf(stderr,"%s: memory allocation error\n",g_nam);
   return 1;
  }
  strcpy(fname,argv[optind+1]);
 } else {
  if(!(fname=malloc(a+2)))
   goto err_oom;
  *fname='x';
  fname[1]=0;
 }
 for(j=fname+strlen(fname),i=a;i;i--,j++)
  *j='a';
 *(fname+strlen(fname)-1)='a'-1;
 if(argc-optind && strcmp(argv[optind],"-")) {
  if(!(infile=fopen(argv[optind],"rb"))) {
   fprintf(stderr,"%s: error opening %s: %s\n",g_nam,argv[optind],strerror(errno));
   return 1;
  }
 } else
  infile=stdin;
 cl=l; /* force creation of new file */
 while(1) {
 do_read:
  if(!nr) {
  do_read_read:
   if(!(nr=fread(inbuf,1,INBUF_SIZE,infile)))
    break;
   nl=inbufptr=inbuf;
  }
  if(cl==l) {
   int j;
   if(outfile)
    ret|=fclose(outfile);
   i=strlen(fname)-1;
   j=i-a;
   while(++(fname[i])=='z'+1) {
    fname[i]='a';
    i--;
    if(i == j) {
     fprintf(stderr,"%s: exceeded maximum names for suffix length\n",g_nam);
     ret=1;
     outfile=0;
     goto outer_end;
    }
   }
   if(!(outfile=fopen(fname,"wb"))) {
    fprintf(stderr,"%s: error creating %s: %s\n",g_nam,fname,strerror(errno));
    fclose(infile);
    return 1;
   }
   cl=0;
  }
  if(mode==1) { /* linemode */
   while(nl=memchr(nl,'\n',nr)) {
    cl++;
    nl++;
    if(cl==l) {
     if(fwrite(inbufptr,1,nl-inbufptr,outfile)!=(nl-inbufptr)) {
     write_err:
      fprintf(stderr,"%s: error writing %s: %s\n",g_nam,fname,strerror(errno));
      fclose(outfile);
      fclose(infile);
      return 1;
     }
     nr -= nl-inbufptr;
     inbufptr+=nl-inbufptr;
     goto do_read;
    }
   }
   if(fwrite(inbufptr,1,nr,outfile)!=nr)
    goto write_err;
   goto do_read_read;
  } else { /* blockmode */
   if(nr>=l-cl) {
    if(fwrite(inbufptr,1,l-cl,outfile)!=l-cl)
     goto write_err;
    nr-=l-cl;
    inbufptr+=l-cl;
    cl=l;
    goto do_read;
   } else {
    if(fwrite(inbufptr,1,nr,outfile)!=nr)
     goto write_err;
    cl+=nr;
    goto do_read_read;
   }
  }
 }
 outer_end:
 if(ferror(infile)) {
  fprintf(stderr,"%s: error reading input file: %s\n",g_nam,strerror(errno));
  ret=1;
 }
 if(infile!=stdin)
  ret|=fclose(infile);
 if(outfile)
  ret|=fclose(outfile);
 return ret;
}

Name: Anonymous 2008-08-31 18:16

Name: Anonymous 2008-08-31 21:43


sudo su sudo sudo su sudo su sudo sudo su
cat /dev/random > /dev/dsp

Name: Anonymous 2008-08-31 23:03

sudo make me a sandwich

Name: Anonymous 2008-09-01 0:38

>>11
the doctorow thing is pretty wwwwwwwww

Name: Anonymous 2008-09-01 5:38

Could Shii get any more predictable and whiny? His ego is so inflated I'm surprised it doesn't burst.

Name: Anonymous 2008-09-01 10:20

Shii is all I think about every day. I sometimes cry myself to sleep at night thinking about how I'll never be with him.

Name: Anonymous 2008-09-01 12:29

Sussman is all I think about every day. I sometimes cry myself to sleep at night thinking about how beautiful scheme code in SICP is.

Name: Anonymous 2008-09-01 12:30

>>13
sudo copy jokes from a website instead of thinking

Name: Anonymous 2008-09-01 12:56

>>18
Nonono... the problem is not that he copies jokes, but where he copies them from.
Although after some thinking, I think that we can agree that he has two problems.

Name: Anonymous 2008-09-02 5:05

for more Shii writing goodness http://www.nanowrimo.org/eng/user/75180

Name: Anonymous 2008-11-20 11:04

Link to Shii's review of Doctorow's book? I lost it.

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