Skip to content

Instantly share code, notes, and snippets.

View DBJDBJ's full-sized avatar
😬
Can't stop coding

dbj DBJDBJ

😬
Can't stop coding
View GitHub Profile
@DBJDBJ
DBJDBJ / coroutine-simple.cpp
Last active September 6, 2018 13:32 — forked from yizhang82/coroutine-simple.cpp
Simple C++ coroutine example
/*
until C++20 to build this with CL (MSVC)
/await compiler switch is required
*/
#include <future>
#include <iostream>
#ifndef __cpp_coroutines
@DBJDBJ
DBJDBJ / dbj_string_trim.cpp
Last active September 22, 2018 04:21
fast string trim with C++17 usage
/*
Copyright 2018 by [email protected]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http ://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
// 2019=05-13 [email protected]
//
// clang++ prog.cc -Wall -Wextra -std=c++17
//
#include <iostream>
#include <string_view>
#include <type_traits>
using namespace std;
using namespace std::string_view_literals ;
@DBJDBJ
DBJDBJ / fmt_format_to_vs_buffers_used.cpp
Created November 6, 2019 15:31
testing {fmt} fmt::format_to() vs the buffer used
/*
(c) 2019/2020 by [email protected], LICENCE CC BY SA 4.0
Compiled using Visual Studio 2019 with CLANG 8.0.1
Machine Win10 PRO, CPU i5, 8 GB RAM
-----------------------------------------------------------
Typical Results:
-----------------------------------------------------------
@DBJDBJ
DBJDBJ / dbj_meta_converter.h
Last active April 4, 2020 11:45
nicely and quickly transform any std range made of std chars into std string of your choice -- only ASCII part that is
#ifndef _DBJ_META_CONVERTER_INC_
#define _DBJ_META_CONVERTER_INC_
/*
(c) 2019/202 by [email protected]
LICENCE -- CC BY SA 4.0 -- https://creativecommons.org/licenses/by-sa/4.0/
This tool transforms any kind of char range into any required string kind.
By kind we mean "made of particular char type"
See the comprehensive testing in a separate header also here.
NOTE: be forewarned: in C++20 char8_t is actually crippled.
@DBJDBJ
DBJDBJ / lambda_powered matrix.h
Last active March 14, 2020 16:26
C++ lambda powered matrix
#pragma once
// (c) 2019-2020 by [email protected]
// License: CC BY SA 4.0
#include <iomanip> // setw
#include <sstream>
#include <array>
#include <cassert>
#include <string>
#include <vector>
@DBJDBJ
DBJDBJ / clean_all_the_linked_in_connections.md
Last active December 16, 2022 18:16
Clean All Your Linked IN Connections With A Script

Very big Warning:

If you do not know (or have a faintest clue) what is "Chrome Dev Console" please do not attempt deleting your LinkedIN connections using the script presented here.

Please consider purchasing a very powerfull but user friendly LINKED IN HELPER.

Or find a friend who can understand this text. Or just give up until you do. If not sure what are you doing here, please do not try on your own, anything described. Just leave.

Script to delete ALL connections on your LinkedIN account

@DBJDBJ
DBJDBJ / line_noise_convert_utf.h
Created April 9, 2020 21:19
unicode conversions
#pragma once
#ifndef LINENOISE_CONVERT_INC
#define LINENOISE_CONVERT_INC
/*
Copyright 2020 [email protected] -- turned into single header C lib
inevitably some name clashes will
start becuase of this header.
Thus renaming is very likely not finished
Licence: CC BY SA 4.0
@DBJDBJ
DBJDBJ / dbj_type_reductor.h
Last active March 22, 2024 18:52
c++ Type confusion stopper. A.k.a -- Reduce compound type to base type
// (c) 2019/2020 by [email protected]
// CC BY SA 4.0
//
// https://wandbox.org/permlink/h8BE47pvLlBMy7wy
// clang++ prog.cc -std=c++14
// OK for C++14, C++17, C++2a
//
// https://dbj.org/c-reduce-compound-to-base-type/
//
#include <iostream>
@DBJDBJ
DBJDBJ / compare_win_allocations.cpp
Last active August 12, 2020 05:44
yet another allocation deallocation comparing? yes but this time clang shows insane fast time for plain malloc/free ... probaly correctly optimized code?
// https://docs.microsoft.com/en-us/cpp/parallel/concrt/how-to-use-alloc-and-free-to-improve-memory-performance?view=vs-2019
// allocators.cpp
// compile with: /EHsc
#include <windows.h>
#include <ppl.h>
#include <crtdbg.h>
#include <iostream>
#include <vector>
#include "dbj_alloc.h"