Skip to content

Instantly share code, notes, and snippets.

View Leandros's full-sized avatar
🦀
Available for Rust contracting

Arvid Gerstmann Leandros

🦀
Available for Rust contracting
View GitHub Profile
/*
* Compile with re2c:
* $ re2c main.cpp -o main.re2c.cpp --nested-ifs --bit-vectors --utf-8 --no-debug-info
* $ g++ -std=c++17 -O3 -o test_re2c main.re2c.cpp
*/
#include <iostream>
#include <fstream>
bool
@Leandros
Leandros / Makefile
Last active January 8, 2022 23:18
Minimal C++ Makefile
CC = clang++
CXX = clang++
DEBUG = -ggdb -O1 -march=native
RELEASE = -O2
CPPFLAGS := -I.
CXXFLAGS := $(DEBUG) -W -Wall -Wextra -std=c++17
LDLIBS := -lm
OUTPUT_OPTION = -MMD -MP -o $@ -MJ $@.json
# Modify your C++ filesuffix here:
@Leandros
Leandros / compresspdf.sh
Created April 2, 2019 08:55
Compress PDF (requires ghostscript)
#!/bin/bash
readonly input="$1"
readonly output="$2"
readonly preset="$3"
if [ "$input" = "" ] || [ "$output" = "" ] || [ "$preset" = "" ]; then
echo "usage: $0 [input file] [output file] [screen|ebook|printer|prepress]"
exit 1
fi
#!/bin/bash
#
# UPTIME MONITORING
# v1.0.0
#
### INSTALLATION
#
# 1. Install dependencies
#
# `apt-get install mailx curl openssl`
@Leandros
Leandros / defer.h
Created December 17, 2025 07:54
Defer in C for GCC and CLANG
/*
* MIT License
*
* Copyright (c) 2025 Arvid Gerstmann
*
* 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