about summary refs log tree commit diff
path: root/fun
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-08-26T22·49+0100
committertazjin <mail@tazj.in>2020-08-26T23·49+0000
commit2bf806b21aa0c85e055f322c8e1c53d5053cd61c (patch)
tree80d2d22e2bf1d06882e13c1c83cb1c0df9bac621 /fun
parentbc5d4672aaa5e12fbe380fe141c559c965af07c8 (diff)
chore(tazjin/dt): Move project into user folder r/1715
... missed this when going multi-user.

Change-Id: If2c9f24555f82e944e3cebb45b2a13801cc1f35e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1844
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'fun')
-rw-r--r--fun/dt/CMakeLists.txt16
-rw-r--r--fun/dt/README.md11
-rw-r--r--fun/dt/default.nix14
-rw-r--r--fun/dt/dt.cc79
4 files changed, 0 insertions, 120 deletions
diff --git a/fun/dt/CMakeLists.txt b/fun/dt/CMakeLists.txt
deleted file mode 100644
index 85b659fea8..0000000000
--- a/fun/dt/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- mode: cmake; -*-
-cmake_minimum_required(VERSION 3.16)
-project(dt)
-add_executable(dt dt.cc)
-find_package(absl REQUIRED)
-
-target_link_libraries(dt
-  absl::flags
-  absl::flags_parse
-  absl::hash
-  absl::time
-  absl::strings
-  farmhash
-)
-
-install(TARGETS dt DESTINATION bin)
diff --git a/fun/dt/README.md b/fun/dt/README.md
deleted file mode 100644
index ee43d56064..0000000000
--- a/fun/dt/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-dt
-==
-
-It's got a purpose.
-
-## Usage:
-
-```
-nix-build -E '(import (builtins.fetchGit "https://git.tazj.in/") {}).fun.dt'
-./result/bin/dt --one ... --two ...
-```
diff --git a/fun/dt/default.nix b/fun/dt/default.nix
deleted file mode 100644
index b6efa28994..0000000000
--- a/fun/dt/default.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{ depot, pkgs, ... }:
-
-let
-  stdenv = with pkgs; overrideCC clangStdenv clang_10;
-  abseil_cpp = pkgs.abseil_cpp.override { inherit stdenv; };
-in stdenv.mkDerivation {
-  name = "dt";
-  src = ./.;
-  nativeBuildInputs = [ pkgs.cmake ];
-  buildInputs = with pkgs; [
-    abseil_cpp
-    farmhash
-  ];
-}
diff --git a/fun/dt/dt.cc b/fun/dt/dt.cc
deleted file mode 100644
index 5c4c3da768..0000000000
--- a/fun/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;
-}