View intrusive_queue.hh
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> |
View countable.hh
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> |
View intrusive_order.hh
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> |
View magic_mask.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
#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); | |
} |
View minkowski_question_mark.cc
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); |
View try.hh
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, ...) ({ \ |
View container_of.hh
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> |
View courier-pem.mk
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 |
View Makefile
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 |
View dblock-update.sh
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