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
void f() { } | |
int main() { | |
for (int i = 0; i < 100; i++) | |
f(); | |
} |
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
#define _GNU_SOURCE | |
#include <sys/wait.h> | |
#include <unistd.h> | |
#include <signal.h> | |
int main(int argc, char *argv[]) { | |
if (argc < 2) argv = (char *[]) { argv[0], "/bin/sh", NULL }; | |
int status; | |
if (getpid() != 1) return 1; |
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 <unistd.h> | |
#include <sys/wait.h> | |
#include <errno.h> | |
#include <err.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define elapsed(limit) ({ clock_gettime(CLOCK_MONOTONIC, ¤t); \ | |
current.tv_sec * 1000000000l + current.tv_nsec >= \ |
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> | |
typedef struct { | |
int size; | |
int *segments; | |
} vers; | |
#define makeversion(...) \ | |
({ static int x[] = { __VA_ARGS__ }; (vers) { sizeof x/sizeof *x, x }; }) |
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 sh | |
# ranger supports enhanced previews. If the option "use_preview_script" | |
# is set to True and this file exists, this script will be called and its | |
# output is displayed in ranger. ANSI color codes are supported. | |
# NOTES: This script is considered a configuration file. If you upgrade | |
# ranger, it will be left untouched. (You must update it yourself.) | |
# Also, ranger disables STDIN here, so interactive scripts won't work properly | |
# Meanings of exit codes: |
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
#!/bin/bash | |
if ! [[ -t 0 && -t 1 ]]; then | |
echo not a tty >&2 | |
exit 1 | |
fi | |
tput smcup; tput civis | |
trap 'tput cnorm; tput rmcup; echo your final score is "$score"' exit |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
int main() { | |
srand(time(0)); | |
// generate expressions with i args | |
for (int i = 2; i < 10; i++) { | |
int arr[i]; | |
size_t tries = 0; |
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 <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main() { | |
// slurp stdin | |
char *file; | |
size_t size; | |
FILE *tmp = open_memstream(&file, &size); |
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
#define write(fd, string, len) \ | |
({ long ret; \ | |
asm volatile("syscall": "=a"(ret): "a"(1), "D"(fd), "S"(string), "d"(len) : "rcx", "r11", "cc"); \ | |
ret; }) | |
#define _exit(status) \ | |
({ asm volatile("syscall" : : "a"(60), "D"(status)); __builtin_unreachable(); }) | |
asm(".type _start, @function\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
#define _GNU_SOURCE | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <fcntl.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { |