Skip to content

Instantly share code, notes, and snippets.

@odnal
odnal / ANSI.md
Created January 18, 2025 18:33 — forked from jonlabelle/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1b
  • Decimal: 27
@odnal
odnal / read_entire_file.c
Created December 12, 2024 02:53
read_entire_file
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#define FILENAME "./t8.shakespeare.txt"
#define return_defer(value) do { result = (value); goto defer; } while(0)
@odnal
odnal / main.c
Created November 21, 2024 02:28
xrandr script for loading singular external monitor hookup
// External monitor config script
// TODO: build a standalone tool for this that doesnt require the tool
// `xrandr` but performs in the same manner using X11 and Xrandr libs
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>