Skip to content

Instantly share code, notes, and snippets.


Andreas Hollandt Trass3r

View GitHub Profile
View gist:8774345
#include <cstdint>
#include <iostream>
template <typename T>
class DInputRange
struct iterator
const T* r;
Trass3r / FlattenedRange.cpp
Last active Aug 29, 2015
fun with range templates
View FlattenedRange.cpp
#include <type_traits>
//! range spanned by 2 iterators
template <typename Iterator>
struct IteratorRange
IteratorRange(Iterator begin, Iterator end)
: _begin(std::move(begin)),
Trass3r / range_zip
Created May 18, 2015
C++ range zip
View range_zip
#include <boost/iterator/zip_iterator.hpp>
#include <boost/range.hpp>
template <typename... T>
auto zip(T&&... containers) -> boost::iterator_range < boost::zip_iterator<decltype(boost::make_tuple(std::begin(containers)...))> >
auto&& zip_begin = boost::make_zip_iterator(boost::make_tuple(std::begin(containers)...));
auto&& zip_end = boost::make_zip_iterator(boost::make_tuple(std::end(containers)...));
return boost::make_iterator_range(zip_begin, zip_end);
Trass3r / devirtualization list
Created Jun 4, 2015
list top gcc devirtualization warnings
View devirtualization list
cat build.log | fgrep suggest-final | sed -r 's/.+Declaring (.+) final [^0-9]+([0-9]+) calls?.+/\2 \1/g' | sort -k1,1 -nr | head -n25
Trass3r / cudamem.h
Created Aug 19, 2015
CUDA simple memory wrapper class
View cudamem.h
template <typename T>
struct CUDAMem
T* ptr;
: ptr(0)
cudaError_t err = cudaMallocArray(&ptr, sizeof(T));
if (err != cudaSuccess)
View Qt dark theme
connect(ui.actionDarkOrangeTheme, &QAction::triggered, this, &MainWindow::activateDarkOrangeTheme);
connect(ui.actionDarkFusionTheme, &QAction::triggered, this, &MainWindow::activateDarkFusionTheme);
#include <QStyleFactory>
#define raw(...) #__VA_ARGS__
#pragma region qss
Trass3r / gist:6713302
Created Sep 26, 2013
quickly dump OpenGL texture
View gist:6713302
glBindTexture(GL_TEXTURE_2D, textureID);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
GLint width, height, level = 0;
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, &width);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_HEIGHT, &height);
std::unique_ptr<unsigned short[]> data(new unsigned short[width * height]);
glGetTexImage(GL_TEXTURE_2D, level, GL_RED, GL_UNSIGNED_SHORT, data.get());
glPixelStorei(GL_PACK_ALIGNMENT, 4);
View 1404Encryption.cpp
void decrypt(short* src, short* dest, int size)
int x=0xA2C2A, y=0;
for (int i = 0; i < size; ++i)
x = x*0x343FD + 0x269EC3;
y = x >> 0x10 & 0x7FFF;
dest[i] = src[i] ^ LOWORD(y);
Trass3r / EnableVisualStudioProjectRebuildReasonLogging.reg
Created Nov 17, 2016
Get Visual Studio logging for 'fast up-to-date checker'
View EnableVisualStudioProjectRebuildReasonLogging.reg
Windows Registry Editor Version 5.00
Trass3r / CheckProjectFileHeadersExist.cs
Last active Jan 12, 2017
check vcxproj files for non-existent header files causing MSBuild to rebuild
View CheckProjectFileHeadersExist.cs
using System;
using System.IO;
using System.Xml.Linq;
static class Program
static void check(string fileName)
XDocument project = XDocument.Load(fileName);
XNamespace msbuild = XNamespace.Get("");
You can’t perform that action at this time.