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
# This file is for use with a Hugo blog. | |
# be careful using this on real-life site, so that the patterns below don't dump legitimate traffic! | |
# we use 410 to be more aggressive than 404, and to unclutter Netlify statistics | |
/.env /bot.html 410 | |
/blog.zip /bot.html 410 | |
/.git/* /bot.html 410 | |
/browserconfig.xml /bot.html 410 | |
/OLD/* /bot.html 410 | |
/404.html /bot.html 410 |
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
name: CI CMake | |
env: | |
CMAKE_BUILD_TYPE: Release | |
CMAKE_GENERATOR: Ninja | |
CTEST_PARALLEL_LEVEL: 2 | |
on: | |
push: | |
- "**/CMakeLists.txt" |
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
% this script is run on Azure (or local) | |
import matlab.unittest.TestRunner | |
import matlab.unittest.Verbosity | |
import matlab.unittest.plugins.CodeCoveragePlugin | |
import matlab.unittest.plugins.XMLPlugin | |
import matlab.unittest.plugins.codecoverage.CoberturaFormat | |
name = "MyProject"; | |
suite = testsuite(name); |
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
# this fragment generates build/my_package.pc | |
# | |
# cmake -B build -DCMAKE_INSTALL_PREFIX=~/mylib | |
cmake_minimum_required(VERSION 3.0) | |
project(mylib | |
LANGUAGES C | |
HOMEPAGE_URL https://github.invalid/username/mylib | |
DESCRIPTION "example library" |
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
Simg = load('clown'); | |
imgs = Simg.X; | |
file = 'img.h5'; | |
name = '/img'; | |
h5create(file, name, size(imgs)) | |
h5write(file, name, imgs) | |
h5writeatt(file, name, 'CLASS', 'IMAGE') |
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 clone https://github.com/pmodels/mpich.git | |
$ git checkout v3.4.1 | |
$ ./configure --prefix=$HOME/mpich-3.4.1 --disable-cxx | |
# NOTE: if CPPFLAGS not set, configure will fail in HWLOC. There is some bug in mpich/configure that just requires CPPFLAGS. | |
# | |
# configure complete, but make fails instantly: | |
$ make |
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
cmake_minimum_required(VERSION 3.14) | |
project(demo Fortran) | |
# --- static flags avoid users needing libgfortran etc. on their Windows system | |
# MacOS and Linux needs more caution as true static linking is an advanced topic. | |
# this does not guarantee a portable executable, careful testing is needed and possibly further options | |
set(static_link_flags) | |
if(MINGW AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") | |
set(static_link_flags -static -static-libgfortran) | |
# MinGW / MSYS2 special considerations: https://www.msys2.org/news/#2021-01-31-aslr-enabled-by-default |
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
# do this after all install(...) commands so that all targets are finalized. | |
# Essentially, the last thing included at the end of the top-level CMakeLists.txt | |
set(CPACK_GENERATOR "TBZ2") | |
set(CPACK_SOURCE_GENERATOR "TBZ2") | |
set(CPACK_PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) | |
set(CPACK_SOURCE_IGNORE_FILES .git/ .github/ .vscode/ .mypy_cache/ _CPack_Packages/ | |
${CMAKE_BINARY_DIR}/ ${PROJECT_BINARY_DIR}/ | |
) |
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
find_package(Git REQUIRED) | |
function(add_git_submodule dir) | |
# add a Git submodule directory to CMake, assuming the | |
# Git submodule directory is a CMake project. | |
# | |
# Usage: in CMakeLists.txt | |
# | |
# include(AddGitSubmodule.cmake) | |
# add_git_submodule(mysubmod_dir) |
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
function extract_zstd(archive, out_dir) | |
% extract a zstd file "archive" to "out_dir" | |
arguments | |
archive (1,1) string {mustBeFile} | |
out_dir (1,1) string {mustBeFolder} | |
end | |
tar_arc = tempname; | |
ret = system("zstd -d " + archive + " -o " + tar_arc); |