Skip to content

Instantly share code, notes, and snippets.

View trishume's full-sized avatar

Tristan Hume trishume

View GitHub Profile
#pragma once
#pragma warning(push)
#pragma warning(disable:4996)
#include <cassert>
#include <memory>
#include <vector>
@jld
jld / bp_test.c
Created August 5, 2014 22:26
Example of using a perf_event breakpoint counter to crash on write to a specific location.
#include <fcntl.h>
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
@CedricGuillemet
CedricGuillemet / YAP.h
Last active December 17, 2020 01:02
Yet Another Profiler
#pragma once
/*
_____.___. __ __ .__
\__ | | ____ _/ |_ _____ ____ ____ _/ |_ | |__ ____ _______
/ | |_/ __ \ \ __\ \__ \ / \ / _ \ \ __\| | \ _/ __ \ \_ __ \
\____ |\ ___/ | | / __ \_| | \( <_> ) | | | Y \\ ___/ | | \/
/ ______| \___ > |__| (____ /|___| / \____/ |__| |___| / \___ > |__|
\/ \/ \/ \/ \/ \/
__________ _____ .__ .__
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active April 23, 2024 19:02
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@genekogan
genekogan / _Instructions.md
Last active March 5, 2021 13:10
instructions for generating a style transfer animation from a video

Instructions for making a Neural-Style movie

The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.

Setting up the environment

The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.

If you do load the

nix-path () {
nix-instantiate --eval --expr 'with import <nixpkgs> {}; "${'"$1"'}"' | sed 's/"//g'
}
$ nix-path xorg.libX11
/nix/store/qyf0r9vfqyybdwjmrngy0k44gl4607nk-libX11-1.6.3-dev
@BenjaminPoilve
BenjaminPoilve / eyeTrack.py
Created August 22, 2016 08:45
Fabian Timm eye center location algorithm in python
import operator
import numpy as np
import math
import cv2
from config import config
kGradientThreshold = 10.0
kWeightBlurSize = 5;
maxEyeSize=8;
@mbbx6spp
mbbx6spp / lstnix.sty
Created October 1, 2016 03:05
First effort at writing a Nix lstlisting language definition.
\definecolor{identifiercolor}{rgb}{0.8,0.6,0.9}
\definecolor{keywordcolor}{rgb}{0.6,0.9,0.6}
\definecolor{commentcolor}{rgb}{0.8,0.8,0.9}
\definecolor{stringcolor}{rgb}{0.5,0.6,0.9}
\lstdefinelanguage{Nix}{
% Anything betweeen $ becomes LaTeX math mode
mathescape=false,
% Comments may or not include Latex commands
texcl=false,
keywords=[1]{inherit,import,if,then,else,false,true,or,rec,let,in,assert,with},
@pervognsen
pervognsen / vex.c
Last active October 23, 2022 11:02
// The stack is 8-byte aligned.
#define ALIGN(p) ((uint64_t *)(((uintptr_t)(p) + 7) & ~7))
#define STACK(stack, size) uint64_t *_stack = ALIGN(stack), *_stack_end = (uint64_t *)((char *)(stack) + size)
#define PUSH(x) do { memcpy(_stack, &x, sizeof(x)); _stack += (sizeof(x) + 7) / 8; } while (0)
#define POP(x) do { _stack -= (sizeof(x) + 7) / 8; memcpy(&x, _stack, sizeof(x)); } while (0)
#if __GNUC__
// Use computed gotos on GCC-compatible compilers (including Clang).
#define JOIN(x, y) x##y
#define LABEL(name) JOIN(label, name)