Skip to content

Instantly share code, notes, and snippets.

View skaae's full-sized avatar

Søren Kaae Sønderby skaae

View GitHub Profile
@mbinna
mbinna / effective_modern_cmake.md
Last active May 6, 2024 17:19
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@drmalex07
drmalex07 / parse-with-xerces-1.cpp
Created March 17, 2017 18:56
An example parsing XML using Xerces library in C++. #c++ #xml #xerces
#include <iostream>
#include <iomanip>
// Compile with something like (Makefile excerpt):
// g++ -g -O0 -Wall -I/usr/local/xerces/include/ $(^) -L/usr/local/xerces/lib/ -lxerces-c
#include <fstream>
#include <sstream>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/dom/DOM.hpp>
@cseelye
cseelye / ssl.cpp
Last active January 8, 2024 19:42
Get SSL certificate info using openssl from C++
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>
#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/pem.h>
@ggrandes
ggrandes / openssl-smime.sh
Last active December 21, 2023 07:15
OpenSSL S/MIME 3.1 (CMS) - Encrypt/Signature - Verify/Decrypt
# Original Source:
# https://gist.github.com/ggrandes/a57c401f1bad6bd0ffd87a557b7b5790
# SIGN / VERIFY
openssl cms -sign -keyid -md sha256 -nodetach -binary -in /etc/passwd -signer user.crt -inkey user.key -out x.smime -outform SMIME
openssl cms -verify -CAfile ca.crt -in x.smime -inform SMIME
# ENCRYPT / DECRYPT
openssl cms -encrypt -keyid -aes-256-cbc -in /etc/passwd -binary -out x.smime -outform SMIME user.crt
openssl cms -decrypt -in x.smime -inform SMIME -recip user.crt -inkey user.key
@MartinMReed
MartinMReed / openssl_server.c
Last active December 29, 2022 17:19
OpenSSL Server, Reference Example
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <string>
#include <sys/socket.h>
#include <netinet/in.h>
#define IP_ADDR INADDR_ANY