diff options
author | Vincent Ambo <mail@tazj.in> | 2022-01-17T14·18+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-01-17T14·25+0000 |
commit | 3ecb412055532bfea0c7badaa137ddf75e563392 (patch) | |
tree | 4786d5f70d6e291db4c3d7b8c322b7978b0b4b6f /users/tazjin/dt/dt.cc | |
parent | 1c81ccb99634d107eb7f9b986bc4822c7a517d13 (diff) |
chore(tazjin/*): Remove some dead code r/3620
Change-Id: Ic938bc9ae446620f132d912e4787f4b42ffd9341 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4983 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/dt/dt.cc')
-rw-r--r-- | users/tazjin/dt/dt.cc | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/users/tazjin/dt/dt.cc b/users/tazjin/dt/dt.cc deleted file mode 100644 index 5c4c3da76853..000000000000 --- a/users/tazjin/dt/dt.cc +++ /dev/null @@ -1,79 +0,0 @@ -#include <iostream> -#include <vector> - -#include "absl/flags/flag.h" -#include "absl/flags/parse.h" -#include "absl/hash/hash.h" -#include "absl/strings/str_cat.h" -#include "absl/time/clock.h" -#include "absl/time/time.h" -#include "absl/types/optional.h" -#include "farmhash.h" - -ABSL_FLAG(std::vector<std::string>, words, {}, "words to use"); - -struct Result { - std::string a; - int ec; - absl::optional<std::string> p; -}; - -std::string which(const std::vector<std::string>& words) { - uint64_t fp; - std::string word; - - for (const auto& w : words) { - auto nfp = util::Fingerprint64(w); - if (nfp > fp) { - fp = nfp; - word = w; - } - } - - return word; -} - -Result decide(const std::vector<std::string>& words) { - auto input = absl::FormatTime("%Y%m%d", absl::Now(), absl::UTCTimeZone()); - for (const auto& w : words) { - input += w; - } - - auto base = util::Fingerprint64(input); - Result result = { "nope" }; - - if (base % 10 == 0) { - result.a = "ca"; - } else if (base % 8 == 0) { - result.a = "c1"; - result.p = which(words); - } else if (base % 6 == 0) { - result.a = "skip"; - } else if (base % 3 == 0) { - result.a = "e1"; - result.ec = base % 10; - result.p = which(words); - } else if (base % 2 == 0) { - result.a = "ea"; - result.ec = base % 10; - } - - return result; -} - -int main(int argc, char *argv[]) { - absl::ParseCommandLine(argc, argv); - - auto words = absl::GetFlag(FLAGS_words); - if (words.size() < 2) { - std::cerr << "needs at least two!" << std::endl; - return 1; - } - - auto result = decide(words); - std::cout << result.a - << (result.p.has_value() ? absl::StrCat(" ", "(", result.p.value(), ")") - : "") - << (result.ec > 0 ? absl::StrCat(": ", result.ec) : "") - << std::endl; -} |