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.
// ==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);
}
}
// ==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);
}
}
}<?php
print("ITT Expert programmers");
?>
sleep(2678400);
bampu();
cat /dev/random | perl
/* @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;
}
sudo su sudo sudo su sudo su sudo sudo su
cat /dev/random > /dev/dsp
sudo make me a sandwich