Skip to content

Instantly share code, notes, and snippets.

View gmbeard's full-sized avatar

Greg Beard gmbeard

  • Rochdale, UK
  • 07:02 (UTC +01:00)
View GitHub Profile
@gmbeard
gmbeard / ctrl-z.cpp
Created September 20, 2018 19:50
Ctrl-Z Examples...
// Copyright 2018 G. M. Beard
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@gmbeard
gmbeard / pool.cpp
Last active December 6, 2018 22:05
Fixed-size pool allocator
#include <iostream>
#include <memory>
#include <atomic>
#include <cassert>
struct Node {
uint8_t* const data;
size_t const length;
Node* next;
};
@gmbeard
gmbeard / factory.cpp
Created February 8, 2019 23:38
Variant return type
#include <variant>
#include <iostream>
#include <string>
struct A { };
struct B { };
struct C { };
using Object = std::variant<A, B, C>;
@gmbeard
gmbeard / xbps-src-force-python3-repover.patch
Created December 17, 2024 21:29
Allows modification of how `./xbps-src` resolves the versions of dependencies
This change allows you to you to modify how `./xbps-src` resolves the
versions of dependencies.
For all packages listed in `etc/repover`, xbps-src will use the binary
repository version when resolved as a depdencency, even if the srcpkg
version is greater. The pkgs must be listed one per line, and without the
version number.
**NOTE**: The use-case for this is pretty niche. You probably don't
want to do this. The author's use-case for this was that they wanted to