O(1) Fast.com

I will highlight my projects here.


A high level library to let me do asynchronous c++ programming like that done in Node.js.

#include <cstdlib>

#include "base_work_queue.h"
#include "lib_http_request.h"
#include "lib_http_site.h"
#include "lib_http_static_service.h"

int main( int argc, char const **argv ) {
  using namespace daw::nodepp;
  using namespace daw::nodepp::lib::net;
  using namespace daw::nodepp::lib::http;

  auto site = create_http_site( );
  site->on_listening( []( EndPoint endpoint ) {
        std::cout << "Node++ Static HTTP Server\n";
        std::cout << "Listening on " << endpoint << '\n';
      } )
      .on_error( []( base::Error error ) {
        std::cerr << "Error: ";
        std::cerr << error << '\n';
      } )
      .listen_on( 8080 );

  auto service = create_static_service( "/", "./web_files" );
  service->connect( site );

  base::start_service( base::StartServiceMode::OnePerCore );
  return EXIT_SUCCESS;

As you can see, one can create a static web server quickly and succinctly. Currently, the library focus is on networking and HTTP networking. Other async tasks will be added, such as Sqlite support as I need them

Github | Example Above


A JSON parser/encoder that allows one to easily serialize to or from JSON text.

#include <cstdlib>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

#include <daw/json/daw_json_link.h>
#include <daw/json/daw_json_link_file.h>

struct config_t : public daw::json::daw_json_link<config_t> {
  uint16_t port;
  std::string url_path;
  std::string file_system_path;
  std::vector<std::string> default_files;

  config_t( ) : port{8080}, url_path{"/"}, file_system_path{"./web_files"}, default_files{} {}

  static void json_link_map( ) {
    link_json_integer( "port", port );
    link_json_string( "url_path", url_path );
    link_json_string( "file_system_path", file_system_path );
    link_json_string_array( "default_files", default_files );

}; // config_t

int main( int argc, char const **argv ) {
  config_t config;
  if( argc > 1 ) {
    try {
      config = daw::json::from_file<config_t>( argv[1] );
    } catch( std::exception const & ) {
      std::cerr << "Error parsing config file" << std::endl;
      exit( EXIT_FAILURE );
  std::cout << "Current config\n\n" << config.to_json_string( ) << '\n';

  return EXIT_SUCCESS;

Github | Example Above

Header Libraries

Additions to the standard template libraries to codify common operations


Parse CSV Data

Quickly import csv data into code. Using the parse_csv_data function exposed in data_table.h I can get an array of rows of variants(Integral, Real, Timestamps, Strings)


Grayscale Filter

A novel approach to creating grayscale images with some recolouring. It uses a binned histogram to compress the colour space to 8bit grayscale maintining more information in the areas of high variability. As you can see it often generates a picture that has more contrast and depth than the standard method that uses up the available colour space whether the value is used or not.