This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 // self-compiling code | |
gcc -std=c99 -Wall -Wextra -pedantic -g -O3 -march=native $0 -o image_predict || exit 1 | |
exec ./image_predict $* | |
#endif | |
// Example code for pre-filtering operations that transform RGB images into | |
// representations that are better suited for lossless compression | |
// (color channel separation and decorrelation, pixel prediction). | |
// Takes a .ppm file as an input and generates multiple files in the form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 SCREEN 0: REM This program makes only sense to be run on EGA cards, not VGA! | |
20 SCREEN 9: H% = 105: GOSUB 1000: LOCATE 9 | |
30 PRINT "Notice the nice rainbow colors above? That's what you can get by reprogramming" | |
40 PRINT "the EGA palette. Unfortunately, this only works in 350-line mode." | |
50 PRINT "Press any key to see what it looks like in 200-line mode." | |
60 WHILE INKEY$ = "": WEND | |
70 SCREEN 8: H% = 60: GOSUB 1000: LOCATE 9 | |
80 PRINT "Well, that's not nearly as nice as it was in 350-line mode. Turns out, the EGA" | |
90 PRINT "monitor emulates a CGA monitor in 200-line mode and thus restricts the palette" | |
100 PRINT "to the 16 CGA colors. Reprogramming the EGA palette can shuffle the CGA colors" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
position=<-58825, 5905> velocity=< 8, -6> | |
position=< 50749, -19111> velocity=<-7, 4> | |
position=< 50995, -8236> velocity=<-3, -5> | |
position=< 44611, -17672> velocity=<-8, 1> | |
position=< 41069, -41189> velocity=<-8, 3> | |
position=< 9181, -56028> velocity=<-6, 2> | |
position=<-24979, 38514> velocity=<-2, 1> | |
position=< 19502, 58516> velocity=<-3, -9> | |
position=< 58524, 6506> velocity=<-9, -1> | |
position=<-47781, 14688> velocity=<-1, -3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 // self-compiling code | |
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -O4 -march=native $0 -lm || exit 1 | |
exec time ./a.out | |
#endif | |
// Blue Noise texture generation using the void-and-cluster algorithm | |
// implemented by Martin Fiedler <[email protected]> | |
// using an algorithm description written by Alan Wolfe: | |
// https://blog.demofox.org/2019/06/25/generating-blue-noise-textures-with-void-and-cluster/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 CLS : RESTORE 500 | |
20 READ x,y,u,v | |
30 IF x=999 THEN GOTO 70 | |
40 PLOT 128+x, 88+y : DRAW u-x, v-y | |
50 PLOT 129+x, 88+y : DRAW u-x, v-y | |
60 GOTO 20 | |
70 PRINT AT 21,9; "WHAT, ME WORRY?" | |
80 IF INKEY$ = "" THEN GOTO 80 | |
90 CLS : PRINT "\* 1985 E.C. PUBLICATIONS" | |
500 DATA -27,-11,-23,-6,-28,-13,-22,-6,-20,-5,-12,-5,-27,-14,-26,-13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 | |
gcc -std=c99 -Wall -Wextra -pedantic -g -O4 -march=native $0 -lm || exit 1 | |
./a.out && feh joymap.ppm | |
exit $? | |
#endif | |
// visualization of analog joystick to 8-way digital direction quantization | |
// see https://github.com/sulix/omnispeak/pull/14 | |
#include <stdbool.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 | |
g++ -std=c++11 -Wall -Wextra -pedantic -Werror $0 || exit 1 | |
exec ./a.out | |
#endif | |
// generate sequences of numbers 0..(1-n) with variable degree of randomness: | |
// r = 0.0 -> perfectly sorted | |
// r = 0.5 -> fully shuffled | |
// r = 1.0 -> perfectly reversed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Visualization of various in-place sorting algorithms. | |
Can generate a HTML page and video files to browse and display the results. | |
Note: requires FFmpeg to display and export the visualizations. | |
The code snippets in the HTML report are syntax highlighted if Pygments | |
is installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 // self-compiling code: chmod +x this file and run it like a script | |
BINARY=vaapi_egl_interop_example | |
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -fsanitize=address -o $BINARY $0 \ | |
`pkg-config libavcodec libavformat libavutil libva gl egl libdrm --cflags --libs` \ | |
-lX11 -lva-x11 -lva-drm || exit 1 | |
test "$1" = "--compile-only" && exit 0 | |
exec env ASAN_OPTIONS=fast_unwind_on_malloc=0 ./$BINARY $* | |
#endif /* | |
Minimal example application for hardware video decoding on Linux and display |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
@rem "This little script sets a few useful settings in Windows 10 that most" | |
@rem "serious users are likely to want; scroll through the script for details" | |
@rem "and disable sections you don't want." | |
@rem "Usage:" | |
@rem "Just save this file as a .bat or .cmd file and run it (with" | |
@rem "Administrator privileges!). You will need to re-run it after larger" | |
@rem "updates, as these tend to overwrite some of the settings or re-create" |
OlderNewer