Skip to content

Instantly share code, notes, and snippets.

View stianhoiland's full-sized avatar

Stian Gudmundsen Høiland stianhoiland

View GitHub Profile
@skeeto
skeeto / Makefile
Last active October 20, 2025 07:02
skeetocrt example CRT
ALL = skeetocrt.dll skeetocrt.dll.a crt0.o
all: $(ALL)
skeetocrt.dll skeetocrt.dll.a: skeetocrt.c stdio.h
cc -shared -g3 -fno-builtin -nostartfiles --entry=0 \
-Wl,--out-implib=skeetocrt.dll.a -o skeetocrt.dll skeetocrt.c
crt0.o: crt0.c stdio.h
cc -c -g3 -fno-builtin -nostdlib -nostdinc -isystem . -o crt0.o crt0.c
@kelvinauta
kelvinauta / translate-youtube-video.sh
Last active July 24, 2025 23:08
Download the video -> Transcribe it using OpenAI Whisper-1 -> Translate the subtitle lines in parallel -> Create an mkv with the subtitles
#!/usr/bin/env bash
set -euo pipefail
OUTPUT_LANG="español"
CHUNK_SIZE=50
MODEL_TRANSLATE="gpt-4.1-mini"
function usage(){
cat <<EOF
@skeeto
skeeto / example.c
Last active October 4, 2025 12:17
Code for "Examples of quick hash tables and dynamic arrays in C"
// Examples of quick hash tables and dynamic arrays in C
// https://nullprogram.com/blog/2025/01/19/
// This is free and unencumbered software released into the public domain.
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define new(a, n, t) (t *)alloc(a, n, sizeof(t), _Alignof(t))
#define S(s) (Str){(uint8_t *)s, sizeof(s)-1}
@marcelofern
marcelofern / converter.c
Created August 26, 2024 09:39
Website converter (.md -> .html)
/* converter.c
*
* This code converts `.md` files into `.html` files.
*
* The main use is to write a static website in `.md` files, and then run this
* program to convert it to `.html`
*
* The program relies on the following variables:
*
* - INPUT_FOLDER: full path of the website with `.md` files.
@8dcc
8dcc / syntax.c
Created November 18, 2023 15:53
Slightly modified syntax highlighter from StackOverflow
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
/*
* C syntax highlighter to stdout.
* Source: https://stackoverflow.com/a/77465783/11715554
*/
@fredjoseph
fredjoseph / AwesomeCliApps.md
Last active December 6, 2025 07:47
Awesome CLI/Terminal Apps

Awesome Apps

  • description: Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, fish, tmux, IPython, Awesome, i3 and Qtile.
  • language: Python
  • description: If you like the interface of HTTPie but miss the features of curl, curlie is what you are searching for. Curlie is a frontend to curl that adds the ease of use of httpie, without compromising on features and performance. All curl options are exposed with syntax sugar and output formatting inspired from httpie.
  • language: Go
@benob
benob / stbttf.h
Last active May 25, 2025 04:46
Example for using stb_truetype with SDL2 renderer. Only supports ASCII characters.
#ifndef __STBTTF_H__
#define __STBTTF_H__
#include <SDL2/SDL.h>
#include "stb_rect_pack.h"
#include "stb_truetype.h"
/* STBTTF: A quick and dirty SDL2 text renderer based on stb_truetype and stdb_rect_pack.
* Benoit Favre 2019
@alganet
alganet / hers.sh
Last active July 20, 2025 04:57
Fast and portable mouse/keyboard terminal capture (zsh,ksh,mksh,bash on Windows+WSL, Linux or Mac OS)
#!/bin/sh
# Quick run: bash -c "$(curl -L https://git.io/fjToH)"
# CTRL+W to exit
set -euf
unsetopt FLOW_CONTROL GLOB NO_MATCH NO_SH_WORD_SPLIT NO_PROMPT_SUBST 2>/dev/null || :
write ()
{
@tomdaley92
tomdaley92 / makefile
Last active June 30, 2025 17:50
Generic makefile for C/C++ programs
# Thomas Daley
# September 13, 2021
# A generic build template for C/C++ programs
# executable name
EXE = app
# C compiler
CC = gcc