diff options
Diffstat (limited to '')
-rw-r--r-- | users/tazjin/covid/us_mortality.jq | 36 | ||||
-rw-r--r-- | users/tazjin/dt/CMakeLists.txt | 16 | ||||
-rw-r--r-- | users/tazjin/dt/README.md | 11 | ||||
-rw-r--r-- | users/tazjin/dt/default.nix | 13 | ||||
-rw-r--r-- | users/tazjin/dt/dt.cc | 79 | ||||
-rw-r--r-- | users/tazjin/nittredir/background.js | 10 | ||||
-rw-r--r-- | users/tazjin/nittredir/manifest.json | 15 |
7 files changed, 0 insertions, 180 deletions
diff --git a/users/tazjin/covid/us_mortality.jq b/users/tazjin/covid/us_mortality.jq deleted file mode 100644 index 584be3ef9afe..000000000000 --- a/users/tazjin/covid/us_mortality.jq +++ /dev/null @@ -1,36 +0,0 @@ -# This turns the CDC mortality data[0] into a format useful for my -# excess mortality spreadsheet. The US format is by far the worst one -# I have dealt with, as expected. -# -# This requires miller for transforming the CSV appropriately. -# -# Params: -# state: abbreviation of the state to extract ('US' for whole country) -# period: time period (either "2020" for current data, or anything else -# for historical averages) -# -# Call as: -# mlr --icsv --ojson cat weekly.csv | \ -# jq -rsf us_mortality.jq --arg state US --arg period 2020 -# -# [0]: https://www.cdc.gov/nchs/nvss/vsrr/covid19/excess_deaths.htm - -def filter_period(period): - if period == "2020" - then . | map(select(.["Time Period"] == 2020)) - else . | map(select(.["Time Period"] == "2015-2019")) - end; - -def collate_weeks(period): - (. | map(.["Number of Deaths"]) | add) as $count - | { - count: (if period == "2020" then $count else $count / 5 end), - week: .[0].Week, - }; - -. | map(select(.Type == "Predicted (weighted)")) - | map(select(.["State Abbreviation"] == $state)) - | filter_period($period) - | group_by(.Week) - | map(collate_weeks($period)) - | .[] | "week \(.week): \(.count)" diff --git a/users/tazjin/dt/CMakeLists.txt b/users/tazjin/dt/CMakeLists.txt deleted file mode 100644 index 85b659fea862..000000000000 --- a/users/tazjin/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/users/tazjin/dt/README.md b/users/tazjin/dt/README.md deleted file mode 100644 index ee43d5606409..000000000000 --- a/users/tazjin/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/users/tazjin/dt/default.nix b/users/tazjin/dt/default.nix deleted file mode 100644 index 8a728062db21..000000000000 --- a/users/tazjin/dt/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ depot, pkgs, ... }: - -let stdenv = with pkgs; overrideCC clangStdenv clang_11; -in stdenv.mkDerivation { - name = "dt"; - src = ./.; - nativeBuildInputs = [ pkgs.cmake ]; - buildInputs = with depot.third_party; [ - abseil_cpp - farmhash - ]; - meta.ci = false; -} 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; -} diff --git a/users/tazjin/nittredir/background.js b/users/tazjin/nittredir/background.js deleted file mode 100644 index 8d07f8528520..000000000000 --- a/users/tazjin/nittredir/background.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Register a URL change handler that redirects twitter.com links to nitter.net - */ - -chrome.webRequest.onBeforeRequest.addListener(function(details) { - let url = new URL(details.url); - return { - redirectUrl: ('https://nitter.net' + url.pathname) - }; -}, {urls: ['*://twitter.com/*'], types: ['main_frame']}, ['blocking']); diff --git a/users/tazjin/nittredir/manifest.json b/users/tazjin/nittredir/manifest.json deleted file mode 100644 index 4efe1a6cc245..000000000000 --- a/users/tazjin/nittredir/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "manifest_version": 2, - "name": "nittredir", - "version": "1.0", - "description": "Redirect twitter.com to nitter.net", - "background": { - "scripts": ["background.js"], - "persistent": true - }, - "permissions": [ - "webRequest", - "webRequestBlocking", - "*://twitter.com/*" - ] -} |