Skip to content

Instantly share code, notes, and snippets.

View sneppy's full-sized avatar

Andrea Mecchia sneppy

  • Arm Ltd.
View GitHub Profile
@sneppy
sneppy / packasplit
Last active December 20, 2019 16:05
A simple shell script based on splitsh-lite to sync split repos with the parent monorepo
#!/bin/bash
#================================
# A git subtree util to split
# a packagist monorepo in multiple
# manyrepos and sync version (tags)
#
# Usage:
# Download the script and call it
# inside the root folder of your
@sneppy
sneppy / bitpocket
Created March 10, 2019 20:35
An extension of the bitpocket by sickill -> https://github.com/sickill/bitpocket
#!/bin/bash
LANG=$(locale | grep LANG= | sed 's:LANG=::')
if [[ -z "$LANG" ]]; then
LANG="C"
fi
export LC_ALL=$LANG # for stable "sort" output
# Paths
@sneppy
sneppy / disasm
Created March 10, 2019 20:37
Simple shell program to disasm a function of a C/C++ program (requires gdb)
#!/bin/bash
# Call GDB with batch
gdb -batch -ex "file $1" -ex "disas $2"
@sneppy
sneppy / deferred-render.comp
Created May 11, 2019 23:26
Procedural terrain generation + volumetric fog rendering
//////////////////////////////////////////////////
// The final part of the deferred shading pipeline
// is made with a compute shader (because I'm too
// lazy to draw a quad and write another .vert/.frag)
//////////////////////////////////////////////////
#version 450 core
uniform float time;
uniform float samplingStep;
uniform ivec2 fboSize;
# Variables
# ^^^^^^^^^
# FbxSdk_FOUND
# FbxSdk_INCLUDE_DIR
# FbxSdk_LIBRARIES
# Find root dir
find_path(FBXSDK_ROOT_DIR
NAMES
@sneppy
sneppy / tuple.h
Last active November 7, 2019 15:30
A C++ replica of Python's tuple
/**
* @copyright
*/
#pragma once
/**
* Compute min between two numbers
*/
template<typename T>
@sneppy
sneppy / quicksort.h
Last active January 17, 2020 17:25
A C++ quicksort implementation that requires only a forward iterator to work
template<typename T>
struct RemoveReference
{
using Type = T;
};
template<typename T> struct RemoveReference<T&> { using Type = T; };
template<typename T>
inline void swap(T & a, T & b)
@sneppy
sneppy / chain.sql
Last active April 18, 2020 09:55
PonyORM
---------------------------------------------
-- This procedure takes as input the hash of
-- a post commit and returns the chain of
-- parent commits up to the root commit (i.e.
-- NULL parent)
---------------------------------------------
-- Drop old procedure
drop procedure if exists commit_chain;
@sneppy
sneppy / format.js
Created April 27, 2020 19:06
sprintf for JavaScript
/**
*
*/
String.prototype.format = function formatString(...subs) {
// String tag functions
// @ref https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
const formatter = (strings, ...keys) => {
return (...values) => {
@sneppy
sneppy / .gitignore
Last active September 24, 2021 09:45
VS Code settings for building, testing and debugging C/C++ projects
*.a
*.so
*.so.?*
*.dll
*.exe
*.dylib
*.cmake
!/cmake/*.cmake
!/test/AssemblyTests.cmake
*~