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
// All rights reserved, | |
// Derrick Pallas | |
// License: zlib | |
#ifndef INTRUSIVE_QUEUE_H | |
#define INTRUSIVE_QUEUE_H | |
#include <cassert> | |
#include <cstddef> |
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
// All rights reserved, | |
// Derrick Pallas | |
// License: zlib | |
#ifndef COUNTABLE_H | |
#define COUNTABLE_H | |
#include <cassert> | |
template <class T> |
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
// All rights reserved, | |
// Derrick Pallas | |
// License: zlib | |
#ifndef INTRUSIVE_ORDER_H | |
#define INTRUSIVE_ORDER_H | |
#include <cassert> | |
#include <cstddef> | |
#include <algorithm> |
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> | |
template <typename T> | |
inline T magic_mask(int_fast8_t n) { | |
T base = T(1)<<(int_fast16_t(1)<<n); | |
return (~T(0))/(base*base-1)*(base-1); | |
} |
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
// All rights reserved, | |
// Derrick Pallas | |
// License: zlib | |
#include <cmath> | |
#include <cstdlib> | |
template <typename fp_type> | |
fp_type minkowski_question_mark(const fp_type fp) { | |
float a0 = floor(fp); |
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
#ifndef TRY_H | |
#define TRY_H | |
#include <cstdio> | |
#include <cstring> | |
#include <stdexcept> | |
#include <errno.h> | |
#define TRY(f, ...) ({ \ |
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
// All rights reserved, | |
// Derrick Pallas | |
// License: zlib | |
#ifndef CONTAINER_OF | |
#define CONTAINER_OF | |
#include <cstddef> | |
template <class T, typename M> |
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
BASE?=/etc/letsencrypt | |
DOMAIN?=mx.example.com | |
DHBITS:=4096 | |
LIVE:=$(BASE)/live/$(DOMAIN) | |
PRIVKEY:=$(LIVE)/privkey.pem | |
FULLCHAIN:=$(LIVE)/fullchain.pem | |
.PHONY: default |
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
default: all | |
DEBUG ?= -g -ggdb -DDEBUG | |
ifeq ($(DEBUG),) | |
override DEBUG := -DNDEBUG | |
endif | |
override LDFLAGS += -lstdc++ | |
override CFLAGS += $(DEBUG) -MD -MP | |
override CXXFLAGS += $(DEBUG) -MD -MP |
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
#!/bin/bash | |
# Author: Derrick Pallas | |
# License: zlib | |
BASE='dblock-set' | |
TEMP=${BASE}$$ | |
ipset create -exist "$BASE" hash:ip --netmask 24 || exit 1 | |
iptables -nL INPUT | grep -q "$BASE" || | |
( | |
( iptables -N "$BASE" || iptables -F "$BASE" ) && |
OlderNewer