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
/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
/** | |
* @file stringy_check.c | |
* @author Juuso Alasuutari | |
* | |
* @brief Parse the raw content bytes of text strings as if the strings were | |
* arbitrarily large integers, and check if the result is a different | |
* prime number in both the big- and little-endian byte orders. | |
* | |
* I call the group of primes generated by this method "stringy primes"; run |
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 bash | |
# | |
# IMPORTANT: The HTTP authorization header must be found | |
# in ~/.openai in full, not just the API key. | |
# | |
# Usage: ./bashplainer.sh /path/to/file.sh | |
# | |
# Requirements: dos2unix, jq, curl | |
# |
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 bash | |
# | |
# IMPORTANT: The HTTP authorization header must be found | |
# in ~/.openai in full, not just the API key. | |
# | |
# Usage: ./documentarist.sh [options] /path/to/file.c | |
# | |
# Requirements: dos2unix, cpp, clang-format, jq, curl | |
# |
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 bash | |
# | |
# Usage (_only_ if you really know what you're doing): | |
# etc_hosts_dig.sh >> /etc/hosts | |
# expand this list as needed | |
declare -a hosts_list=( | |
api.openai.com | |
auth0.openai.com | |
cdn.openai.com |
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
# /etc/udev/rules.d/99-xdm.rules | |
# Create a dev-dri-card0.device unit for xdm.service to wait on. | |
SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd" |
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 bash | |
# | |
# IMPORTANT: The HTTP authorization header must be found | |
# in ~/.openai in full, not just the API key. | |
# | |
# Usage: ./quizgpt.sh <windowtitle> <expertrole> | |
# | |
# Example: | |
# ./quizgpt.sh 'Online C quiz' 'a C programmer' | |
# |
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 bash | |
word_max=9 # Exclude words longer than this | |
nphrases=3 # Generate this many passphrases | |
defwords=4 # Default number of words/phrase | |
pls() { | |
local -i n=${#1} r=$2 | |
local s | |
printf -v s -- ' %s%*s%s\n' \ |
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
#include <stdatomic.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#define TRANSACTION(name, ptr, lock, expect, desire) \ | |
struct { \ | |
union { \ | |
atomic_ulong *state; \ | |
struct { \ | |
char lock_bit[(lock)]; \ |
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
#include <stdio.h> | |
enum { | |
FOO = 1 << 0, | |
BAR = 1 << 1, | |
BYX = 1 << 2, | |
QUE = 1 << 3 | |
}; | |
#define maybe_signed(T, cond) __typeof__( \ |
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
#include <stdio.h> | |
#define sizeof(x) (!(#x[0]^0x27)?:sizeof(x)) | |
#define q(x) printf("%-7s\t%zu\n", #x, x) | |
#define p(x) q(sizeof(x)) | |
int main (void) | |
{ | |
char s[7], c; |