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
# On my system, I don't have root access. So here's how I built it | |
# as a non-root user, without `sudo` or the ability to | |
# install packages, although many packages were already installed. | |
# | |
# In particular, I had to download and build LibVNCServer, | |
# and configure x11vnc to use it the one I had built | |
mkdir -p ~/bin/x11vnc | |
cd ~/bin/x11vnc |
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
// From https://gist.github.com/CAMOBAP795/ed9aa6a7549787b5eea4b2048b896747 | |
// with some changes | |
// | |
// Originally discovered here: https://github.com/conan-io/docs/issues/1259 | |
import groovy.text.SimpleTemplateEngine | |
import java.nio.file.Paths | |
class ConanPluginExtension { | |
String conanfile = "src/main/cpp/conanfile.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
#include <string> | |
#include <cstring> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <openssl/bio.h> | |
//#include <openssl/bytestring.h> | |
#include <openssl/crypto.h> |
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
/* | |
* By adding a converting constructor to `person` (that converts from `thingy` to `person`) | |
* we can allow the std::back_inserter to work when copying from vector<thingy> to vector<person> | |
* | |
* This allows a one-liner that calls `push_back` over and over. | |
* | |
* Note: The repeated calls to `push_back` might have a performance cost. | |
* The alternative is to do it in two lines: | |
* | |
* people.reserve(N); |
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
/* | |
* Goal: To have a class template that can recieve a template parameter of a class that either | |
has a member (e.g. _time) or doesn't have a member. | |
The class template has a function (e.g. get_time) which should return the value (e.g. _time), | |
or a default value (e.g. 22) | |
So far, I've got a class template 'getter_maker_t' that depending on its arguments can | |
will either create a class that returns the value, or returns a class that returns the default value. |
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
#include <numeric> | |
#include <iterator> | |
int vals[5] = {1, 2, 3, 4, 5}; | |
int main() | |
{ | |
// Force the array into a const (just because I don't want to iterate on modifiable cells | |
auto const & b = vals; | |
int sum = std::accumulate(std::begin(b), std::end(b), 0); |
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
// Forward declaration, so that helper knows about constexpr_find_in_int_parameter_pack | |
template <int V1, int... V_rest> struct constexpr_find_in_int_parameter_pack; | |
// Don't read this first, read the constexpr_find_in_int_parameter_pack first. | |
// | |
// Back? Good. This class *purely* to allow specializing the empty case using helper<>. | |
// | |
// The helper class allows us to separate the unpacking of the parameter pack (that is handled by | |
// constexpr_find_in_int_parameter_pack) from the stop condition (that is handled by the helper class). I | |
// couldn't figure out how to do both without in a single class. |
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
// The flat_fix_parser I designed is good: | |
// Pro: | |
// * compile-time checking of fields | |
// * compact in memory, so less cache-thrashing | |
// Con: | |
// * doesn't support multiple copies of the same tag | |
// * fixed size in memory means there's no ability to handle unlimited number of tags | |
// | |
// To fix this, I want a more extensible design. Convert the FIX message into its hierarcy. | |
// For example, a V message that only has a repeating group of 269s within a 267: |
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
#include <stdint.h> | |
/* | |
Problem Space: | |
-------------- | |
FIXT1.1 is a protocol where FIX data is sent in fields separated by a 0x01. | |
In each field, the format is "tag=value", where "tag" is a number | |
from 1 upwards. |
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
#include <cstdint> | |
#include <chrono> | |
#include <iostream> | |
/* The following two functions are from a talk by Chandler Carruth: | |
* | |
* CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!" | |
* | |
* [https://www.youtube.com/watch?v=nXaxk27zwlk] | |
*/ |