☕
0xcafeface
handmade. minimalistic. no bloatware.
Welcome. This is a small collection of my C sourcecode for linux. Feel free to download, check, use and comment:
Jörg Reinhard <info@finalmedia.de>
Framebuffer
- fbvnc_mod.tar.gz 11-Sep-2013 18:07 12K sha256sum:f0c42dfd39a3c94fbedaa505df34e8ad76ed93175aa6f4909782f10fd6107f62 A VNC Client for direct output to linux framebuffer device (fbdev). This is my modified version (german keyboard, mousewheel) of fbvnc from Ali Gholami Rudi (http://litcave.rudi.ir)
- fbyell.tar.gz 19-Sep-2013 18:01 2.6K sha256sum:4e221e7b7c2baac3344e3ecb03d83d22f620feb3db068837ea160365c6ce8aef Modified and optimized version of txt2fb. Tool for displaying ASCII Text on Framebuffer Devices, without opening /dev/fb0. Writing to stdout, so you can redirect to different device, or do multiscreen hack with ... | tee /dev/fb0 > /dev/fb1. This is modified by Ali Gholami Rudi (http://litcave.rudi.ir). really nice font zoom/scale function.
- txt2fb.tar.gz 13-Sep-2013 09:47 6.9K sha256sum:8da3a1b34e069fa905f5b3db5a2bbfd54c837a751843de969930946871554d13 Tool for displaying ASCII Text on Framebuffer Devices, without opening /dev/fb0. Writing to stdout, so you can redirect to different device, or do multiscreen hack with ... | tee /dev/fb0 > /dev/fb1
- ascii2fbdev.tar.gz 26-Feb-2014 19:12 109K sha256sum:a08867d5e6f6bd117774d995731f590b90087baf7eec58ffc6a65fb51791cf0e Ascii Char sequence (0 black/ 1 white) on stdin to stdout for framebuffer like /dev/fb0 in different resolutions and depths. Auto detecing newline!
- bit2fbdev.tar.gz 26-Feb-2014 19:12 58K sha256sum:8d63ce2e0f60e2a815498732c079357cfb1829a8b6a9e149c14b73c320cbe1d7 Binary Bit sequence (0 black/ 1 white) on stdin to stdout for framebuffer like /dev/fb0 in different resolutions and depths.
- unifont.tar.gz 11-Sep-2013 18:02 6.7M sha256sum:ecc074fcbe113b414d43913cd563dfc99b52495ab940529d17bac5af44bd42f4 A Mirror of unifont.hex file, including some scripts. Unifont.hex is a UTF-8 Bitmap Font
Audio
- sid2pcm.tar.gz 10-Sep-2014 01:54 10K sha256sum:77e0876088893a6c038a04a696558a0cf57a6e775cfdf0194f60fae5e96fd47e My hacked/modified version of TinySID 0.94 by T. Hinrichs and R. Sinsch, so it can be used as a filter (writes to stdout) at linux commandline. First parameter is your SID Music File (MOS Technology SID Soundchip 6581, used in Commodore C64 an C128 in the 1980s), output to stdout. Example Usage: sid2pcm [sid-file] > /dev/dspW (set samplerate first! 44.1 kHz, signed 16 bit little endianess,mono - e.g. using sox?), or via pipe to alsa: sid2pcm [sid-file] | aplay -c 1 -f s16_le -r 44100, or to pulseaudio: sid2pcm [sidfile] | pacat --format=s16le --rate=44100 --channels=1, or to file: sid2pcm [sid-file] > example.s16le.mono.pcm. You can also pipe to ffmpeg and encode to different audiocodecs like opus, mp3, aac, ogg. Example using opusenc, a tiny standalone opus encoder: sid2pcm [sidfile] | opusenc - --raw-bits 16 --raw-rate 44100 --raw-chan 1 --raw-endianness 0 --raw output.opus. This is imho a much more flexible solution then directly accessing via soundcard.o. For Sample SID-Files have a look at the famous High Voltage SID Collection (http://hvsc.de). Also have a look to this nice thing.
- tonegenerator.tar.gz 21-Jan-2015 14:50 4.3K sha25sum:6e7527956189805074a4fb80f9064845180a74ff519945db4945bf7fe67e6166 This is my small Stereo, Multiple Sinus-Tone-Generator - just Sinus and Noise. It generates a RAW PCM 48khz, Stereo, 16 Bit little endian bitstream at stdout. So you can use ./tonegenerator | aplay -c 2 -f s16_le -r 48000. Compiled and linked with dietlibc, your executable binary(!) is also ~4kb only. The Example code generates Sinus Tone at 440 Hz at 80% volume and 1200 Hz at 20% volume. Mixed together. You can specify volume of each tone and can add further frequencies or noise.
Dataprocessing
- ratio10.tar.gz 11-Sep-2013 18:43 666 sha256sum:53c4bb74e1187f48adab25424b983e130e67096ceb6ca4a86502fcb47ceefead Cloning stdin to stdout while calculate ratio beetween up- and downbits as output on stderr. It is used to calculate spreading/distribution of 0 or 1 in a binary-data stream. Every input-byte is analysed bitwise, meaning reading 8 bit, counting 1 and 0. Redirect stderr to datafile, so you can visualize spreading afterwards.
- bit2ascii.tar.gz 26-Feb-2014 17:59 859 sha256sum:d5491ebd1d52638fbf5015d337f4e88784cfbb2d04814ee5c5f717d909a06115 Binary Bit sequence on stdin to ascii bit sequence of character 0 or 1 on stdout.
- ascii2bit.tar.gz 26-Feb-2014 17:59 969 sha256sum:e7190f8fce5de50b176020fdbc39c7163f76dff6e716bc50e07d41ffdf575cab Ascii Char sequence of character 0 or 1 as bits on stdin to real binary bit sequence in little endian on stdout.
- every.tar.gz 01-Sep-2020 22:57 586 sha256sum:7ee7451f3fc3e7ba3fb70e13dfda15babd71236ce2ec209ca4946522c2576f25 execute a program periodically. Quick hack as a minimalistic version of "watch" without curses or fullscreen mode. This tool is running a given program, sleeping n seconds and streaming its output to stdout. endlessly, over and over again and usable in a pipe, "collecting" all output. simple example: every 10s date .another example in bash for redirecting output to specific host via tcp: every 2s date > /dev/tcp/hostname/port. another example, running endlessly doing 4 pings and waiting 60 seconds after every 4 ping cycle: every 60s "ping -c 4 hostname" | tee -a logfile. another example: every 20s 'ls -1' | wc -l | tai64n | tee -a dir.log another example, usable for a tiny anacron solution (at replacement) to run scripts at a given point of time in background process. just copy or symlink your scripts in a folder in the style /etc/timerun/YYYYmmddHHMMSS/ and use this example to check every second for runnable parts in given directory of the current second. important: use single quote ' and do not use double quote ", since you want to evalute the date command in the child shell every second - not once in the parent shell. and do not forget to put the child shell in background, by using & otherwise the child shell probably runs longer than 1 second and the evalation of the next child shell wouldn't spawn right on time (since every run-parts command would have to exit cleanly before next run). example: every 1s 'run-parts /etc/timerun/$(date +'%Y%m%d%H%M%S')/ &' 2> /dev/null. Generally be aware: the child shell is "sh" since system() is used. if you need bash, or zsh you have to use a forked fork call: every 2s "bash -c 'your commandchain'". another funny example: every 1s "echo hear_and_feel_the_heartbeat | aplay -q -f cd -r 2000"
- teetime.tar.gz 04-Sep-2020 20:45 957 sha256sum:2ba340de4b975cdad4071a14f7f848dc09e131d7f98208e7179de1b66f31f3e3 clone stdin to stdout and terminate process after n seconds, if there is no further input on stdin. Useful to terminate a whole pipe if data stalled. this tool uses a refreshed SIGALRM signal as a kind of dead-man switch for pipes. use it to terminate a stalled openssh session.
Graphics
- bit2pbm.tar.gz 11-Sep-2013 18:55 1.1K sha256sum:df822e2cfd7c81078740e9fced16abd93c76aae60e9a3190aa8c1f7e3ae1595a Transform any sort of binary datastream on stdin to an uncompressed(!) black/white PBM-image Type P1 (1024x768 Pixel) on stdout. You can edit in in a normal plain/text-editor afterwards.
- barnsley_fern.tar.gz 07-Jan-2014 13:45 2.0K sha256sum:30369ab3a20314bc8a587382768c29ffc93cf2d03e4639ce543fec6d83a95bfd Generating Barnsley Fern (Hausdorff-Konvergenz) as PBM Image at stdout. Also including an hacked version that generates SVG output with lot of squares. (Original Source by Paul Bourke and Jay Link coding for svgalib. 1988, http://paulbourke.net/fractals/ifs_fern_a). Another really beautiful implementation, only 538 bytes, directly written in postscript: barnsley_fern.ps (538 bytes) by Eric Wicklund, 1993
Patches
Patches to 3rd party software
- patches/gatling 30-Jul-2015 19:47 -- Collection of patches for gatling http daemon, version 0.13/0.14
Playground
- geonames_symlink_database.htm 02-Feb-2020 10:43 -- Howto build a smart and tiny geonames resolver (resolving name of point of interest, like a city or street, to geo coordinate) without using any database backend, cgi, php or any external service - just by using broken symlinks and gatling httpd. Update: Added variant: cdb, ucspi-tcp, daemontools
- poetherm 11-Nov-2019 20:42 -- PoE Thermologging with Olimex ESP32 PoE Development Board and DS3231 Realtime Clock Module (german)
- otp.htm 16-Jan-2020 21:48 -- Some trivial XOR Cheatsheet and Codecard Generator Scripts, useable as "computerless" one time pad. use a better random number generator, not /dev/urandom. don't use computers at all. pen and paper. 16 sided dices. just for fun.
- oneliners.htm 26-Aug-2020 15:48 -- collection of some conveniant shell script oneliners. no collection yet ;)
- tiny.htm 28-Mar-2020 14:39 -- keep your html source clean and tiny. this is a collection of some tricks, a recommendation to slim down your html code for saving traffic and avoid unnecessary requests.
- utf8symbols.htm 29-Mar-2020 15:16 -- index of utf8 symbols and pictograms in html character references in UCS codepoint format &#nnnnnn; (decimal).
- c64mynor.htm 19-Jan-2021 21:45 -- Hardware Playground: c64 uart cartridge and mynor single board computer
Please link to this page via http://cafeface.de or reinhard.xyz.
This site ist non-commercial. no cookies. no annoying banners. no data-mining. privacy friendly.
If you like this site, you will also like (much more) those sites: Felix von Leitner, Ali Gholami Rudi, D. J. Bernstein, Bruce Guenter, Uwe Ohse, Paul Bourke, Dmitry Marakasov (AMDmi3), Nayuki, Jörg Schulenburg, b0llix, skarnet, Gerrit Pape, Dr. Erwin Hoffmann
Other interesting sites to visit: mynor.org