Skip to content

Instantly share code, notes, and snippets.

View W4RH4WK's full-sized avatar
🛠️
Technomancer

Alex Hirsch W4RH4WK

🛠️
Technomancer
View GitHub Profile
@W4RH4WK
W4RH4WK / .clang-format-cpp
Last active November 4, 2020 09:47
Clang Format
---
Language: Cpp
BasedOnStyle: LLVM
ColumnLimit: 120
IndentWidth: 4
Standard: Latest
TabWidth: 4
UseTab: ForIndentation
AlignEscapedNewlines: Left
@W4RH4WK
W4RH4WK / payload.sh
Created April 17, 2020 12:41
Bash inline text payload
#!/bin/bash
readonly payload='\
foo abc xyz
bar def uvw'
while read one two three ; do
echo $one : $two : $three
done <<< $payload
// Instructions:
// 1) Add NuGet: glfw-net
// 2) Download official GLFW DLL (pre-compiled): https://www.glfw.org/download.html
// 3) Copy DLL to $(TargetDir) so it can be loaded
// 4) Rename DLL to glfw.dll
using GLFW;
using System;
using System.Threading;
@W4RH4WK
W4RH4WK / opencl_dump_kernels.c
Last active December 16, 2019 14:08
OpenCL Dump Kernels
void dump_kernels(size_t num_devices)
{
size_t num_binaries = num_devices;
size_t *sizes = malloc(num_binaries * sizeof(sizes[0]));
assert(sizes);
clGetProgramInfo(clProgram, CL_PROGRAM_BINARY_SIZES, num_binaries * sizeof(sizes[0]), sizes, NULL);
unsigned char **binaries = malloc(num_binaries * sizeof(binaries[0]));
assert(binaries);
def `(cmd) #`
stdout = Kernel.`(cmd) #`
raise "Command failed with status (#{$?.exitstatus}) '#{cmd}'" unless $?.success?
return stdout
end
puts `date`.split[1]
@W4RH4WK
W4RH4WK / w4rh4wk.grid
Last active April 28, 2019 10:05
GridMove 3x2 grid optimized for numpad
; grid: w4rh4wk
[Groups]
NumberOfGroups = 99
[1]
TriggerTop = -50
TriggerBottom = -50
@W4RH4WK
W4RH4WK / CollisionLogger.cs
Created February 28, 2019 12:16
Unity Collision Logger Component
using UnityEngine;
public class CollisionLogger : MonoBehaviour
{
void OnTriggerEnter() => Debug.Log("Trigger Enter");
void OnTriggerStay() => Debug.Log("Trigger Stay");
void OnTriggerExit() => Debug.Log("Trigger Exit");
@W4RH4WK
W4RH4WK / cow.cpp
Last active July 27, 2018 17:37
Copy On Write Shared Ptr
#include <iostream>
#include <memory>
struct vec3 {
int x, y, z;
};
std::ostream& operator<<(std::ostream& out, const vec3& v)
{
return out << "vec3{" << v.x << ", " << v.y << ", " << v.z << "}";
@W4RH4WK
W4RH4WK / cpp.tpl
Created July 26, 2018 14:03
Visual Assist X snipepts %appdata%/VisualAssist/Autotext
a:#ifdef ... #endif:#ifdef:
#ifdef $condition$
$selected$$end$
#endif // $condition$
a:Untitled:#in:
#include "$end$"
a:Untitled:#in:
#include <$end$>
/* SDL RAII
*
* This file provides RAII wrappers for SDL objects.
*
*/
#include <memory>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>