Skip to content

Instantly share code, notes, and snippets.

Avatar
😁
happy coding!

angelos plastropoulos plusangel

😁
happy coding!
View GitHub Profile
@plusangel
plusangel / CMakeLists.txt
Created Oct 31, 2020
CMake dependent options
View CMakeLists.txt
project(cmake_recipe01 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
# set(USE_LIBRARY OFF)
option(USE_LIBRARY "Compile sources into a library" OFF)
message(STATUS "Compile sources into a library? ${USE_LIBRARY}")
include(CMakeDependentOption)
cmake_dependent_option(
@plusangel
plusangel / CMakeLists.txt
Created Oct 31, 2020
CMake using conditionals
View CMakeLists.txt
cmake_minimum_required(VERSION 3.17)
project(cmake_recipe01 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(USE_LIBRARY ON)
message(STATUS "Compile sources into library? ${USE_LIBRARY}")
set(BUILD_SHARED_LIBS OFF)
list(APPEND _sources Message.h Message.cpp)
@plusangel
plusangel / notes.txt
Last active Oct 3, 2020
Byobu: basic shortcuts
View notes.txt
byobu new -s embedded-cookbook
byobu list-sessions
byobu attach-session -t embedded-cookbook
byobu kill-session -t embedded-cookbook
F6 will detach your current Byobu session
F2 creates new windows within the current session.
F3 and F4 scroll left and right through the windows list.
F8 renames the current open window in the list
@plusangel
plusangel / CMakeLists.txt
Created Jun 13, 2020
Extensible factory template
View CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(factory_methods)
set(CMAKE_CXX_STANDARD 17)
add_library(shape_factory shape_factory.cpp)
add_executable(factory_method main.cpp)
target_link_libraries(factory_method shape_factory)
@plusangel
plusangel / CMakeLists.txt
Created Jun 6, 2020
Simple factory pattern example
View CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(factory_methods)
set(CMAKE_CXX_STANDARD 17)
add_library(shape_factory shape_factory.cpp)
add_executable(factory_method main.cpp)
target_link_libraries(factory_method shape_factory)
@plusangel
plusangel / CMakeLists.txt
Last active Jun 5, 2020
Monostate idiom example in C++
View CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(monostate_idiom)
set(CMAKE_CXX_STANDARD 17)
add_library(monostate monostate.cpp)
add_executable(monostate_idiom main.cpp)
target_link_libraries(monostate_idiom monostate)
@plusangel
plusangel / CMakeLists.txt
Last active Jun 5, 2020
Singleton idiom example in C++
View CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(singleton_idiom)
set(CMAKE_CXX_STANDARD 17)
add_library(singleton singleton.cpp)
add_executable(singleton_idiom main.cpp)
target_link_libraries(singleton_idiom singleton)
@plusangel
plusangel / CMakeLists.txt
Created Jun 2, 2020
This is an example of the pimpl idiom using smart pointers.
View CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(pimpl_idiom)
set(CMAKE_CXX_STANDARD 17)
add_library(timer timer.cpp)
add_executable(pimpl_idiom main.cpp)
target_link_libraries(pimpl_idiom timer)
View TellmyAboutBdays.cpp
//
// Tell me about your birthday!
// Created by angelos on 03/05/2020.
//
#include <ctime>
#include <iostream>
#include <string_view>
int validate_input(int lower_limit, int upper_limit, std::string_view prompt);
void year(tm &birthday);
@plusangel
plusangel / simple_calc.cpp
Created Mar 1, 2020
String handling using Boost's tokenizer
View simple_calc.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <boost/tokenizer.hpp>
#include <iostream>
using namespace std::literals::string_literals;
int basic_calc(const std::string &input) {
boost::char_separator<char> operators{"+-*/"};
You can’t perform that action at this time.