Skip to content

Instantly share code, notes, and snippets.

View mmha's full-sized avatar

Morris Hafner mmha

  • Berlin, Germany
  • 22:27 (UTC +02:00)
View GitHub Profile
#include <CL/cl.h>
#include <dlfcn.h>
#include <type_traits>
namespace weakbindgen {
template<typname T> using id = T;
}
using namespace weakbindgen;
namespace weakbindgen {
@mmha
mmha / wiki_example.cpp
Created April 26, 2019 09:33
Updated Wiki SYCL example
#include <CL/sycl.hpp>
#include <iostream>
class init_a;
class init_b;
class matrix_add;
using namespace cl::sycl;
// Size of the matrices
@mmha
mmha / Opustest.cpp
Created October 22, 2016 00:06
Old toy code to try out libopus with the 3D sound capabilities of OpenAL
#include <iostream>
#include <memory>
#include <cmath>
#include <unistd.h>
#include <time.h>
#include <opus/opusfile.h>
#include <AL/al.h>
#include <AL/alc.h>
int main(int argc, const char *argv[])
@mmha
mmha / ScopeGuard.h
Created October 21, 2016 18:19
Andrei Alexandrescus ScopeGuard Macros
#ifndef SCOPEGUARD_H
#define SCOPEGUARD_H
// Taken from "Declarative Control Flow" (CppCon 2015)
#include <exception>
#include <utility>
#define CONCATENATE_IMPL(s1, s2) s1##s2
#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2)
@mmha
mmha / GLBeginEndChecker.cpp
Created September 19, 2016 01:56
Clang Static Analyzer Plugin for glBegin()/glEnd() (Old toy code, written against Clang 3.6.0)
#include "GLBeginEndChecker.h"
#include <iostream>
REGISTER_MAP_WITH_PROGRAMSTATE(GLBES, int, GLBeginEndState)
namespace clang
{
namespace ento
{
void registerGLBeginEndChecker(CheckerManager &mgr)
@mmha
mmha / formula.sh
Created September 13, 2016 22:06
Render Latex and copy the image into the clipboard
#!/bin/sh
TEMPDIR=`mktemp -d --tmpdir=/tmp`
CURDIR=`pwd`
cd $TEMPDIR
echo "\documentclass[convert]{standalone}\begin{document}" > src.tex
echo $1 >> src.tex
echo "\end{document}" >> src.tex
pdflatex -shell-escape src.tex > /dev/null
cat src.png | xclip -selection c -t image/png