pouët.net

Random line of code thread

category: code [glöplog]
rgb_map[i] = (fx_b&0xFF) | ((fx_g&0xFF)<<8) | ((fx_r&0xFF)<<16);
added on the 2009-11-16 19:55:19 by xteraco xteraco
RewriteRule ^(.+\.(jpg|png|gif|ico|js|css|htc))$ ?inc=$1 [NC,L]
added on the 2009-11-16 21:46:42 by GottZ GottZ
s.run();
added on the 2009-11-16 22:22:08 by thec thec
QApplication application; return application.exec();
added on the 2009-11-16 22:52:04 by decipher decipher
wr0 = wvalue & 12297829382473034410ul;
added on the 2009-11-16 23:01:10 by patson patson
print read http://www.rebol.com
added on the 2009-11-16 23:42:08 by skrebbel skrebbel
$aCurrentArticle = $oCurrent->getVersion(intval($aRequest['version']));
added on the 2009-11-17 00:14:13 by stijn stijn
rotozoomer in proce55ing

BB Image

Code:int w=512,T,N,I,Y;void setup(){size(w,w,P2D);}void draw(){float a=0,b=0,c=I,d=I++*.02,e=sin(d),f=e++*-cos(d);for(N=0;N++<w;a=d+=f,b=c+=-e)for (T=0;T<w;Y=int(a+=e))set(T++,N,(Y*w+int(b+=f)^Y)&255);}

MirandaIM IEView:


<!--MessageIn-->
<script>
chat.newmessage({
type : "message",
history : false,
incomming : true,
ava : "%\avatarIn%",
nick : "%\nameIn%",
text : "%\text%",
time : "%\time%",
date : "%\date%"
});
</script>
<!--hMessageIn-->
...
added on the 2009-11-17 09:20:59 by GottZ GottZ
Code: ushort log2sin[]={ 0xEB27, 0xCB27, 0xB870, 0xAB28, 0xA0DC, 0x9872, 0x9155, 0x8B2C, 0x85BD, 0x80E1, 0x7C7C, 0x787A, 0x74C9, 0x7160, 0x6E32, 0x6B3A, 0x6870, 0x65CF, 0x6353, 0x60F7, 0x5EBA, 0x5C97, 0x5A8D, 0x589A, 0x56BB, 0x54EF, 0x5335, 0x518B, 0x4FF1, 0x4E65, 0x4CE6, 0x4B73, 0x4A0C, 0x48B0, 0x475F, 0x4617, 0x44D9, 0x43A3, 0x4276, 0x4151, 0x4033, 0x3F1C, 0x3E0C, 0x3D03, 0x3C00, 0x3B03, 0x3A0C, 0x391A, 0x382E, 0x3746, 0x3664, 0x3586, 0x34AD, 0x33D8, 0x3307, 0x323B, 0x3172, 0x30AD, 0x2FEC, 0x2F2E, 0x2E74, 0x2DBD, 0x2D09, 0x2C58, 0x2BAB, 0x2B00, 0x2A58, 0x29B3, 0x2911, 0x2872, 0x27D4, 0x273A, 0x26A2, 0x260C, 0x2579, 0x24E7, 0x2458, 0x23CC, 0x2341, 0x22B8, 0x2232, 0x21AD, 0x212A, 0x20A9, 0x202A, 0x1FAD, 0x1F31, 0x1EB7, 0x1E3F, 0x1DC9, 0x1D54, 0x1CE0, 0x1C6F, 0x1BFE, 0x1B90, 0x1B22, 0x1AB7, 0x1A4C, 0x19E3, 0x197C, 0x1915, 0x18B0, 0x184D, 0x17EA, 0x1789, 0x1729, 0x16CA, 0x166D, 0x1611, 0x15B5, 0x155B, 0x1502, 0x14AB, 0x1454, 0x13FE, 0x13AA, 0x1356, 0x1304, 0x12B2, 0x1262, 0x1212, 0x11C4, 0x1176, 0x1129, 0x10DE, 0x1093, 0x1049, 0x1000, 0x0FB8, 0x0F71, 0x0F2A, 0x0EE5, 0x0EA0, 0x0E5D, 0x0E1A, 0x0DD7, 0x0D96, 0x0D56, 0x0D16, 0x0CD7, 0x0C99, 0x0C5B, 0x0C1F, 0x0BE3, 0x0BA8, 0x0B6D, 0x0B34, 0x0AFB, 0x0AC2, 0x0A8B, 0x0A54, 0x0A1E, 0x09E9, 0x09B4, 0x0980, 0x094C, 0x091A, 0x08E7, 0x08B6, 0x0885, 0x0855, 0x0826, 0x07F7, 0x07C9, 0x079B, 0x076E, 0x0742, 0x0716, 0x06EB, 0x06C0, 0x0696, 0x066D, 0x0644, 0x061C, 0x05F4, 0x05CD, 0x05A7, 0x0581, 0x055B, 0x0537, 0x0512, 0x04EF, 0x04CC, 0x04A9, 0x0487, 0x0465, 0x0444, 0x0424, 0x0404, 0x03E5, 0x03C6, 0x03A8, 0x038A, 0x036D, 0x0350, 0x0334, 0x0318, 0x02FD, 0x02E2, 0x02C8, 0x02AE, 0x0295, 0x027C, 0x0264, 0x024C, 0x0235, 0x021E, 0x0208, 0x01F2, 0x01DD, 0x01C8, 0x01B4, 0x01A0, 0x018D, 0x017A, 0x0168, 0x0156, 0x0144, 0x0133, 0x0123, 0x0113, 0x0103, 0x00F4, 0x00E5, 0x00D7, 0x00C9, 0x00BC, 0x00AF, 0x00A3, 0x0097, 0x008C, 0x0081, 0x0076, 0x006C, 0x0062, 0x0059, 0x0050, 0x0048, 0x0040, 0x0039, 0x0032, 0x002C, 0x0026, 0x0020, 0x001B, 0x0016, 0x0012, 0x000E, 0x000B, 0x0008, 0x0006, 0x0004, 0x0002, 0x0001, 0x0000, 0x0000}; //3 bit integer part; 13 bit fraction part; every value is (of course) negated

I have no idea how this can be even remotely useful.
Inspired very loosely by the lookup tables in the Yamaha OPL2/OPL3 chip rom
well, at least I got some practice generating formatted text using C#

before you folks poke fun at me for using C#, I will be taking C++ in the fall semester of 2010,
and I did have some experience in plain old C before I got into college
added on the 2009-11-29 21:32:12 by QUINTIX QUINTIX
Code: move.l tf_CharData(a5),a5 ; use font data to create logo
added on the 2009-11-30 15:16:40 by StingRay StingRay
Stingray: please don't let that font data be topaz8...
atm it is (heavily raped tho!), if I have some space left once everything else is finished I'll see about changing it. =)
added on the 2009-11-30 15:26:32 by StingRay StingRay
Code: drawdot -rf @plasma $calc(128 + 128 * $sin(%x) + 128 + 128 * $sin(%y)) 1 %x %y
g,w,h,c,f,j,m[4444],n,e,b=8,k=1,o,G=15104;char t[1111],d[1<<24],*q,*p,*r[4444],_[1<<25];short z[333],u[7]={18759,14406,24889},x[10]={8448,1273,0,0,11264};F(){for(f=0;f<1&l t;<o;z[f]=f,r[f]=z+f,m[f++]=1);c=f++;e=f++;n=f;}l(s){f=-1;for(j=0;j<n;j++)i f(m[j]==s&&!memcmp(q,r[j],s))f=j;return f;}y(a){for(j=n-1;j;j/=2)_[b/8]|=(a&1)<<(b&7),a/=2,_[b/8-k]=k,k+=! (++b&7),k>>8?b+=8,k=1:0;}main(int i,char**v){read(f=open(*++v,32768),z,54);u[3]=x[7]=w=z[9];u[4]=x[8]=h=z[11];j=z[ 23];j=j?j:256;read(f,t,j*4);for(i=h;i--;read(f,z,-w&3))read(f,d+i*w,w);for(j- -;j;j/=2)F(o++);y(c);for(p=q=d;p<d+w*h;p++)if(l(p-q+1)<0)y(l(p-q)),n>> ;12?F(y(c)):(r[n]=q,m[n++]=p-q+1),q=p;y(l(p-q));y(e);u[5]=240|o-1;x[9]=o<<8 ;write(f=open(*++v,33538,384),u,13);for(i=0;i<1<<o+2;i+=4)e=t[i],t[i]=t[ i+2],t[i+2]=e,write(f,t+i,3);write(f,1+(int)x,19);write(f,_,(b+7)/8);write(f,& ;G,2);}
added on the 2009-11-30 23:21:00 by neon neon
.a2000 inc $d020
.a2003 jmp $a2000
.g2000
added on the 2009-11-30 23:25:20 by thec thec
INCLUDE rotozoom2.asm

RAM
IF *>0x800
FAIL FotoFrame ram limit exceeded (RAMptr>0x800)
ENDC
USED_RAM EQU * - 0x0400
nop

ROM
IF *>0x7FFF
FAIL FotoFrame ROM limit exceeded (ROMptr>=0x8000)
ENDC
USED_ROM = * - 0x4000
added on the 2009-12-01 00:44:31 by avoozl avoozl
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_name_t, int> > Graph;
typedef boost::iterator_property_map<PositionVec::iterator, boost::property_map<Graph, boost::vertex_index_t>::type> PositionMap;
PositionMap positions( positionv.begin(), get(boost::vertex_index, g));
boost::mt11213b generator;
random_graph_layout( g, positions , -5.f, 5.f, -5.f, 5.f, generator );
fruchterman_reingold_force_directed_layout( g, positions , 10.0f, 10.0f);
added on the 2009-12-01 00:46:37 by avoozl avoozl
Premier = DieDie(DieBold); //DMCA
if (counter == test_timestamps.length) break outerloop;
added on the 2009-12-03 13:56:19 by bdk bdk
int i=15*68;
added on the 2009-12-03 13:59:38 by harism harism
Code: ; 306,252,132 PRINTT PRINTT "Effect:" PRINTV *-Effect PRINTT PRINTT "SPACE LEFT:" PRINTV 1024-(*-START) PRINTT


\o/
added on the 2009-12-03 15:15:35 by StingRay StingRay
Here is the distance function for the mandelBulb. ready to plug in your favorite raymarcher for playing. :)

Code: float distanceFunc( vec3 z, float n_iter ) { float R = length(z); float th = atan(z.y, z.x); float ph = asin(z.z / R); vec3 dz; vec3 c = z; float ph_dz = 0.0; float th_dz = 0.0; float R_dz = 1.0; const float threshold = 4.0; const float p = power; // power most likely = 8, but it is possible to try others. const float pm1 = p-1.0; for (float i = 0.0; i < n_iter; i += 1.0) { float powRpm1 = p * pow(R, pm1) * R_dz; float phidz = ph_dz + pm1 * ph; float thetadz = th_dz + pm1 * th; float pcosphidz = powRpm1 * cos(phidz); dz.x = pcosphidz * cos(thetadz) + 1.0; dz.y = pcosphidz * sin(thetadz) ; dz.z = powRpm1 * sin(phidz) ; R_dz = length(dz); th_dz = atan(dz.y, dz.x); ph_dz = asin(dz.z / R_dz); float powRp = pow( R, p ); float phip = p * ph; float thetap = p * th; float pcosphip = powRp * cos(phip); z.x = pcosphip * cos(thetap) + c.x; z.y = pcosphip * sin(thetap) + c.y; z.z = powRp * sin(phip) + c.z; R = length(z); if ( R > threshold ) break; th = atan(z.y, z.x); ph = asin(z.z / R); } return 0.5 * R * log(R) / R_dz; }

added on the 2009-12-03 18:29:34 by nystep nystep
As a special bonus, here's 2 lines.

10 print "hello world"
20 goto 10
mov eax, 13h
int 10h
added on the 2009-12-03 22:56:15 by flure flure

login