commit a94f4c8fd0221410a7ebab65222b8fdd1e2cc2a9
Author: William Casarin <jb55@jb55.com>
Date: Mon, 21 Jun 2021 12:43:20 -0700
bitcoin-contacts: initial commit
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/.envrc b/.envrc
@@ -0,0 +1 @@
+use nix
diff --git a/bitcoin-contacts.xsh b/bitcoin-contacts.xsh
@@ -0,0 +1,23 @@
+#!/usr/bin/env xonsh
+
+import sys
+
+$GIT_DIR = "/home/jb55/dev/github/bitcoin/bitcoin/.git"
+
+git fetch
+git log --no-merges --all --date=local --format=%H | head -n1000 | sort > fresh_hashes
+
+new_hashes = $(grep -Fxvf hashes fresh_hashes).split("\n")
+
+with open("contacts.tsv", "a") as contacts:
+ for hash in new_hashes:
+ emails = $(git-contacts @(hash)^-).split("\n")
+ emails = filter(lambda e: e != "", emails)
+ for email in emails:
+ line = "{}\t{}\n".format(hash, email)
+ contacts.write(line)
+ sys.stdout.write(line)
+
+cat fresh_hashes hashes | sort -u > new_hashes
+mv new_hashes hashes
+rm fresh_hashes
diff --git a/shell.nix b/shell.nix
@@ -0,0 +1,5 @@
+{ pkgs ? import <nixpkgs> {} }:
+with pkgs;
+mkShell {
+ buildInputs = with python3Packages; [ xonsh ];
+}