pouët.net

Go to bottom

Random line of code thread

category: code [glöplog]
while ($drow = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($drow["title"]) {
$musicURL = ReturnMusicURL($drow["Path"]);
$lengthinseconds = ($drow["CueOut"] - $drow["CueIn"]);
$response .= "{\"ID\":" . $drow["id"] . ",";
$response .= "\"StationID\":" . $StationID . ",";
$response .= "\"StationName\":\"" . $StationName . "\",";
$response .= "\"Title\":\"" . superentities($drow["title"]) . "\",";
$response .= "\"Fullartist\":\"" . superentities($drow["fullartist"]) . "\",";
$response .= "\"Album\":\"" . superentities($drow["Album"]) . "\",";
$response .= "\"Image\":\"" . ReturnImageType($drow["Album"]) . "\",";

(...)
added on the 2026-06-21 00:07:20 by stripecat stripecat
random wav lib i made for a os
Code:#include "wav.h" #include "../string.h" // for memcmp, memcpy static uint32_t rd32(const uint8_t* p) { return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); } static uint16_t rd16(const uint8_t* p) { return (uint16_t)p[0] | ((uint16_t)p[1] << 8); } int wav_parse(wav_t* out, const uint8_t* buf, size_t size) { if (size < 44) return 0; // RIFF + WAVE if (memcmp(buf, "RIFF", 4) != 0) return 0; if (memcmp(buf + 8, "WAVE", 4) != 0) return 0; size_t pos = 12; while (pos + 8 <= size) { const uint8_t* chunk = buf + pos; uint32_t chunk_size = rd32(chunk + 4); if (memcmp(chunk, "fmt ", 4) == 0) { out->audio_format = rd16(chunk + 8); out->channels = rd16(chunk + 10); out->sample_rate = rd32(chunk + 12); out->byte_rate = rd32(chunk + 16); out->block_align = rd16(chunk + 20); out->bits_per_sample= rd16(chunk + 22); } if (memcmp(chunk, "data", 4) == 0) { out->data = chunk + 8; out->data_size = chunk_size; return 1; // success } pos += 8 + chunk_size; } return 0; }
added on the 2026-06-21 03:16:52 by hlder hlder
im so programmer
Code:const wtf = Math.floor(Math.random() * idk.length); document.getElementById("funni").innerHTML = idk[wtf];
added on the 2026-06-21 23:53:41 by juanp32 juanp32
LDA #$01
STA $D020
added on the 2026-06-25 11:53:16 by J-san J-san
Code:move.w #TIMEOUT*54,$05e(a6)
added on the 2026-06-27 19:29:14 by Blueberry Blueberry
buf1 = buf1 (+(-buf1 * cut)) + buf1);
buf2 = buf2 (+(-buf2 * (cut / 1.3))) + buf2);
buf3 = buf3 (+(-buf3 * ((cut / 1.3))/1.3)) + buf3);

Got Dam. Is this a "samplerateless" constant-q filter you think? (9db Phase, 18dB filler, via impulseresponse alignment)
added on the 2026-06-27 20:34:25 by J-san J-san
dont ask
Code:printf("aaaaaaaaaaaaaaaaaaa");
added on the 2026-06-30 19:03:20 by juanp32 juanp32
AVX ;-)
added on the 2026-07-04 22:42:49 by J-san J-san
printf("And I wrote right the wrong way")
added on the 2026-07-05 10:58:20 by Optimus Optimus
Code:EvalGeometry(geo, worldpos, query.CommittedRayT(), barycentrics, query.CommittedInstanceID(), query.CommittedPrimitiveIndex(), objToWorld);
Someone is using DXR RayQuery, it seems.
added on the 2026-07-05 16:22:17 by fizzer fizzer
BB Image
added on the 2026-07-06 09:34:22 by J-san J-san
idk

Code:static inline void NoCRT_memcpy(void* dst, const void* src, size_t num) { if (num == 0) return; NoCRT_init_cpu_features(); // for lil blocks (16byte) SSE // modern cpu's will likely turn this switch into some optimized shit if (num < 16) { unsigned char* d = (unsigned char*)dst; const unsigned char* s = (const unsigned char*)src; switch (num) { case 1: *d = *s; return; case 2: *(uint16_t*)d = *(const uint16_t*)s; return; // /Ob2 compiler optimizes safe-cast case 4: *(uint32_t*)d = *(const uint32_t*)s; return; case 8: *(uint64_t*)d = *(const uint64_t*)s; return; default: break; } // for non aligned of what remains (3, 5, 6, 7, 9-15) __movsb will be faster // so the sheesh above can be cooler __movsb(d, s, num); return; } // vector sheesh for big bad blocks // NOTICE: for AVX-512 blocks needed are from 128 to 256byte // or cpu can throttle a little bit (AVX throttling) if (NoCRT_cpu_avx512 && num >= 128) { size_t n64 = num >> 6; __m512i* d = (__m512i*)dst; const __m512i* s = (const __m512i*)src; for (size_t i = 0; i < n64; i++) { _mm512_storeu_si512(d + i, _mm512_loadu_si512(s + i)); } num &= 63; // remainig tail if (num == 0) return; dst = (void*)(d + n64); src = (const void*)(s + n64); //_mm512_stream_si512((__m512i*)(d + i), _mm512_loadu_si512(s + i)); } if (NoCRT_cpu_avx2 && num >= 32) { size_t n32 = num >> 5; __m256i* d = (__m256i*)dst; const __m256i* s = (const __m256i*)src; for (size_t i = 0; i < n32; i++) { _mm256_storeu_si256(d + i, _mm256_loadu_si256(s + i)); } num &= 31; if (num == 0) return; dst = (void*)(d + n32); src = (const void*)(s + n32); //_mm256_stream_si256((__m256i*)(d + i), _mm256_loadu_si256(s + i)); } if (NoCRT_cpu_sse2 && num >= 16) { size_t n16 = num >> 4; __m128i* d = (__m128i*)dst; const __m128i* s = (const __m128i*)src; for (size_t i = 0; i < n16; i++) { _mm_storeu_si128(d + i, _mm_loadu_si128(s + i)); } num &= 15; if (num == 0) return; dst = (void*)(d + n16); src = (const void*)(s + n16); //_mm_stream_si128((__m128i*)(d + i), _mm_loadu_si128(s + i)); } // tail (remainings), or just old cpus // if size > 64byte (on old CPUs), ERMS will turn on and it makes it faster // if this lil tail after AVX/SSE, __movsb will work great __movsb((unsigned char*)dst, (const unsigned char*)src, num); }
added on the 2026-07-06 18:26:42 by dadatel dadatel
My favourite way to fit a rectangle into another just because of that variable name :D

Code:float aspectratioratio = (float)(tex.sizeX * target.sizeY) / (target.sizeX * tex.sizeY); float w = 1; float h = 1; if (aspectratioratio > 1) // or <1 for crop h /= aspectratioratio; else w *= aspectratioratio;
added on the 2026-07-23 13:33:26 by kb_ kb_
Took me a while to come up with a GLSL preprocessor trick for reserving a keyword so that custom shader code cannot use it, while still producing a fairly readable error.

This is my best solution so far:

Code: #define AS AS_is_reserved(AS_is_reserved)


Produces the following errors when the keyword is used:

Code: #define AS // ERROR: 'AS' : macro redefined void AS() {} // ERROR: 'AS_is_reserved' : syntax error float AS = 0.; // ERROR: 'AS_is_reserved' : syntax error int foo = AS; // ERROR: 'AS_is_reserved' : undeclared identifier


I wonder if anyone knows something better.
added on the 2026-07-25 19:41:31 by tomkh tomkh
Code:vec3function jmp * & $ff00
added on the 2026-09-16 01:25:26 by Krill Krill
10 PRINT "FETKUK I PRUTTIS HIHI ";GOTO 10
added on the 2026-09-20 12:15:48 by Frost Frost
Code:wire signed [10:0] x_next = x2 - y2 + x0;
added on the 2026-09-21 20:47:24 by Blueberry Blueberry
Code:<svg onload="fetch`#`.then(r=>r.blob()).then(b=>new Response(b.slice(266).stream().pipeThrough(new DecompressionStream('deflate-raw'))).arrayBuffer()).then(WebAssembly.instantiate).then(r=>new Response(r.instance.exports.m.buffer.slice(8,10708)).text()).then(eval)">
added on the 2026-09-28 14:19:53 by Blueberry Blueberry
I didn't get to try, but aliasing then saves a 5 bytes, and removing the ,10708 should work as well and give another 6 bytes

5 bytes smaller
Code:<svg onload="fetch`#`[t=`then`](r=>r.blob())[t](b=>new Response(b.slice(266).stream().pipeThrough(new DecompressionStream`deflate-raw`)).arrayBuffer())[t](WebAssembly.instantiate)[t](r=>new Response(r.instance.exports.m.buffer.slice(8,10708)).text())[t](eval)">


or

11 bytes smaller
Code:<svg onload="fetch`#`[t=`then`](r=>r.blob())[t](b=>new Response(b.slice(266).stream().pipeThrough(new DecompressionStream`deflate-raw`)).arrayBuffer())[t](WebAssembly.instantiate)[t](r=>new Response(r.instance.exports.m.buffer.slice(8)).text())[t](eval)">
added on the 2026-09-28 15:06:22 by p01 p01
Aliasing then worked, but removing the parentheses from new DecompressionStream did not (since juxtaposition call binds stronger than new), and neither did removing the truncation (syntax error at the subsequent garbage).
added on the 2026-09-28 17:09:44 by Blueberry Blueberry
Sorry. Aliasing Response should save 3 bytes.
added on the 2026-09-28 17:28:49 by p01 p01
Yep, that worked.
added on the 2026-09-28 17:42:07 by Blueberry Blueberry

login

Go to top