Skip to content

Instantly share code, notes, and snippets.

View gyakoo's full-sized avatar

Manu Marin gyakoo

View GitHub Profile
@gyakoo
gyakoo / socket.c
Created October 21, 2015 18:34 — forked from nolim1t/socket.c
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
@gyakoo
gyakoo / ssecheck.cpp
Created August 11, 2016 17:40 — forked from hi2p-perim/ssecheck.cpp
Check SSE/AVX instruction support.
/*
Check SSE/AVX support.
This application can detect the instruction support of
SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4a, SSE5, and AVX.
*/
#include <iostream>
#ifdef _MSC_VER
#include <intrin.h>
#endif
@gyakoo
gyakoo / gist:a76747aeb2fdf9f7203db426a94b1929
Created October 17, 2016 22:00 — forked from jesusdesantos/gist:5371743
A benchmark for several allocators used in Noesis
------------------------------------------------------------------------
Memory Allocator perfomance benchmark
------------------------------------------------------------------------
local_n = n threads allocating and deallocating random blocks of max
size. Deallocations always happening in the same thread that
the corresponding allocation.
share_n = n threads allocating and deallocating random blocks of max
size from a shared list. Deallocation may happen in different
thread that the allocation one
@gyakoo
gyakoo / tilt.shift.glsl
Created November 22, 2016 22:57 — forked from ruby0x1/tilt.shift.glsl
Tilt shift shader, modified from something @grapefrukt gave me
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/)
// Read http://notes.underscorediscovery.com/ for context on shaders and this file
// License : MIT
uniform sampler2D tex0;
varying vec2 tcoord;
varying vec4 color;
/*
Take note that blurring in a single pass (the two for loops below) is more expensive than separating
@gyakoo
gyakoo / Fxaa3_11.h
Created December 8, 2016 23:20
NVIDIA FXAA 3.11 by TIMOTHY LOTTES
/*============================================================================
NVIDIA FXAA 3.11 by TIMOTHY LOTTES
------------------------------------------------------------------------------
COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
------------------------------------------------------------------------------
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
@gyakoo
gyakoo / preprocessor_fun.h
Created January 23, 2017 20:52 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
// lib /def:user32.def
// cl /O2 test.cpp /link user32.lib
#include <Windows.h>
#include <stdio.h>
struct PrecisionTouchPadConfig {
BYTE LegacyParams[3];
BOOL LoadedSettings;
// 0: No delay (always on)
@gyakoo
gyakoo / lua_map.c
Created March 6, 2018 23:21 — forked from randrews/lua_map.c
Example of embedding Lua in C
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <stdlib.h>
int map_create(lua_State *lua);
int map_slice(lua_State *lua);
int main(int argc, char **argv){
lua_State *lua = lua_open();
@gyakoo
gyakoo / min_max.hh
Created May 18, 2018 18:54 — forked from thomcc/min_max.hh
C++11 variadic max, min, and minmax implementations.
#pragma once
#include <utility>
// varidic max, min, and minmax implementation (named maximum, minimum and min_max to avoid confusion)
// no support for custom comparators (mainly because i'm not sure how they should be specified)
namespace detail {
// max base case
template <class T>