This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <iostream> | |
template <typename T> | |
class DInputRange | |
{ | |
public: | |
struct iterator | |
{ | |
const T* r; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
//! range spanned by 2 iterators | |
template <typename Iterator> | |
struct IteratorRange | |
{ | |
IteratorRange(Iterator begin, Iterator end) | |
: _begin(std::move(begin)), | |
_end(std::move(end)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
struct CUDAMem | |
{ | |
T* ptr; | |
CUDAMem() | |
: ptr(0) | |
{ | |
cudaError_t err = cudaMallocArray(&ptr, sizeof(T)); | |
if (err != cudaSuccess) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# merge into subdir | |
git config --global mergeintosubdirectory "!sh -c 'git merge -s ours --no-commit $1 && git read-tree --prefix=$2 -u $1 && git status' -" | |
# fix line endings | |
# use RAM disk since this is slow | |
# added benefit of creating .gitattributes in the first commit | |
FASTDISKWORKDIR=$TEMP/workdir | |
time git filter-branch -d "$FASTDISKWORKDIR" -f --tree-filter "echo '* text=auto' > .gitattributes && rm $FASTDISKWORKDIR/index && git reset && git add -u" --tag-name-filter cat --prune-empty -- --all | |
# rewrites with commands other than filter-branch alter the committers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#git conversion: | |
# init: see 'subgit help configure' | |
subgit configure --layout auto -T trunk/Project http:/baseurl... FooSubGit | |
# edit FooSubGit/subgit/config and authors.txt | |
# in particular take care of | |
#[svn] | |
# url = http:/.../trunk/... | |
# trunk = :refs/heads/master | |
# # Note: if repos have been moved around you can define the old locations as branches and subgit will connect the dots! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first rebuild solution | |
# then | |
echo '[' > compile_commands.json | |
find obj/v140/x64/Debug/ -name 'CL.command.*' | xargs iconv -f utf-16 -t utf-8 | grep -hF '/c' | sed -r -e 's#\\#/#g' -e 's/"/\\"/g' -e 's#/c .+ ((.:/.+)/[^/]+\.[^/]*)$#{\r\n\t"command": "clang-cl.exe -m64 --driver-mode=cl \0 -Wno-error",\r\n\t"file": "\1",\r\n\t"directory": "\2"\r\n},#g' >> compile_commands.json | |
echo ']' >> compile_commands.json | |
# example use | |
"C:\Program Files\Git\usr\bin\find.exe" src -name "*.cpp" | "C:\Program Files\Git\usr\bin\xargs.exe" -n1 -P1 -t "C:\Program Files\LLVM\bin\clang-check.exe" -p . -fixit | |
find src -name '*.cpp' | xargs -n1 -P1 -t 'C:\Program Files\LLVM\bin\clang-tidy.exe' -p . -header-filter=.* -fix -checks=cppcoreguidelines-pro-type-member-init |
OlderNewer