Skip to content

Instantly share code, notes, and snippets.

View Luthaf's full-sized avatar
🦆

Guillaume Fraux Luthaf

🦆
View GitHub Profile
@Luthaf
Luthaf / ExternalBuffer.hpp
Last active October 2, 2017 20:33
External buffer for nbind
#include <cstddef>
/// A non-owning memory view in a C++ std::vector<double> like object.
class ExternalBuffer {
public:
ExternalBuffer(double* data, size_t length):
data_(data), length_(length) {}
void* data() {
return reinterpret_cast<void*>(data_);
@Luthaf
Luthaf / aarch64.cmake
Last active December 19, 2022 18:24
Ubuntu CMake Toolchain files
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_CROSSCOMPILING TRUE)
if (CMAKE_TOOLCHAIN_FILE)
endif()
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
@Luthaf
Luthaf / chemiscope-nan-to-sparse.py
Created July 21, 2021 15:38
Transform chemiscope input with NaN to the new sparse environenments format
import gzip
import json
import numpy as np
input_path = "./app/examples/Zeolites.json.gz"
output_path = "Zeolites.json.gz"
with gzip.open(input_path) as fd:
data = json.load(fd)
@Luthaf
Luthaf / chemiscope-nan-to-sparse.py
Created January 24, 2022 14:05
Chemiscope NaN to sparse environments
import gzip
import json
import numpy as np
input_path = "TODO"
output_path = "TODO"
if input_path.endswith(".gz"):
with gzip.open(input_path) as fd: