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
@mmozeiko
mmozeiko / hook.c
Last active March 14, 2024 05:33
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
@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 January 13, 2024 23:40
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 <sam@hocevar.net>
#
# 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 */
@ndarville
ndarville / secret-key-gen.py
Created August 24, 2012 17:01
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@bellbind
bellbind / app.m
Created July 19, 2012 20:32
[macosx][objective-c]Make cocoa app without Xcode
// clang -framework Cocoa app.m -o app
// ./app
#import <Cocoa/Cocoa.h>
int main()
{
[NSAutoreleasePool new];
id app = [NSApplication sharedApplication];
[app setActivationPolicy:NSApplicationActivationPolicyRegular];