Skip to content

Instantly share code, notes, and snippets.

View zaps166's full-sized avatar

Błażej Szczygieł zaps166

View GitHub Profile
@zaps166
zaps166 / cpp_backtrace.cpp
Created February 3, 2018 17:08
Display backtrace at runtime
// "-rdynamic" must be enabled and symbols mustn't be hidden
#include <execinfo.h>
#include <cxxabi.h>
#include <iostream>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <thread>
@zaps166
zaps166 / .bashrc
Last active May 27, 2020 11:38
Display Git commit hash and branch name and enable git completions
getGitInfo()
{
checksum=$(git rev-parse --short HEAD 2> /dev/null)
branch=$(git symbolic-ref --short HEAD 2> /dev/null)
if [ ! -z $branch ] && [ ! -z $checksum ]; then
echo -e " ($branch $checksum)"
elif [ ! -z $checksum ]; then
echo -e " ($checksum)"
elif [ ! -z $branch ]; then
echo -e " ($branch)"