Skip to content

Instantly share code, notes, and snippets.

View armornick's full-sized avatar

Nick Arnoeyts armornick

View GitHub Profile
@armornick
armornick / playwav.c
Created August 24, 2012 07:31
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played
@armornick
armornick / openicon.c
Created August 23, 2012 08:47
Draw an Image with SDL2
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "exit.png"
int main (int argc, char *argv[]) {
@armornick
armornick / md-to-docx.js
Created March 26, 2025 13:23
Markdown to Docx converter
import { readFileSync, writeFileSync } from "node:fs";
import { marked } from "marked";
import { JSDOM } from "jsdom";
import {
AlignmentType, Document, ExternalHyperlink, HeadingLevel, LevelFormat,
Packer, Paragraph, ShadingType, Table, TableCell, TableRow, TextRun,
WidthType
} from "docx";
const INPUT_FILE = 'sample.md';
@armornick
armornick / sdl2mixer.c
Created August 28, 2012 10:40
Using SDL_Mixer with SDL2
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
#define WAV_PATH "Roland-GR-1-Trumpet-C5.wav"
#define MUS_PATH "HR2_Friska.ogg"
// Our wave file
Mix_Chunk *wave = NULL;
// Our music file
Mix_Music *music = NULL;
@armornick
armornick / colors.ts
Created March 1, 2025 16:13
Color Conversion functions
/*
HSV/HSL code based on Wikipedia algorithms
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
@armornick
armornick / NIA_SimpleCrafting.js
Last active February 2, 2025 07:30
Simple crafting system for RPG Maker MV
/*:
@plugindesc Simple crafting system.
@author armornick
----------------------------------------------------
@help
Adds a simple crafting system with a simple crafting menu.
@armornick
armornick / apputils.pas
Created May 10, 2014 09:36
Free Pascal program to make Lazarus portable (based off the earlier batch script but more versatile)
unit AppUtils;
{$mode objfpc}{$H+}
interface
uses
SysUtils;
function CheckDir(path:string):Boolean;
@armornick
armornick / tumblr-theme-boilerplate.html
Created July 12, 2023 06:54
Tumblr theme boilerplate
<!--
BOILERPLATE FOR TUMBLR THEME DEVELOPMENT
Based on the code from <https://buildthemes.tumblr.com/>
Available under the 0BSD license (https://opensource.org/license/0bsd/)
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@armornick
armornick / tumblr-theme.html
Last active July 7, 2023 11:59
My first tumblr theme
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="Description" content="{MetaDescription}" />
<title>{block:SearchPage}{lang:Search results for SearchQuery} - {/block:SearchPage}{block:PostTitle}{PostTitle} - {/block:PostTitle}{Title}</title>
<link rel="shortcut icon" href="{Favicon}" />
<link rel="apple-touch-icon" href="{PortraitURL-128}"/>
@armornick
armornick / uno-bootstrap-preset.ts
Created July 3, 2023 17:21
Uno.css Bootstrap Preset (unfinished)
import { Preset, Rule } from 'unocss'
const displayRules: Rule[] =
['none','inline','inline-block','block','grid','inline-grid','flex','inline-flex','table','table-row','table-cell']
.map(display => [`d-${display}`, { display }]);
const flexDirectionRules: Rule[] =
['row','row-reverse','column','column-reverse']
.map(direction => [`flex-${direction}`, { 'flex-direction': direction }]);
const textAlignRules: Rule[] =
['left','right','center'].map(alignment => [`text-${alignment}`, { 'text-align': alignment }]);