Skip to content

Instantly share code, notes, and snippets.

@silbinarywolf
silbinarywolf / mapspawn.nut
Last active July 29, 2023 07:03
Force player to look like prop and strip weapons/cosmetics
// How to use
// - Place in tf\scripts\vscripts\mapspawn.nut
// References
// - https://developer.valvesoftware.com/wiki/Team_Fortress_2/Scripting/VScript_Examples/en#See_Also
// - https://wiki.alliedmods.net/Team_Fortress_2_Events#player_changeclass
function Precache() {
PrecacheModel("models/props_2fort/coffeepot.mdl");
PrecacheModel("models/player/pyro.mdl")
@silbinarywolf
silbinarywolf / sdl_stb_truetype_font.zig
Last active June 6, 2023 07:26
Example for using stb_truetype with SDL2 renderer. Only supports ASCII characters. For Zig.
//
// Based on C/C++ code from here: https://gist.github.com/benob/92ee64d9ffcaa5d3be95edbf4ded55f2
//
const std = @import("std");
const stb_truetype = @import("stb_truetype");
const SDL = @import("sdl2");
const Renderer = @import("renderer.zig").Renderer;
const Allocator = std.mem.Allocator;
var globalFormat: [*c]SDL.SDL_PixelFormat = null;
@silbinarywolf
silbinarywolf / go.mod
Created October 5, 2021 07:56
Force pull in github.com/go-gl/glfw/v3.3/glfw via golang.org/x/exp
module github.com/silbinarywolf/grpc-repro
go 1.17
require (
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a
google.golang.org/grpc v1.39.0
)
// +build windows
package steamworks
import (
"log"
"syscall"
"unsafe"
)
@silbinarywolf
silbinarywolf / main.go
Created June 2, 2019 06:05
Load and run JavaScript code through ChakraCore DLL
package main
import (
"errors"
"fmt"
"syscall"
"unsafe"
)
var (
/// @function hmac_md5_test
/// @description Runs tests to ensure the correctness of hmac_md5
var reportString = "hmac_md5_test() Test Report:\n\n"
var testCount = 0
var passCount = 0
var failCount = 0
#region Test "A" string with "secret_key" as key
var test_name = "\"A\" string with \"secret_key\" as key"
/// @function hmac_md5
/// @param {buffer} buffer The buffer to get a hash of
/// @param {number} offset
/// @param {number} size
/// @param {string} key Shared secret key used for generating the HMAC variant of the message digest.
/// @description Create a hash-based message authentication code using a provided key
/// @source https://en.wikipedia.org/wiki/HMAC
var buffer = argument0
var buffer_offset = argument1
package main
import (
hmaclib "crypto/hmac"
"crypto/md5"
"encoding/hex"
"fmt"
"hash"
)