Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@Leandros
Leandros / main.lua
Last active April 24, 2024 20:38
Love2D Fixed Timestep
local TICKRATE = 1/60
function love.update(dt)
end
function love.draw(dt)
end
function love.run()
if love.math then
@x1nixmzeng
x1nixmzeng / soul_worker_res_types.txt
Last active June 17, 2023 20:02
Quick python script to dump the structures from Soul Worker Online
012640BC PUSH SoulWork.01C79544 ASCII "tb_Achievement"
01264666 PUSH SoulWork.01C79558 ASCII "tb_Achievement_begin"
0126478C PUSH SoulWork.01C79570 ASCII "tb_Achievement_Emblem"
01264AAC PUSH SoulWork.01C79588 ASCII "tb_Achievement_Script"
01264C66 PUSH SoulWork.01C795A0 ASCII "tb_Akashic_Disassemble"
01264DA6 PUSH SoulWork.01C795B8 ASCII "tb_Akashic_Make"
01264F0C PUSH SoulWork.01C795C8 ASCII "tb_Akashic_Parts"
012651DC PUSH SoulWork.01C795DC ASCII "tb_Akashic_Records"
0126587C PUSH SoulWork.01C795F0 ASCII "tb_Appearance"
01265AF6 PUSH SoulWork.01C79600 ASCII "tb_Aura"
@rahilwazir
rahilwazir / vmdk_vhdx.md
Last active September 25, 2025 10:46
Convert VMWare to Hyper-V (vmdk to vhdx)
@ChrisWellsWood
ChrisWellsWood / empty_rust_structs.md
Last active February 9, 2025 11:11
Initialising empty structs in Rust.

Initialising Empty Structs in Rust

In C/C++, you can initialise a struct without giving values for any of the fields:

struct Point {
  float x;
  float y;
  float z;
};
@dtoma
dtoma / Makefile
Last active July 8, 2025 09:42
makefile rules to check style using clang-format
style:
@for src in $(SOURCES) ; do \
echo "Formatting $$src..." ; \
clang-format -i "$(SRC_DIR)/$$src" ; \
clang-tidy -checks='-*,readability-identifier-naming' \
-config="{CheckOptions: [ \
{ key: readability-identifier-naming.NamespaceCase, value: lower_case },\
{ key: readability-identifier-naming.ClassCase, value: CamelCase },\
{ key: readability-identifier-naming.StructCase, value: CamelCase },\
{ key: readability-identifier-naming.FunctionCase, value: camelBack },\
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace AudioController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@hydranix
hydranix / gist:b8af0c197a1cc11429da600c33c15418
Created April 16, 2017 14:35
[Undocumented WinAPI] Timer Resolution
// From Oskar Dahlberg's post at:
// http://stackoverflow.com/a/31411628/4725495
#include <Windows.h>
static NTSTATUS(__stdcall *NtDelayExecution)(BOOL Alertable, PLARGE_INTEGER DelayInterval) = (NTSTATUS(__stdcall*)(BOOL, PLARGE_INTEGER)) GetProcAddress(GetModuleHandle("ntdll.dll"), "NtDelayExecution");
static NTSTATUS(__stdcall *ZwSetTimerResolution)(IN ULONG RequestedResolution, IN BOOLEAN Set, OUT PULONG ActualResolution) = (NTSTATUS(__stdcall*)(ULONG, BOOLEAN, PULONG)) GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwSetTimerResolution");
@mortennobel
mortennobel / SingleFileOpenGLTex.cpp
Last active October 23, 2024 20:56
Single file OpenGL 3.3 / WebGL (using Emscripten) example with texture (SDL2 / SDL_Image 2)
//
// Compile for emscripten using
// emcc -Iinclude SingleFileOpenGLTex.cpp \
-O2 -std=c++14 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --preload-file examples/data -s USE_SDL=2 -o html/SingleFileOpenGLTex.html
// where the following images must be located in a subfolder
// - examples/data/test.png
// - examples/data/cartman.png
// - examples/data/cube-negx.png
// - examples/data/cube-negz.png
//
@JustasMasiulis
JustasMasiulis / main.cpp
Last active November 7, 2024 12:25
Simple d2d1 overlay
#include "overlay_drawer.hpp"
#include <iostream>
#include <random>
#include <chrono>
std::minstd_rand gen(std::random_device{}());
const std::uniform_real_distribution<float> uni_col(0.2f, 1.f);
const std::uniform_int_distribution<int> uni_pos(100, 1000);
const std::uniform_int_distribution<int> uni_sz(30, 100);