Skip to content

Instantly share code, notes, and snippets.

View nicklasfrahm's full-sized avatar

Nicklas Frahm nicklasfrahm

View GitHub Profile
@nicklasfrahm
nicklasfrahm / .clang-format
Last active October 4, 2024 12:32
Opinionated .clang-format for JS boys coming from prettier and stumbling into C++
AccessModifierOffset: 2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
@nicklasfrahm
nicklasfrahm / settings.json
Created February 9, 2018 23:02
Linux subsystem in integrated VS Code terminal
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
}
@nicklasfrahm
nicklasfrahm / main.cpp
Created February 9, 2018 23:06
A C++ test application
#include <iostream>
using namespace std;
int main(void)
{
cout << "g++ on Windows rocks" << endl;
return 0;
}
@nicklasfrahm
nicklasfrahm / subsystem-uninstall.cmd
Last active February 9, 2018 23:11
Uninstall Linux subsystem
lxrun /uninstall /full
@nicklasfrahm
nicklasfrahm / subsystems-enable.ps1
Last active February 9, 2018 23:11
Enable subsystems
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
@nicklasfrahm
nicklasfrahm / test-output.sh
Last active February 9, 2018 23:47
Output of g++ test
g++ main.cpp -o primer.exe
./primer.exe
# prints: g++ on Windows rocks
@nicklasfrahm
nicklasfrahm / g++-installation.sh
Created February 9, 2018 23:19
Install g++ and update Linux
sudo apt update && sudo apt upgrade
sudo apt install -y g++
@nicklasfrahm
nicklasfrahm / docker-kube-install.sh
Last active May 22, 2018 22:43
Install docker and kubernetes toolchain
#!/usr/bin/env bash
# check if script is run via sudo
if [ "$EUID" -ne 0 ]
then echo "This script must be run via sudo."
exit
fi
echo ""
echo ">> Updating package list ..."
sudo apt install mingw-w64
x86_64-w64-mingw32-g++ main.cpp -o primer.exe --static
./primer.exe
# prints only on Windows: g++ on Windows rocks
@nicklasfrahm
nicklasfrahm / dc_motor_velocity_model.c
Created February 27, 2019 11:02
A velocity model for a simple DC motor
#include <stdio.h>
#define ITERATIONS 10
typedef struct
{
double a;
double b;
} motor_props_t;