Skip to content

Instantly share code, notes, and snippets.

@oneamtu
oneamtu / gtest.cmake
Created September 16, 2012 20:38
How to add google test as an downloadable external project
########################### GTEST
# Enable ExternalProject CMake module
INCLUDE(ExternalProject)
# Set default ExternalProject root directory
SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party)
# Add gtest
# http://stackoverflow.com/questions/9689183/cmake-googletest
ExternalProject_Add(
@bellbind
bellbind / Makefile
Last active October 17, 2019 18:29
[iojs][emscripten] Call sudoku solver function implemented in C on iojs
all: libsudoku.js sudoku.js sudoku
clean:
rm -f libsudoku.js sudoku.js sudoku
rm -f libsudoku.js.map sudoku.js.map
rm -f libsudoku.js.mem sudoku.js.mem
# library for using functions in hand written JavaScript code
libsudoku.js: libsudoku.c
emcc -g4 -Wall -Wextra -std=c11 $^ -o $@ \
-s EXPORTED_FUNCTIONS="['_output', '_sudoku']" \
@maxivak
maxivak / readme.md
Last active February 20, 2024 21:19
Install PowerDNS with recursor and MySQL backend

PowerDNS

PowerDNS is not designed to provide recursive results. It is intended to act only as an authoritative server for the domains it serves. This implies it will be serving domain data to other hosts.

Install pdns and pdns-recursor

sudo apt-get install pdns-server pdns-recursor
@foonathan
foonathan / visitor.cpp
Last active April 5, 2021 01:10
My take on a modern implementation of the visitor pattern. - http://foonathan.net/blog/2017/12/21/visitors.html
//=== library ===//
#include <typeinfo>
#include <type_traits>
#include <utility>
enum class visit_event
{
container_begin,
container_end,
leaf,
@WesThorburn
WesThorburn / 1.Instructions.md
Last active March 14, 2024 22:11
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Checkout main: git checkout main
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
@mraleph
mraleph / ffi.md
Last active November 11, 2023 14:44

Dart VM FFI Vision

Background

The aim of Dart FFI project (tracked as Issue #34452) is to provide a low boilerplate, low ceremony & low overhead way of interoperating with native C/C++ code.

The motivation behind this project is twofold:

@kekru
kekru / traefik-redirect-path.md
Last active July 14, 2024 00:37
Traefik redirect / (root) to sub path with Docker labels

Traefik: redirect base or root path to a subpath

This is tested with Traefik 1.7

This is how to redirect the root or base path to a sub path in Traefik using Docker labels:
Goals

  • https://example.com -> https://example.com/abc/xyz/
  • https://example.com/ -> https://example.com/abc/xyz/
  • https://example.com/something -> no redirect
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active July 26, 2024 08:55
Building a react native app in WSL2
@SleepingPanda
SleepingPanda / gist:cc2f7fea37000f8eec2c5e92cf156d39
Created July 17, 2021 15:21
TrueNAS Jail Setup Guide for Komga!
# Create a pkg.json file containing everything your jail needs to install and run Komga.
echo '{"pkgs":["openjdk11-jre","nano","ca_root_nss","yarn"]}' > /tmp/pkg.json
# Using that file we just made, create the jail with IOCAGE. Replace <KOMGA> with the IP you want the Komga server to have on your network and <ROUTER> with the address of your network's router.
iocage create -n "komga" -p /tmp/pkg.json -r 12.2-RELEASE ip4_addr="vnet0|<KOMGA>/24" defaultrouter="<ROUTER>" vnet="on" allow_raw_sockets="1" boot="on"
# We can now safely delete that file we created earlier.
rm /tmp/pkg.json
# Make a config directory to store Komga, its config files, the database and logs.
@joaopgrassi
joaopgrassi / wsl2-network.ps1
Created August 24, 2021 08:56
WSL2 expose ports to windows host
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
echo $remoteport
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}