Skip to content

Instantly share code, notes, and snippets.

View ktf's full-sized avatar

Giulio Eulisse ktf

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ktf on github.
  • I am ktf77 (https://keybase.io/ktf77) on keybase.
  • I have a public key ASCMCAlg8ByqDKCWwuf09m1jRqJHmGpw2MZxK5YXZqrUpQo

To claim this, I am signing this object:

@ktf
ktf / fix-iostream.sh
Created May 14, 2018 20:46
Fix a few trivial `#include <iostream>` in an headerfile
#!/bin/bash -ex
FILES=`git grep iostream | grep /include/ | grep \.h: | sed -e 's/:.*//'`
for HEADER in $FILES; do
CXX=`echo $HEADER | sed -e's|include/[^/]*|src|;s|\.h$|.cxx|'`
HEADER_SHORT=`echo $HEADER | sed 's|.*/include/||g'`
echo $HEADER
echo $HEADER_SHORT
echo $CXX
# If there is no src Directory, we cannot simply amend the build like this.
if [ ! -d `dirname $CXX` ]; then
FILES=$(git grep -l -e 'namespace[[:space:]]*framework[[:space:]]*[{]' Framework/)
git reset --hard HEAD
for x in $FILES; do
echo $x
ed -s $x<< \EOF
g/namespace[ ]*o2[ ]*{/s/[ ]*{//
a
{
.
@ktf
ktf / constexpr-typeid.cxx
Last active October 31, 2019 09:48
constexpr typeid
#include <cstddef>
#include <cstdint>
// Adapted from https://github.com/Manu343726/ctti
struct TypeIdHelpers {
// From https://github.com/foonathan/string_id. As usually, thanks Jonathan.
using hash_t = uint64_t;
// See http://www.isthe.com/chongo/tech/comp/fnv/#FNV-param
@ktf
ktf / example.cxx
Last active November 4, 2019 20:47
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.