This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <string> | |
| #include <list> | |
| #include <deque> | |
| #include <iterator> | |
| #include <algorithm> | |
| #include <numeric> | |
| #include <array> | |
| #include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <fstream> | |
| #include <chrono> | |
| #include <thread> | |
| #include <sstream> | |
| void tail(std::ifstream& f) | |
| { | |
| std::uint64_t lineCount = 0; | |
| auto sleepTime = std::chrono::seconds(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <variant> | |
| #include <string> | |
| #include <vector> | |
| #include <tuple> | |
| struct Error { | |
| std::string message; | |
| Error(std::string _message) : message(std::move(_message)) {} | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Consumer Throughput: Single consumer thread, no compression | |
| ## Consumer Throughput: 3 consumer thread, no compression | |
| bin/kafka-consumer-perf-test.sh --topic benchmark-3-3-none \ | |
| --zookeeper kafka-zk-1:2181,kafka-zk-2:2181,kafka-zk-3:2181 \ | |
| --messages 15000000 \ | |
| --threads 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # File: kafka-move-leadership.sh | |
| # | |
| # Description | |
| # =========== | |
| # | |
| # Generates a Kafka partition reassignment JSON snippet to STDOUT to move the leadership | |
| # of any replicas away from the provided "source" broker to different, randomly selected | |
| # "target" brokers. Run this script with `-h` to show detailed usage instructions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <typename Byte, | |
| typename Data> constexpr inline auto | |
| append_bytes(Byte* destination, const Data& data) { | |
| static_assert(sizeof(Byte) == 1, "Byte must be exactly 8 bits"); | |
| const auto& data_ptr = &data; | |
| memcpy(destination, data_ptr, sizeof(data)); | |
| } | |
| template <typename Byte, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // C++ move semantics, from Nicole Josuttis's CppCon 2017 talk “The Nightmare | |
| // of Move Semantics for Trivial Classes” | |
| #include <iostream> | |
| #include <string> | |
| #include <type_traits> | |
| class Customer { | |
| public: | |
| template <typename TString1, typename TString2 = std::string, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <typename T, typename U, typename V> | |
| void pseudo_scheduled_task(T&& action, U&& time, V&& await_time) { | |
| using us_time_type = typename std::decay<decltype(time())>::type; | |
| static_assert(std::is_unsigned<us_time_type>::value, "system time must be given as unsigned integral value"); | |
| static_assert(std::is_unsigned<decltype(await_time)>::value, "must await a positive integral time interval"); | |
| static us_time_type last_time = 0; | |
| const auto& now = std::forward<U>(time)(); | |
| const auto& delta = now - last_time; // defined by ISO C++ | |
| last_time = now; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| regex="([0-9]{2})/([0-9]{2})/([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})" | |
| for file in ./*; do | |
| creation_date="$(GetFileInfo -d "${file}")" | |
| if [[ "${creation_date}" =~ $regex ]]; then | |
| m="${BASH_REMATCH[1]}" | |
| d="${BASH_REMATCH[2]}" | |
| Y="${BASH_REMATCH[3]}" | |
| H="${BASH_REMATCH[4]}" | |
| M="${BASH_REMATCH[5]}" | |
| S="${BASH_REMATCH[6]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Base.h" | |
| Base::Base() : | |
| IsRegistered_(false) | |
| { } | |
| Base::Base(bool isRegistered) : | |
| IsRegistered_(isRegistered) | |
| { } |
NewerOlder