Skip to content

Instantly share code, notes, and snippets.

@rioki
rioki / StateMachine.h
Created April 6, 2024 15:58
State Machine
// State Machine
// Copyright 2022 Sean Farrell <sean.farrell@rioki.org>
//
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What The Fuck You Want
// To Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
#pragma once
@rioki
rioki / CrashWatchdog.cpp
Created April 4, 2023 07:48
CrashWatchdog
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What The Fuck You Want
// To Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
#include "CrashWatchdog.h"
#include <stdexcept>
#include <array>
name: Auto approve
on:
issue_comment:
types:
- created
jobs:
auto-approve:
runs-on: ubuntu-latest
@rioki
rioki / opt-gtest.h
Created June 6, 2022 18:08
Better Google Test Support for std::optional.
// std gtest comparators
// Copyright 2022 Sean Farrell <sean.farrell@rioki.org>
//
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What The Fuck You Want
// To Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
#pragma once
@rioki
rioki / one_of.h
Created April 26, 2022 07:39
one_of: a small piece of code that removes switch on enum statements.
template <typename EnumT> constexpr
bool one_of(EnumT value, const std::initializer_list<EnumT>& checkValues)
{
for (const auto& cv : checkValues)
{
if (value == cv)
{
return true;
}
}
@rioki
rioki / iterator_wrapper.h
Created April 25, 2022 13:24
Iterator wrapper that allows to use two iterators in range based for loop.
template <typename T>
struct iterator_wrapper
{
iterator_wrapper(T&& begin, T&& end) noexcept
: m_begin{std::forward<T>(begin)}, m_end{std::forward<T>(end)} {}
const T& begin() const noexcept
{
return m_begin;
}

Supergenpass Command Line Interface

This is short CLI to run supergenpass, for when the website is down.

License

This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want

To Public License, Version 2, as published by Sam Hocevar. See

// PID Controller
// Copyright 2017 Sean Farrell <sean.farrell@rioki.org>
//
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What The Fuck You Want
// To Public License, Version 2, as published by Sam Hocevar.
// See http://www.wtfpl.net/ for more details.
#include "PidController.h"
// Copyright 2019 Sean Farrell <sean.farrell@rioki.org>
// This work is free. You can redistribute it and/or modify it under the
// terms of the Do What The Fuck You Want To Public License, Version 2,
// as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
#ifndef _ROUND_ROBIN_H_
#define _ROUND_ROBIN_H_
#include <array>
#include <stdio.h>
#include "test.h"
int register_parse_tests();
int main(int argc, char*argv[])
{
int r = 0;
r = register_parse_tests();