Skip to content

Instantly share code, notes, and snippets.

View AlexisTM's full-sized avatar
:shipit:

Alexis Paques AlexisTM

:shipit:
View GitHub Profile
@AlexisTM
AlexisTM / test.cpp
Created May 5, 2021 12:11
Print types of variables at runtime c++
#include <type_name.h>
#include <iostream>
class A {
public:
int a = 1;
int b = 2;
int c = 3;
};
@AlexisTM
AlexisTM / ++operator.cpp
Created February 17, 2022 10:01
++ Operator one liner
#include <iostream>
struct S {
int value = 0;
decltype(auto) operator++(auto... t) {
return ((*this = {value + 1}), ..., S{value - 1 + t});
}
};
@AlexisTM
AlexisTM / tristate.cpp
Last active July 15, 2022 13:15
C++ Tri-state enum method which is nice to use, but bad to write.
#include <stdint.h>
#include <stdio.h>
// The processes vision can be running
enum struct Process : uint16_t {
PROCESS_1,
PROCESS_2,
};
enum struct Function : uint16_t {
@AlexisTM
AlexisTM / update_alternative_clang.sh
Created December 22, 2022 12:40
update_alternative for clang-15
# based on https://gist.github.com/junkdog/70231d6953592cd6f27def59fe19e50d?permalink_comment_id=3780497
function register_clang_version {
local version=$1
local priority=$2
update-alternatives \
--verbose \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-${version} \
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-${version} \
@AlexisTM
AlexisTM / concat.cpp
Last active February 28, 2023 14:33
Variadic template string and string_view concat for C++17
#include <string>
// concat(a,b,c) is the equivalent to std::string(a) + std::string(b) + std::string(c)
template<class T>
std::string concat(T t) {
return std::string(t);
}
template<class T, class... Types>
std::string concat(T t, Types&&... others) {
@AlexisTM
AlexisTM / zerotier.md
Created May 13, 2023 08:41
Set zerotier network as private to allow local network access (Windows 10/11 Pro)

Workaround:

To check public/private setting

Get-NetConnectionProfile | Where-Object "InterfaceAlias" -like "Zero*"

To set all ZeroTier networks to Private

Get-NetConnectionProfile | Where-Object "InterfaceAlias" -like "Zero*" | Set-NetConnectionProfile -NetworkCategory Private
@AlexisTM
AlexisTM / .clangd
Created October 19, 2023 11:59
clangd config, note it has to use \t !
CompileFlags:
CompilationDatabase: /path_to_build_with_compile_database.json
@AlexisTM
AlexisTM / disable_middle_click_paste.txt
Last active August 5, 2024 07:52
Middle-click paste disable on Ubuntu
# Gnome, using gnome-tweaks
sudo apt install gnome-tweaks
gnome-tweaks
# Switch the option Middle Click Paste
# Firefox, within `about:config`, change the following configs
middlemouse.contentLoadURL false
middlemouse.paste false