Skip to content

Instantly share code, notes, and snippets.

View tomlankhorst's full-sized avatar
🌊

Tom Lankhorst tomlankhorst

🌊
View GitHub Profile
@tomlankhorst
tomlankhorst / libpqxx_boost_uuid.hpp
Last active April 19, 2021 09:16
Basic support for `boost::uuids::uuid` in `libpqxx` 7.4
#pragma once
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
/**
* This snippet implements basic string conversion support for `boost::uuids::uuid`
* in libpqxx.
*
@tomlankhorst
tomlankhorst / mqtt-demo.cpp
Created May 11, 2021 14:59
MQTT mosquitto demo (with fmt/7.1.3 mosquitto/2.0.10)
#include <iostream>
#include <csignal>
#include <thread>
#include <chrono>
#include <string_view>
#include <fmt/core.h>
#include <fmt/color.h>
#include <mosquitto.h>
#include <openssl/ssl.h>
@tomlankhorst
tomlankhorst / rebind-usb.sh
Created October 31, 2020 09:24
Re-bind XHCI driver to make USB devices responsive again after a wakeup. https://tomlankhorst.nl/unresponsive-usb-unbind-bind-linux
#!/bin/bash
# See https://tomlankhorst.nl/unresponsive-usb-unbind-bind-linux
DEV=${1:-0000:06:00.3}
echo $DEV | sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind
sleep 1
echo $DEV | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind
@tomlankhorst
tomlankhorst / nginx.conf
Last active May 29, 2022 02:47
Containerised NGINX config for HTTPS with HTTP/2 with Let's Encrypt certificates. https://tomlankhorst.nl/secure-nginx-docker-container-with-lets-encrypt/
# Used on nginx/1.15.5
# https://tomlankhorst.nl/secure-nginx-docker-container-with-lets-encrypt/
#
# see: https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.15.5a&openssl=1.0.1e&hsts=yes&profile=modern
# Oldest compatible clients: Firefox 27, Chrome 30, IE 11 on Windows 7, Edge, Opera 17, Safari 9, Android 5.0, and Java 8
server {
listen 80 default_server;
root /application/public/;
@tomlankhorst
tomlankhorst / docker-swarm-gpu.md
Last active May 6, 2024 20:59
Instructions for Docker swarm with GPUs