Skip to content

Instantly share code, notes, and snippets.

@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active March 22, 2023 03:06
Discussion of korn.c, 1987 IOCCC entry, mentioned in http://stackoverflow.com/a/19214007/827263

korn.c is the "Best One Liner" winner of the 1987 International Obfuscated C Code Contest, by David Korn (yes, the author of the Korn Shell).

korn.hint, as the name implies, offers some hints.

A commenter on Stack Overflow asked for some clarification. I didn't want to post spoilers on the site, so I'm posting them here instead. If you haven't already (and if you're familiar with the rules of C) I encourage you to study the program for a while first.

=====

Here's the code:

@Keith-S-Thompson
Keith-S-Thompson / urandom_test.c
Created February 4, 2013 02:38
Generate random numbers from /dev/urandom
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MAX 36
#define URANDOM_DEVICE "/dev/urandom"
static FILE *urandom;
/*
#!/bin/sh
cat > test_script_name <<EOF
#!/bin/bash/sh
echo It worked
EOF
chmod +x test_script_name
./test_script_name
#!/usr/bin/perl
use strict;
use warnings;
my %saved_env = %ENV;
my $term = $ENV{TERM};
my $error_count = 0;
foreach my $var (sort keys %saved_env) {
return (
  <div className="App">
    <h1>Quantum Pilot</h1>
      <div className="content">
        <div className="box"><About/></div>
        <div className="box">HnnYoutube</div>
        <div className="box">{buy}</div>
        <div className="box">{mykeys}</div>
      </div>

Demo program for a bug that appears under Termux on Android.

The %n format for printf does not work.

Files:

  • percent-n-test.c is the test program.
  • correct-output.txt is the correct output
  • incorrect-output.txt is the output under Termux on my Nexus 9, Android 7.1.1
@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active September 21, 2016 22:54
How to use {{ }} with Markdown

I would like to write {{ ... }} inside a code block using Markdown.

For example:

{{ var }}  

I don't know why it disappears. However I can write it outside a block of code: \ {\ { var \ } \ }.

Reference: http://stackoverflow.com/q/39627452/827263

@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active August 27, 2016 21:35
"Array ints not returning correctly"
/*
* Test program based on code in the Wikipedia POSIX Threads
* article, https://en.wikipedia.org/wiki/POSIX_Threads.
*
* Demo for http://stackoverflow.com/q/19128948/827263
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>