Skip to content

Instantly share code, notes, and snippets.

View nitrix's full-sized avatar

Alex Belanger nitrix

View GitHub Profile
{
// ================================================================== VSCode editor
"editor.formatOnSave": true,
"editor.fontSize": 16,
"editor.rulers": [
120
],
"editor.inlayHints.enabled": "off",
"editor.inlineSuggest.enabled": true,
"editor.guides.bracketPairs": "active",
@nitrix
nitrix / iwyu.md
Last active March 29, 2025 19:11
IWYU (Include What You Use)

Which pragma should I use?

  • Use IWYU pragma: keep to force IWYU to keep any #include directive that would be discarded under its normal policies.
  • Use IWYU pragma: always_keep to force IWYU to keep a header in all includers, whether they contribute any used symbols or not.
  • Use IWYU pragma: export to tell IWYU that one header serves as the provider for all symbols in another, included header (e.g. facade headers). Use IWYU pragma: begin_exports/end_exports for a whole group of included headers.
  • Use IWYU pragma: no_include to tell IWYU that the file in which the pragma
Setup:
1) Fresh new install of msys2-x86_64-20220503.exe.
2) Launch _specifically_ the "MSYS2 MinGW x64" terminal (not the one it suggests).
3) Run pacman -S mingw-w64-x86_64-{make,cmake,gcc,clang,gdb} and say yes at the prompt.
4) Add `C:\msys64\mingw64\bin` to windows's PATH.
*** If you intend to continue with the usage section, you have to restart the "MSYS2 MinGW x64" terminal
for your changes to the PATH environment variable to refresh.
@nitrix
nitrix / uncrustify.cfg
Last active April 11, 2022 21:14
Sharing the uncrustify configuration I often use to someone interested on IRC.
tok_split_gte=false
utf8_byte=false
utf8_force=false
indent_cmt_with_tabs=false
indent_align_string=false
indent_braces=false
indent_braces_no_func=false
indent_braces_no_class=false
indent_braces_no_struct=false
indent_brace_parent=false
-falign-functions -falign-jumps
-falign-labels -falign-loops
-fcaller-saves
-fcode-hoisting
-fcrossjumping
-fcse-follow-jumps -fcse-skip-blocks
-fdelete-null-pointer-checks
-fdevirtualize -fdevirtualize-speculatively
-fexpensive-optimizations
-ffinite-loops
@nitrix
nitrix / wsl-go-install.sh
Created November 15, 2021 14:55
Script to install Go 1.17 on Linux and WSL (Windows Subsystem for Linux)
#!/bin/bash
set -e
GVERSION="1.17"
GFILE="go$GVERSION.linux-amd64.tar.gz"
GOPATH="$HOME/projects/go"
GOROOT="/usr/local/go"
if [ -d $GOROOT ]; then
echo "Installation directories already exist $GOROOT"
main :-
natural(N),
N < 1000,
(multipleOf(3, N) ; multipleOf(5, N)),
converge(sum(N), Answer),
printLine(Answer).
------------------------- vs --------------------------
solution(N) :-
@nitrix
nitrix / main.go
Created January 27, 2021 23:36
Deleting registry keys recursively on windows.
package main
import (
"golang.org/x/sys/windows/registry"
"io"
"log"
)
func main() {
key, err := registry.OpenKey(registry.CURRENT_USER, "Test", registry.ALL_ACCESS)
@nitrix
nitrix / main.go
Created January 23, 2021 22:41
Shit code, months with more than 2 paydays
package main
import (
"fmt"
"github.com/jinzhu/now"
"log"
"os"
"strconv"
"time"
)
@nitrix
nitrix / defer.h
Created January 11, 2021 18:54
defer attempt
#ifndef DEFER_H
#define DEFER_H
struct guard_metadata {
int labels[32];
size_t label_count;
bool run_mode;
int at;
};