Skip to content

Instantly share code, notes, and snippets.

View McMartin's full-sized avatar

Alain Martin McMartin

View GitHub Profile
@McMartin
McMartin / .travis.yml
Created February 10, 2019 22:10
xcrun on Travis CI
language: cpp
install:
- which xcrun
script:
- xcrun --help
- xcrun --show-sdk-path || true
- xcrun --show-sdk-version || true
@McMartin
McMartin / lexer.cmake
Last active May 15, 2018 21:26
A CMake lexer written in CMake
cmake_policy(VERSION ${CMAKE_VERSION})
function(lexer filename out_namespace)
set(tokens_count 0)
set(line 1)
set(column 1)
macro(fill_buffer_from_file_content)
@McMartin
McMartin / tokenize.cmake
Last active May 15, 2018 21:26
A CMake tokenizer written in CMake
cmake_policy(VERSION ${CMAKE_VERSION})
function(tokenize filename out_namespace)
set(tokens_count 0)
set(line 1)
set(column 1)
macro(emit_token_and_advance type)
@McMartin
McMartin / min-self-tokenize.cmake
Last active May 15, 2018 21:25
A CMake script that reads itself and emits tokens
cmake_policy(VERSION ${CMAKE_VERSION})
function(print_token type text line column)
if(column LESS 10)
set(column "0${column}")
endif()
string(REGEX REPLACE "\n" "\\\\n" text "${text}")
@McMartin
McMartin / read-dls.py
Last active December 23, 2023 22:41
Read DLS file using Python
import struct
import sys
from chunk import Chunk
FOURCC_DLS = b'DLS '
FOURCC_DLID = b'dlid'
FOURCC_COLH = b'colh'
FOURCC_WVPL = b'wvpl'
#include "Model.hpp"
#include "QtEventLoop.hpp"
#include <QApplication>
#include <QDebug>
#include <QKeyEvent>
#include <QLabel>
#include <functional>
#include "QtEventLoop.hpp"
#include <QApplication>
#include <QDebug>
#include <QKeyEvent>
#include <QLabel>
#include <QMainWindow>
#include <functional>

Implementations of the Action-Model-View pattern:

  • with PDCurses
  • with Win32
@McMartin
McMartin / fizzbuzz.cmake
Last active February 6, 2018 22:23
A CMake test framework heavily inspired by Qt Quick Test (http://doc.qt.io/qt-5/qtquick-qtquicktest.html)
function(get_fizzbuzz in out)
math(EXPR off3 "${in} % 3")
math(EXPR off5 "${in} % 5")
if(NOT off3 AND NOT off5)
set(${out} FizzBuzz PARENT_SCOPE)
elseif(NOT off3)
set(${out} Fizz PARENT_SCOPE)
elseif(NOT off5)
set(${out} Buzz PARENT_SCOPE)
@McMartin
McMartin / fizzbuzz.cmake
Last active May 9, 2018 22:09
A CMake test framework heavily inspired by doctest (https://github.com/onqtam/doctest)
function(get_fizzbuzz in out)
math(EXPR off3 "${in} % 3")
math(EXPR off5 "${in} % 5")
if(NOT off3 AND NOT off5)
set(${out} FizzBuzz PARENT_SCOPE)
elseif(NOT off3)
set(${out} Fizz PARENT_SCOPE)
elseif(NOT off5)
set(${out} Buzz PARENT_SCOPE)