Skip to content

Instantly share code, notes, and snippets.

@ryanfleury
ryanfleury / obj_parse.h
Last active October 5, 2021 22:59
Single-header OBJ Parser (WIP)
// ----------------------------------------------------------------------------
// Single Header Wavefront OBJ Parser, by Ryan Fleury
// ----------------------------------------------------------------------------
//
// This is a single-header Wavefront OBJ parsing library that is both C99+ and
// C++ compatible. There are two APIs that you can use. One of which is lower
// level and more shippable, and the other is high level and less shippable,
// but is nice to get things off the ground.
//
// To use this file, you must #define OBJ_PARSE_IMPLEMENTATION in at least ONE
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ioctl.h>
@mmozeiko
mmozeiko / hook.c
Last active October 13, 2024 00:45
reads process stdout + stderr and prints it out as it becomes available
// compile this to hook.dll
// for example, with MSVC: cl.exe /LD /MT /O2 hook.c /Fehook.dll
#include <windows.h>
// get this from https://github.com/kubo/plthook
#include "plthook_win32.c"
static plthook_t* hook;
  • void glEnableVertexAttribArray​(GLuint attribIndex);
  • void glDisableVertexAttribArray​(GLuint attribIndex);
  • void glVertexAttribPointer(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
  • void glVertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
  • void glVertexAttribBinding(GLuint attribIndex, GLuint bindingIndex);
  • void glBindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, GLintptr stride);
parameter Details
attribIndex the location for the vertex attribute to which the vertex array will feed data
@croepha
croepha / main.cpp
Created December 15, 2016 18:09
Example of calling into the kernel vdso directly
#include <stdio.h>
#include <sys/auxv.h> // For getauxval and AT_SYSINFO_EHDR
#include <string.h>
#include <elf.h>
typedef unsigned char u8;
void* vdso_sym(char* name) {
// in order to semantically inline getauxval one would have to bypass glibc, as the auxval is passed
// by the kernel to the bin's entrypoint used by the kernel
@jmacko
jmacko / fhfs_cmd_exec.rb
Last active September 3, 2019 16:40
FHFS 2.1.2 Command Injection Exploit - Derbycon 2015
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'msf/core/exploit/powershell'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
@samhocevar
samhocevar / gist:00eec26d9e9988d080ac
Last active October 17, 2024 17:02
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <[email protected]>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
@macu
macu / timeout.swift
Last active February 22, 2022 08:03
Timeout utility in Swift, with the ability to cancel a deferred callback.
import Foundation
/// Timeout wrapps a callback deferral that may be cancelled.
///
/// Usage:
/// Timeout(1.0) { println("1 second has passed.") }
///
class Timeout: NSObject
{
private var timer: NSTimer?
import sys
import getpass
sentry_url = 'http://<hash>:<hash>@sentry-server.local/1'
try:
import raven
RAVEN_CLIENT = raven.Client(sentry_url)
RAVEN_CLIENT.tags_context({'user':getpass.getuser()})
except:
RAVEN_CLIENT = None
@kashyapp
kashyapp / mmap-fork.c
Last active June 8, 2022 01:39
sample code to test out fork and mmap of shared memory
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */