Skip to content

Instantly share code, notes, and snippets.

View bplaat's full-sized avatar

Bastiaan van der Plaat bplaat

View GitHub Profile
@bplaat
bplaat / Cargo.toml
Created February 1, 2023 13:15
A simple rust program without stdlib that links to the win32 libs
[package]
name = "bassietest"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
panic = "abort"
@bplaat
bplaat / vera.asm
Created October 15, 2022 19:07
Commander X16 - Vera display text program
; Commander X16 - Vera display text program
; acme -f cbm --cpu 65c02 -o vera.prg vera.asm && x16emu -prg vera.prg -run
CHROUT=$FFD2
VERA_ADDR_L=$9F20
VERA_ADDR_M=$9F21
VERA_ADDR_H=$9F22
VERA_DATA0=$9F23
*=$0801
@bplaat
bplaat / hello.asm
Created October 14, 2022 11:57
Commander X16 - Hello World program
; Commander X16 - Hello World program
; acme -f cbm --cpu 65c02 -o hello.prg hello.asm && x16emu -prg hello.prg -run
CHROUT=$FFD2
*=$0801
!byte $0B, $08, $01, $00, $9E, $32, $30, $36, $31, $00, $00, $00
start:
; Clear screen
@bplaat
bplaat / mariadb-uuid-functions.sql
Last active May 1, 2023 17:45
MariaDB UUID_TO_BIN and BIN_TO_UUID pollyfills
DELIMITER //
CREATE FUNCTION UUID_TO_BIN(u CHAR(36))
RETURNS BINARY(16)
BEGIN
IF u IS NULL THEN
RETURN NULL;
END IF;
SET u = REPLACE(u, '-', '');
RETURN CONCAT(
@bplaat
bplaat / opengl.c
Created May 30, 2022 20:53
Win32 OpenGL 1.0 Example
// Win32 OpenGL 1.0 Example
// gcc opengl.c -c -o opengl.o && ld -s opengl.o -lkernel32 -luser32 -lgdi32 -lopengl32 -o opengl.exe -e _start && ./opengl
// --subsystem windows
#define UNICODE
#include <windows.h>
#include <GL/gl.h>
// Window state
wchar_t *windowTitle = L"Win32 OpenGL Example";
UINT windowWidth = 1280;
@bplaat
bplaat / .htaccess
Created December 30, 2021 17:27
Yet another single file PHP MVC framework
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [L]
@bplaat
bplaat / bulma-dark.min.css
Created December 11, 2021 17:01
Crude Bulma dark theme hack
.pagination-previous,.pagination-next,.pagination-link,.pagination-ellipsis,.file-cta,.file-name,.select select,.textarea,.input,.button{-moz-appearance:none;-webkit-appearance:none;align-items:center;border:1px solid transparent;border-radius:4px;box-shadow:none;display:inline-flex;font-size:1rem;height:2.5em;justify-content:flex-start;line-height:1.5;padding-bottom:calc(0.5em - 1px);padding-left:calc(0.75em - 1px);padding-right:calc(0.75em - 1px);padding-top:calc(0.5em - 1px);position:relative;vertical-align:top}.pagination-previous:focus,.pagination-next:focus,.pagination-link:focus,.pagination-ellipsis:focus,.file-cta:focus,.file-name:focus,.select select:focus,.textarea:focus,.input:focus,.button:focus,.is-focused.pagination-previous,.is-focused.pagination-next,.is-focused.pagination-link,.is-focused.pagination-ellipsis,.is-focused.file-cta,.is-focused.file-name,.select select.is-focused,.is-focused.textarea,.is-focused.input,.is-focused.button,.pagination-previous:active,.pagination-next:active,.paginat
@bplaat
bplaat / dl.js
Created November 19, 2021 14:00
Simple Deno application that list Deezer album information
#!/usr/bin/env deno run --allow-net
import { parse } from "https://deno.land/std/flags/mod.ts";
const httpGetJson = async (url) => await (await fetch(url)).json();
const args = parse(Deno.args);
if (args._.length == 0) {
console.log('Give an album name!');
Deno.exit();
@bplaat
bplaat / dl.py
Created November 19, 2021 08:57
Multithreaded youtube video music downloader with nice ansi progress bars
import math, os, re, subprocess, sys, tempfile, threading
size = os.get_terminal_size()
cursorY = 0
def printLine(y, line):
global cursorY
if (y <= cursorY):
sys.stdout.write('\033[F' * (cursorY - y))
if (y > cursorY):
@bplaat
bplaat / plaatlight.php
Created August 17, 2021 15:37
PlaatLight
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="plaatlight"');
}
if ($_SERVER['PHP_AUTH_USER'] != 'plaatlight' || $_SERVER['PHP_AUTH_PW'] != 'plaatlight') {
header('HTTP/1.1 401 Unauthorized');
echo 'Not authorized';
exit;