Skip to content

Instantly share code, notes, and snippets.

@viega
viega / defer.h
Created March 20, 2025 01:58
A C implementation of defer using `goto`
// defer.h
// [email protected]
// © 2025 Crash Override, Inc.
// Licensed under the BSD 3-Clause license
#pragma once
#include <stdint.h>
typedef struct n00b_defer_ll_t n00b_defer_ll_t;
@viega
viega / color.sh
Created September 2, 2023 16:08
My bash function(s) for colorizing test in shell scripts.
function color {
case $1 in
black) CODE=0 ;;
red) CODE=1 ;; RED) CODE=9 ;;
green) CODE=2 ;; GREEN) CODE=10 ;;
yellow) CODE=3 ;; YELLOW) CODE=11 ;;
blue) CODE=4 ;; BLUE) CODE=12 ;;
magenta) CODE=5 ;; MAGENTA) CODE=13 ;;
cyan) CODE=6 ;; CYAN) CODE=14 ;;
white) CODE=7 ;; WHITE) CODE=15 ;;