Skip to content

Instantly share code, notes, and snippets.

View izabera's full-sized avatar

Isabella Bosia izabera

  • General System
  • Flitwick, UK
View GitHub Profile
void f() { }
int main() {
for (int i = 0; i < 100; i++)
f();
}
#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;
#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, &current); \
current.tv_sec * 1000000000l + current.tv_nsec >= \
#include <stdio.h>
typedef struct {
int size;
int *segments;
} vers;
#define makeversion(...) \
({ static int x[] = { __VA_ARGS__ }; (vers) { sizeof x/sizeof *x, x }; })
#!/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:
#!/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
#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;
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main() {
// slurp stdin
char *file;
size_t size;
FILE *tmp = open_memstream(&file, &size);
@izabera
izabera / bug.c
Last active January 30, 2017 22:15
problem with link time optimization
#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"
#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[]) {