Skip to content

Instantly share code, notes, and snippets.

View nitrix's full-sized avatar

Alex Belanger nitrix

View GitHub Profile
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 / gahello.php
Last active November 23, 2021 12:21
Hello World! Testing Genetic Algorithms in PHP
<?php
$POPULATION = array(); //population of individuals
$POPULATION_SIZE = 100;
$DNA_SIZE = 12;
$GEN_COUNT = 1;
$TEST_COUNT = 0;
genInitPopulation();
while (true) {
naturalSelection();
@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"
@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)
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 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;
};
@nitrix
nitrix / clang-format-bug.md
Created January 10, 2021 22:17
LLVM's clang-format nondeterministic bug
---
IndentCaseLabels: 'true'
IndentWidth: '4'

...
void foo(void) {