Skip to content

Instantly share code, notes, and snippets.

View tsaarni's full-sized avatar

Tero Saarni tsaarni

  • Ericsson
  • Finland
  • 12:21 (UTC +03:00)
View GitHub Profile
@tsaarni
tsaarni / bug-infinite-recursion-accidental-automatic-typecast.cpp
Last active August 29, 2015 14:24
Unintentional typecast that causes infinite recursive loop
// clang++ -Wall -std=c++11 -O0 -o test test.cpp && ./test
// g++ -Wall -std=c++11 -O0 -o test test.cpp && ./test
#include <iostream>
#include <vector>
#include <cstdio>
namespace Ns
{
@tsaarni
tsaarni / stack-backtrace.cpp
Last active August 20, 2023 23:33
How to print stack backtrace in gcc
/*
## Compile
g++ -Wall -std=c++11 -rdynamic -g stack-backtrace.cpp -lbacktrace -o stack-backtrace && ./stack-backtrace
clang++ -Wall -std=c++11 -rdynamic -g stack-backtrace.cpp -lbacktrace -o stack-backtrace && ./stack-backtrace
## Output
Backtrace:
@tsaarni
tsaarni / strapdown.cgi
Last active August 29, 2017 19:41
Configure Apache to render markdown files automatically
#!/bin/bash
#
# To make apache render files ending with .md with strapdown.js
# markdown renderer (http://strapdownjs.com/), add following lines
# to /etc/apache2/httpd.conf:
#
# Action markdown /cgi-bin/strapdown.cgi
# AddHandler markdown .md
# DirectoryIndex index.html index.md
#