pouët.net

Random line of code thread

category: code [glöplog]
Code: $shorturl = file_get_contents("http://71nk.com/api/?url=$urlencode");


From http://71nk.com/l072b0
int x;
int y;
int summ;

summ=x+y;
print summ;
Code: char *szFragment = "float t=dot(gl_Color.xyz,vec3(1,256,65536)*11),r;vec2 o=vec2(gl_FragCoord)" ",c=vec2(512+sin(t*.01)*512,388)-o,e=c;void main(){int w=int(t+(o.x+o.y*512" ")*33);e.x-=2*sin(t*.01)*512;r=(16512+512*sin(t*.5))/dot(c,c)+16512/(e.x*e." "x);r=r>2?(sin(o.x*o.y)-normalize(e).x)/r:r*.3;gl_FragColor+=r*.3+o.y*.001*" "vec4(.2,.2,.05,1)+(w*w*w&0xFFFFFFF)*.0000000005+(int((o.x+o.y)*.01)&1)*.02" ";}";


Btw Ferris, every code can be written as a single line of code. Thus anything goes! :P
added on the 2009-04-22 09:10:48 by decipher decipher
apparently pouet fucked it up... but oh well, it's the shader from this
added on the 2009-04-22 09:12:39 by decipher decipher
some may not know it:

BB Image
Code: /* smoothstep*/ float t = 0.1; t = (t*t) * (3.0f - 2.0f * t); float a = 0; float b = 1; return (a * (1.0f -t)) + (b * t);


(with some tweaks, it sounds smooth, too ;))
added on the 2009-04-23 01:54:15 by xyz xyz
@Decipher: Preprocessor?? :P
added on the 2009-04-23 03:40:39 by ferris ferris
macaw, why the urlencode?
added on the 2009-04-23 09:34:34 by skrebbel skrebbel
Quote:
Btw Ferris, every code can be written as a single line of code. Thus anything goes! :P

Except python!
added on the 2009-04-23 09:58:06 by LiraNuna LiraNuna
python -c 'exec("while True:\n\tprint \"LiraNuna is not right!\"")'
added on the 2009-04-23 12:00:16 by KeyJ KeyJ
skrebbbbbel, to encode the url? :)
Code: float zinv(float z) { //return (zFar*zNear / (zFar - z*(zFar-zNear)) - zNear) / (zFar - zNear); //return zFar*zNear / (zFar - z*(zFar - zNear)); //return (-(1.0/zNear - 1.0/z) / (1.0/zNear - 1.0/zFar) - zNear) / (zFar - zNear); //return 0.0; //(z - zNear)/(zFar - zNear); return 1.0-(zNear*zFar/(zFar - z*(zFar-zNear))-zNear)/(zFar-zNear); }


\mfx_utmw\glsl\depth.fs :)
added on the 2009-04-29 09:52:53 by hornet hornet
Code:template <typename R, typename A1, typename A2, typename A3, typename A4> inline SignalSlot4<R,A1,A2,A3,A4>* Signal4<R,A1,A2,A3,A4>::connect(typename GlobalSlot4<R,A1,A2,A3,A4>::Function function) { return connect(new GlobalSlot4<R,A1,A2,A3,A4>(function)); }
Here's my random number generator. It's lousy, it's not been tested in all situations, but somehow it seems to work ok. ;)

ARM code
Code: REM Creates a new random number in m0, affects flags DEFFNrandom(m0):[opt opt%:rsb m0,m0,m0,ror#11:]


68000 code
Code: ;IN \1.l=random number ;OUT \1.l=new random number ; \2.l killed RANDOM MACRO move.l \1,\2 ror.l #7,\1 ror.l #4,\1 sub.l \2,\1 ENDM


ARM rules!
Hi MrHill ;)
added on the 2009-05-04 11:49:48 by baah baah
baah: it's incorrectly documented, though. RSB doesn't affect flags - RSBS does. ;)
added on the 2009-05-04 12:21:12 by kusma kusma
@moose: Yup, sorry... My previous version was 2 instructions long and used an S version... I knew i shouldn't put comments! ;)
added on the 2009-05-04 12:56:14 by baah baah
baah: Wrong comments are worse than no comments ;)
added on the 2009-05-04 14:52:38 by kusma kusma
Well, here's my standard random number generator. It too is crap, wastes too many cycles, is system dependant etc etc (still it's faster than the system routine ;)). I use it mostly for precalcs though so I don't mind!

Code: move.l $466.w,d2 rol.l #8,d2 add.l seed(pc),d2 sub.b $ffff8209.w,d2 move.l d2,seed
added on the 2009-05-04 15:04:16 by すすれ すすれ
well, they have an obvious error in their code
Code: $longurl = "http://science.slashdot.org/article.pl?sid=09/04/21/045243"; $longurl = urlencode($longurl); $shorturl = file_get_contents("http://71nk.com/api/?url=$urlencode"); echo $shorturl;

see if you can spot it..
added on the 2009-05-04 16:02:20 by bartman bartman
Code: $shorturl = file_get_contents("http://71nk.com/api/?url=$longurl");
added on the 2009-05-05 00:57:19 by furrtek furrtek
macaw, but isn't it rediculous to urlencode an URL? i mean, i'm quite sure that the URL standard allows for all URL characters to appear in an URL. if there would be illegal characters in there, it wouldn't be a valid URL to begin with, so it wouldn't work, right? i.e. why not just http://71nk.com/api/?http://bla.com/~tuut/crap_banana and read $_SERVER['QUERY_STRING']?

but yeah, i'm nitpicking. now go make a jsonp interface!
added on the 2009-05-06 12:41:50 by skrebbel skrebbel
Code: uniform sampler2D RandTex; // <- 32x32 full noisy texture vec4 Rand(const in vec2 p) { return texture2D(RandTex, p); } float PerlinNoise(in vec2 p) { float color = 0.0; color += 0.5000000*Rand(p*0.5).r; color += 0.2500000*Rand(p*1.0).r; color += 0.1250000*Rand(p*2.0).r; color += 0.0625000*Rand(p*4.0).r; color += 0.0312500*Rand(p*8.0).r; color += 0.0156250*Rand(p*16.0).r; return color; } void main() { gl_FragColor = PerlinNoise(gl_TexCoord[0].xy*0.1); }
added on the 2009-05-06 13:58:56 by Anat Anat
JMP 0xFE
Code: return $this->htmlRender->renderFormElement( array( 'element' => 'text', 'name' => 'attr_'.$attr['attr_id'], 'class' => '', 'label' => $attr['label'], 'id' => 'attr_'.$attr['attr_id'] ) );
added on the 2009-05-07 16:07:27 by d0DgE d0DgE
heres my 68k "random" number generator:

[code] ror.l d7,d7
addq #$b00b,d7
added on the 2009-05-07 16:10:56 by xeron xeron
[/code] fail
addq fail
.w fail

=> fail generator \o/
added on the 2009-05-07 16:17:24 by StingRay StingRay

login