Skip to content

Instantly share code, notes, and snippets.

Avatar
🔱
A demon, killing demons.

Alex Hirsch W4RH4WK

🔱
A demon, killing demons.
View GitHub Profile
View .clang-format-cpp
---
Language: Cpp
BasedOnStyle: LLVM
ColumnLimit: 120
IndentWidth: 4
Standard: Latest
TabWidth: 4
UseTab: ForIndentation
AlignEscapedNewlines: Left
@W4RH4WK
W4RH4WK / payload.sh
Created Apr 17, 2020
Bash inline text payload
View payload.sh
#!/bin/bash
readonly payload='\
foo abc xyz
bar def uvw'
while read one two three ; do
echo $one : $two : $three
done <<< $payload
View glfw_gamepad_input.cs
// 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 Dec 16, 2019
OpenCL Dump Kernels
View opencl_dump_kernels.c
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);
View sh.rb
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 Apr 28, 2019
GridMove 3x2 grid optimized for numpad
View w4rh4wk.grid
; grid: w4rh4wk
[Groups]
NumberOfGroups = 99
[1]
TriggerTop = -50
TriggerBottom = -50
@W4RH4WK
W4RH4WK / CollisionLogger.cs
Created Feb 28, 2019
Unity Collision Logger Component
View CollisionLogger.cs
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 Jul 27, 2018
Copy On Write Shared Ptr
View cow.cpp
#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 Jul 26, 2018
Visual Assist X snipepts %appdata%/VisualAssist/Autotext
View cpp.tpl
a:#ifdef ... #endif:#ifdef:
#ifdef $condition$
$selected$$end$
#endif // $condition$
a:Untitled:#in:
#include "$end$"
a:Untitled:#in:
#include <$end$>
View sdl_raii.cpp
/* SDL RAII
*
* This file provides RAII wrappers for SDL objects.
*
*/
#include <memory>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
You can’t perform that action at this time.