This file contains hidden or 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
// Copyright 2023 Ben Trask. MIT licensed. | |
/* | |
TODO | |
. Detect directory loops | |
. Option flags? | |
. Skip inaccessible files | |
. More error reporting? | |
. Count of files skipped | |
. UTF8 normalization |
This file contains hidden or 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/bash | |
set -e | |
set -u | |
set -o pipefail | |
set -o noclobber | |
if [[ $# < 1 ]]; then | |
echo "Usage: $0 file.c" | |
exit 1; |
This file contains hidden or 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
-- Based on https://github.com/Kagami/mpv_slicing | |
-- Written in 2015 by Kagami Hiiragi kagami@genshiken.org | |
-- | |
-- To the extent possible under law, the author(s) have dedicated all | |
-- copyright and related and neighboring rights to this software to the | |
-- public domain worldwide. This software is distributed without any warranty. | |
-- | |
-- You should have received a copy of the CC0 Public Domain Dedication along | |
-- with this software. If not, see | |
-- http://creativecommons.org/publicdomain/zero/1.0/. |
This file contains hidden or 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
// Copyright 2023 Ben Trask. MIT licensed. | |
// Prints a wall of random hex digits. Looks kind of cool. | |
// Nostalgic for my days working on StrongLink. | |
// Uses authentic SHA-256 as a CSPRNG. | |
// Building: | |
// cc -std=c99 -Wall -Wextra -Werror -D_XOPEN_SOURCE=500 random_stream.c -lcrypto -o random_stream && ./random_stream | |
#include <assert.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> |
This file contains hidden or 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 node | |
var net = require("net"); | |
var tls = require("tls"); | |
var urlmodule = require("url"); | |
var url = urlmodule.parse(process.argv[2]); | |
var protocol = "https:" == url.protocol ? tls : net; | |
var socket = protocol.connect({ |
This file contains hidden or 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
// Author: Ben Trask, 2015 | |
// License: Public domain or CC0 | |
// To compile: cc --std=c99 -Wall -Wextra -Werror -Wno-unused-parameter arg-parsing.c | |
/* | |
Recursive composition and argument parsing in C | |
Since I have my own philosophy of abstraction, and since argument parsing | |
is an eternal problem, and since the existing solutions in C I've seen | |
recently seemed disappointing: |
This file contains hidden or 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
// Copyright 2015 Ben Trask | |
// Provided under the same license as libuv. | |
/* | |
Usage: | |
$ cc -Wall -Wextra -Wno-unused-parameter ./2015-08-05-libuv-runloop-death.c -luv -lpthread -o 2015-08-05-libuv-runloop-death && ./2015-08-05-libuv-runloop-death | |
EOF - this is fine. | |
Dead - this should never happen! | |
2015-08-05-libuv-runloop-death: ./2015-08-05-libuv-runloop-death.c:101: main: Assertion `rc == 0' failed. |