Skip to content

Instantly share code, notes, and snippets.

View TheLastBilly's full-sized avatar
🏠
Working from home

A Billy TheLastBilly

🏠
Working from home
View GitHub Profile
@TheLastBilly
TheLastBilly / exceptions.hpp
Last active July 1, 2021 17:34
mini custom exceptions macro library
#pragma once
#include <cstring>
#include <iostream>
#include <exception>
// Uiltities
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
@TheLastBilly
TheLastBilly / thread_controller.hpp
Created June 30, 2021 18:21
A simple thread controlling class that stops, starts, and pauses threads
#pragma once
#include <thread>
#include <mutex>
#include <atomic>
#include <condition_variable>
// Will handle the looped excecution of a function (cycle). Add this class
// to the group of parent classes to the class you'd like to use it on and
// implement the virtual void cycle() function with your loop data. Then
// clicker.c
// Count the times each key has been pressed
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
// Yeah, I'm lazy, get over it
#define roe(_expr) if((ret = (_expr)) < 0) return ret
// Make sure we read stdin one key at the time