diff options
-rw-r--r-- | default.nix | 1 | ||||
-rw-r--r-- | gopkgs/utils/utils.go | 5 | ||||
-rw-r--r-- | scratch/README.md | 6 | ||||
-rw-r--r-- | scratch/crack_the_coding_interview/11_1.py (renamed from crack_the_coding_interview/11_1.py) | 0 | ||||
-rw-r--r-- | scratch/crack_the_coding_interview/to_tree.hs (renamed from crack_the_coding_interview/to_tree.hs) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/array-traversals.py (renamed from data_structures_and_algorithms/array-traversals.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/balanced-binary-tree.py (renamed from data_structures_and_algorithms/balanced-binary-tree.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/bit-manipulation.py (renamed from data_structures_and_algorithms/bit-manipulation.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/bracket-validator.py (renamed from data_structures_and_algorithms/bracket-validator.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/bst-checker.py (renamed from data_structures_and_algorithms/bst-checker.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/cafe-order-checker.py (renamed from data_structures_and_algorithms/cafe-order-checker.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/cake-thief.py (renamed from data_structures_and_algorithms/cake-thief.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/coins.py (renamed from data_structures_and_algorithms/coins.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/conways-game-of-life.py (renamed from data_structures_and_algorithms/conways-game-of-life.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/delete-node.py (renamed from data_structures_and_algorithms/delete-node.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/dft.py (renamed from data_structures_and_algorithms/dft.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/dijkstra-shortest-path.py (renamed from data_structures_and_algorithms/dijkstra-shortest-path.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/find-duplicate-optimize-for-space-beast.py (renamed from data_structures_and_algorithms/find-duplicate-optimize-for-space-beast.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/find-duplicate-optimize-for-space.py (renamed from data_structures_and_algorithms/find-duplicate-optimize-for-space.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/find-rotation-point.py (renamed from data_structures_and_algorithms/find-rotation-point.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/find-unique-int-among-duplicates.py (renamed from data_structures_and_algorithms/find-unique-int-among-duplicates.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/fixtures.py (renamed from data_structures_and_algorithms/fixtures.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/graph-coloring.py (renamed from data_structures_and_algorithms/graph-coloring.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/graph-to-graphviz.py (renamed from data_structures_and_algorithms/graph-to-graphviz.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/highest-product-of-3.py (renamed from data_structures_and_algorithms/highest-product-of-3.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/inflight-entertainment.py (renamed from data_structures_and_algorithms/inflight-entertainment.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/knapsack-0-1.py (renamed from data_structures_and_algorithms/knapsack-0-1.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/kth-to-last.py (renamed from data_structures_and_algorithms/kth-to-last.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/largest-stack.py (renamed from data_structures_and_algorithms/largest-stack.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/linked-list-cycles.py (renamed from data_structures_and_algorithms/linked-list-cycles.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/merge-sort.py (renamed from data_structures_and_algorithms/merge-sort.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/merging-ranges.py (renamed from data_structures_and_algorithms/merging-ranges.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/mesh-message.gv (renamed from data_structures_and_algorithms/mesh-message.gv) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/mesh-message.py (renamed from data_structures_and_algorithms/mesh-message.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/norman.py (renamed from data_structures_and_algorithms/norman.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/nth-fibonacci.py (renamed from data_structures_and_algorithms/nth-fibonacci.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/optimal-stopping.py (renamed from data_structures_and_algorithms/optimal-stopping.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/perm-tree.py (renamed from data_structures_and_algorithms/perm-tree.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/permutation-palindrome.py (renamed from data_structures_and_algorithms/permutation-palindrome.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/permutations.py (renamed from data_structures_and_algorithms/permutations.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/plot.py (renamed from data_structures_and_algorithms/plot.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/product-of-other-numbers.py (renamed from data_structures_and_algorithms/product-of-other-numbers.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/queue-two-stacks.py (renamed from data_structures_and_algorithms/queue-two-stacks.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/rectangular-love.py (renamed from data_structures_and_algorithms/rectangular-love.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/recursive-string-permutations.py (renamed from data_structures_and_algorithms/recursive-string-permutations.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/reverse-linked-list.py (renamed from data_structures_and_algorithms/reverse-linked-list.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/reverse-words.py (renamed from data_structures_and_algorithms/reverse-words.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/second-largest-item-bst.py (renamed from data_structures_and_algorithms/second-largest-item-bst.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/shortest-path-inject-vertices.py (renamed from data_structures_and_algorithms/shortest-path-inject-vertices.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/shuffle.py (renamed from data_structures_and_algorithms/shuffle.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/string-reverse.py (renamed from data_structures_and_algorithms/string-reverse.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/temperature-tracker.py (renamed from data_structures_and_algorithms/temperature-tracker.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/test.txt (renamed from data_structures_and_algorithms/test.txt) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/top-scores.py (renamed from data_structures_and_algorithms/top-scores.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/topo-sort.py (renamed from data_structures_and_algorithms/topo-sort.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/trickling-water.py (renamed from data_structures_and_algorithms/trickling-water.py) | 0 | ||||
-rw-r--r-- | scratch/data_structures_and_algorithms/which-appears-twice.py (renamed from data_structures_and_algorithms/which-appears-twice.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/balanced-binary-tree.py (renamed from deepmind/part_one/balanced-binary-tree.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/dijkstra.py (renamed from deepmind/part_one/dijkstra.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/efficiency.org (renamed from deepmind/part_one/efficiency.org) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/find-rotation-point.py (renamed from deepmind/part_one/find-rotation-point.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/inflight-entertainment.py (renamed from deepmind/part_one/inflight-entertainment.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/kth-to-last.py (renamed from deepmind/part_one/kth-to-last.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/merging-ranges.py (renamed from deepmind/part_one/merging-ranges.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/recursive-string-permutations.py (renamed from deepmind/part_one/recursive-string-permutations.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/reverse-linked-list.py (renamed from deepmind/part_one/reverse-linked-list.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/stock-price.py (renamed from deepmind/part_one/stock-price.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_one/which-appears-twice.py (renamed from deepmind/part_one/which-appears-twice.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/.envrc (renamed from deepmind/part_two/.envrc) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/delete-node.py (renamed from deepmind/part_two/delete-node.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/misc/matrix-traversals.py (renamed from deepmind/part_two/misc/matrix-traversals.py) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/package-lock.json (renamed from deepmind/part_two/package-lock.json) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/package.json (renamed from deepmind/part_two/package.json) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/reverse-string-in-place.ts (renamed from deepmind/part_two/reverse-string-in-place.ts) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/shell.nix (renamed from deepmind/part_two/shell.nix) | 0 | ||||
-rw-r--r-- | scratch/deepmind/part_two/todo.org (renamed from deepmind/part_two/todo.org) | 0 | ||||
-rw-r--r-- | third_party/README.md | 5 | ||||
-rw-r--r-- | tools/rfcToKindle/LICENSE (renamed from rfcToKindle/LICENSE) | 0 | ||||
-rw-r--r-- | tools/rfcToKindle/README.md (renamed from rfcToKindle/README.md) | 0 | ||||
-rw-r--r-- | tools/rfcToKindle/default.nix (renamed from rfcToKindle/default.nix) | 0 | ||||
-rw-r--r-- | tools/rfcToKindle/main.go (renamed from rfcToKindle/main.go) | 0 | ||||
-rw-r--r-- | tools/run/.envrc (renamed from run/.envrc) | 0 | ||||
-rw-r--r-- | tools/run/README.md (renamed from run/README.md) | 0 | ||||
-rw-r--r-- | tools/run/default.nix (renamed from run/default.nix) | 0 | ||||
-rw-r--r-- | tools/run/main.go (renamed from run/main.go) | 0 | ||||
-rw-r--r-- | tools/run/shell.nix (renamed from run/shell.nix) | 0 | ||||
-rw-r--r-- | tools/symlinkManager/README.md | 14 | ||||
-rw-r--r-- | tools/symlinkManager/default.nix | 15 | ||||
-rw-r--r-- | tools/symlinkManager/main.go (renamed from scripts/delete_dotfile_symlinks.go) | 48 |
89 files changed, 53 insertions, 41 deletions
diff --git a/default.nix b/default.nix index 74268c803961..cf7e61e4a990 100644 --- a/default.nix +++ b/default.nix @@ -23,6 +23,7 @@ let gopkgs = readTree ./gopkgs; monzo_ynab = readTree ./monzo_ynab; third_party = readTree ./third_party; + tools = readTree ./tools; }; in fix(self: { config = config self; diff --git a/gopkgs/utils/utils.go b/gopkgs/utils/utils.go index 53136878dea3..7d662d08668b 100644 --- a/gopkgs/utils/utils.go +++ b/gopkgs/utils/utils.go @@ -21,6 +21,11 @@ func HomeDir() string { return user.HomeDir } +// Returns true if `info` is a symlink. +func IsSymlink(info os.FileMode) bool { + return info&os.ModeSymlink != 0 +} + // Return true if `path` exists and false otherwise. func FileExists(path string) bool { if _, err := os.Stat(path); os.IsNotExist(err) { diff --git a/scratch/README.md b/scratch/README.md new file mode 100644 index 000000000000..8259ac70d9b2 --- /dev/null +++ b/scratch/README.md @@ -0,0 +1,6 @@ +# Scratch + +The purpose of the `scratch` directory is to host practice exercises. Practice +encompasses things like working on data structures and algorithms problems for +upcoming coding interviews or general aptitude as well as writing code snippets +to help me learn a new programming language or understand an unfamiliar concept. diff --git a/crack_the_coding_interview/11_1.py b/scratch/crack_the_coding_interview/11_1.py index ec7b65dae0c3..ec7b65dae0c3 100644 --- a/crack_the_coding_interview/11_1.py +++ b/scratch/crack_the_coding_interview/11_1.py diff --git a/crack_the_coding_interview/to_tree.hs b/scratch/crack_the_coding_interview/to_tree.hs index 8496d88c0c0c..8496d88c0c0c 100644 --- a/crack_the_coding_interview/to_tree.hs +++ b/scratch/crack_the_coding_interview/to_tree.hs diff --git a/data_structures_and_algorithms/array-traversals.py b/scratch/data_structures_and_algorithms/array-traversals.py index 35cb4392812e..35cb4392812e 100644 --- a/data_structures_and_algorithms/array-traversals.py +++ b/scratch/data_structures_and_algorithms/array-traversals.py diff --git a/data_structures_and_algorithms/balanced-binary-tree.py b/scratch/data_structures_and_algorithms/balanced-binary-tree.py index 01fd965fd540..01fd965fd540 100644 --- a/data_structures_and_algorithms/balanced-binary-tree.py +++ b/scratch/data_structures_and_algorithms/balanced-binary-tree.py diff --git a/data_structures_and_algorithms/bit-manipulation.py b/scratch/data_structures_and_algorithms/bit-manipulation.py index dc30bb508887..dc30bb508887 100644 --- a/data_structures_and_algorithms/bit-manipulation.py +++ b/scratch/data_structures_and_algorithms/bit-manipulation.py diff --git a/data_structures_and_algorithms/bracket-validator.py b/scratch/data_structures_and_algorithms/bracket-validator.py index a50f8b074e55..a50f8b074e55 100644 --- a/data_structures_and_algorithms/bracket-validator.py +++ b/scratch/data_structures_and_algorithms/bracket-validator.py diff --git a/data_structures_and_algorithms/bst-checker.py b/scratch/data_structures_and_algorithms/bst-checker.py index 689be97a8503..689be97a8503 100644 --- a/data_structures_and_algorithms/bst-checker.py +++ b/scratch/data_structures_and_algorithms/bst-checker.py diff --git a/data_structures_and_algorithms/cafe-order-checker.py b/scratch/data_structures_and_algorithms/cafe-order-checker.py index e34a2b136ab6..e34a2b136ab6 100644 --- a/data_structures_and_algorithms/cafe-order-checker.py +++ b/scratch/data_structures_and_algorithms/cafe-order-checker.py diff --git a/data_structures_and_algorithms/cake-thief.py b/scratch/data_structures_and_algorithms/cake-thief.py index 9eddb34b2db3..9eddb34b2db3 100644 --- a/data_structures_and_algorithms/cake-thief.py +++ b/scratch/data_structures_and_algorithms/cake-thief.py diff --git a/data_structures_and_algorithms/coins.py b/scratch/data_structures_and_algorithms/coins.py index eb5754f98210..eb5754f98210 100644 --- a/data_structures_and_algorithms/coins.py +++ b/scratch/data_structures_and_algorithms/coins.py diff --git a/data_structures_and_algorithms/conways-game-of-life.py b/scratch/data_structures_and_algorithms/conways-game-of-life.py index 3836bcd0c653..3836bcd0c653 100644 --- a/data_structures_and_algorithms/conways-game-of-life.py +++ b/scratch/data_structures_and_algorithms/conways-game-of-life.py diff --git a/data_structures_and_algorithms/delete-node.py b/scratch/data_structures_and_algorithms/delete-node.py index 7e431e224962..7e431e224962 100644 --- a/data_structures_and_algorithms/delete-node.py +++ b/scratch/data_structures_and_algorithms/delete-node.py diff --git a/data_structures_and_algorithms/dft.py b/scratch/data_structures_and_algorithms/dft.py index 127d48c1864b..127d48c1864b 100644 --- a/data_structures_and_algorithms/dft.py +++ b/scratch/data_structures_and_algorithms/dft.py diff --git a/data_structures_and_algorithms/dijkstra-shortest-path.py b/scratch/data_structures_and_algorithms/dijkstra-shortest-path.py index 03907f604044..03907f604044 100644 --- a/data_structures_and_algorithms/dijkstra-shortest-path.py +++ b/scratch/data_structures_and_algorithms/dijkstra-shortest-path.py diff --git a/data_structures_and_algorithms/find-duplicate-optimize-for-space-beast.py b/scratch/data_structures_and_algorithms/find-duplicate-optimize-for-space-beast.py index 93fdd9eed2d6..93fdd9eed2d6 100644 --- a/data_structures_and_algorithms/find-duplicate-optimize-for-space-beast.py +++ b/scratch/data_structures_and_algorithms/find-duplicate-optimize-for-space-beast.py diff --git a/data_structures_and_algorithms/find-duplicate-optimize-for-space.py b/scratch/data_structures_and_algorithms/find-duplicate-optimize-for-space.py index e2739f0f6055..e2739f0f6055 100644 --- a/data_structures_and_algorithms/find-duplicate-optimize-for-space.py +++ b/scratch/data_structures_and_algorithms/find-duplicate-optimize-for-space.py diff --git a/data_structures_and_algorithms/find-rotation-point.py b/scratch/data_structures_and_algorithms/find-rotation-point.py index 2103a5b84f75..2103a5b84f75 100644 --- a/data_structures_and_algorithms/find-rotation-point.py +++ b/scratch/data_structures_and_algorithms/find-rotation-point.py diff --git a/data_structures_and_algorithms/find-unique-int-among-duplicates.py b/scratch/data_structures_and_algorithms/find-unique-int-among-duplicates.py index dfa5de42cc0b..dfa5de42cc0b 100644 --- a/data_structures_and_algorithms/find-unique-int-among-duplicates.py +++ b/scratch/data_structures_and_algorithms/find-unique-int-among-duplicates.py diff --git a/data_structures_and_algorithms/fixtures.py b/scratch/data_structures_and_algorithms/fixtures.py index 27689ca76d04..27689ca76d04 100644 --- a/data_structures_and_algorithms/fixtures.py +++ b/scratch/data_structures_and_algorithms/fixtures.py diff --git a/data_structures_and_algorithms/graph-coloring.py b/scratch/data_structures_and_algorithms/graph-coloring.py index bc7f7ceea562..bc7f7ceea562 100644 --- a/data_structures_and_algorithms/graph-coloring.py +++ b/scratch/data_structures_and_algorithms/graph-coloring.py diff --git a/data_structures_and_algorithms/graph-to-graphviz.py b/scratch/data_structures_and_algorithms/graph-to-graphviz.py index 0e7e97a20ca7..0e7e97a20ca7 100644 --- a/data_structures_and_algorithms/graph-to-graphviz.py +++ b/scratch/data_structures_and_algorithms/graph-to-graphviz.py diff --git a/data_structures_and_algorithms/highest-product-of-3.py b/scratch/data_structures_and_algorithms/highest-product-of-3.py index 889663e058da..889663e058da 100644 --- a/data_structures_and_algorithms/highest-product-of-3.py +++ b/scratch/data_structures_and_algorithms/highest-product-of-3.py diff --git a/data_structures_and_algorithms/inflight-entertainment.py b/scratch/data_structures_and_algorithms/inflight-entertainment.py index 6e17baef3709..6e17baef3709 100644 --- a/data_structures_and_algorithms/inflight-entertainment.py +++ b/scratch/data_structures_and_algorithms/inflight-entertainment.py diff --git a/data_structures_and_algorithms/knapsack-0-1.py b/scratch/data_structures_and_algorithms/knapsack-0-1.py index c72d19d4ed73..c72d19d4ed73 100644 --- a/data_structures_and_algorithms/knapsack-0-1.py +++ b/scratch/data_structures_and_algorithms/knapsack-0-1.py diff --git a/data_structures_and_algorithms/kth-to-last.py b/scratch/data_structures_and_algorithms/kth-to-last.py index 8291e54533d5..8291e54533d5 100644 --- a/data_structures_and_algorithms/kth-to-last.py +++ b/scratch/data_structures_and_algorithms/kth-to-last.py diff --git a/data_structures_and_algorithms/largest-stack.py b/scratch/data_structures_and_algorithms/largest-stack.py index aab9671eb6d3..aab9671eb6d3 100644 --- a/data_structures_and_algorithms/largest-stack.py +++ b/scratch/data_structures_and_algorithms/largest-stack.py diff --git a/data_structures_and_algorithms/linked-list-cycles.py b/scratch/data_structures_and_algorithms/linked-list-cycles.py index 75a4b993944c..75a4b993944c 100644 --- a/data_structures_and_algorithms/linked-list-cycles.py +++ b/scratch/data_structures_and_algorithms/linked-list-cycles.py diff --git a/data_structures_and_algorithms/merge-sort.py b/scratch/data_structures_and_algorithms/merge-sort.py index 6dbe0fa0f3c3..6dbe0fa0f3c3 100644 --- a/data_structures_and_algorithms/merge-sort.py +++ b/scratch/data_structures_and_algorithms/merge-sort.py diff --git a/data_structures_and_algorithms/merging-ranges.py b/scratch/data_structures_and_algorithms/merging-ranges.py index 4e3604d5bcca..4e3604d5bcca 100644 --- a/data_structures_and_algorithms/merging-ranges.py +++ b/scratch/data_structures_and_algorithms/merging-ranges.py diff --git a/data_structures_and_algorithms/mesh-message.gv b/scratch/data_structures_and_algorithms/mesh-message.gv index 1e67c3954f5f..1e67c3954f5f 100644 --- a/data_structures_and_algorithms/mesh-message.gv +++ b/scratch/data_structures_and_algorithms/mesh-message.gv diff --git a/data_structures_and_algorithms/mesh-message.py b/scratch/data_structures_and_algorithms/mesh-message.py index c9d7d9d74151..c9d7d9d74151 100644 --- a/data_structures_and_algorithms/mesh-message.py +++ b/scratch/data_structures_and_algorithms/mesh-message.py diff --git a/data_structures_and_algorithms/norman.py b/scratch/data_structures_and_algorithms/norman.py index 379ba92abba8..379ba92abba8 100644 --- a/data_structures_and_algorithms/norman.py +++ b/scratch/data_structures_and_algorithms/norman.py diff --git a/data_structures_and_algorithms/nth-fibonacci.py b/scratch/data_structures_and_algorithms/nth-fibonacci.py index cdb2846ea338..cdb2846ea338 100644 --- a/data_structures_and_algorithms/nth-fibonacci.py +++ b/scratch/data_structures_and_algorithms/nth-fibonacci.py diff --git a/data_structures_and_algorithms/optimal-stopping.py b/scratch/data_structures_and_algorithms/optimal-stopping.py index af13239941d0..af13239941d0 100644 --- a/data_structures_and_algorithms/optimal-stopping.py +++ b/scratch/data_structures_and_algorithms/optimal-stopping.py diff --git a/data_structures_and_algorithms/perm-tree.py b/scratch/data_structures_and_algorithms/perm-tree.py index 0eb389c26bb9..0eb389c26bb9 100644 --- a/data_structures_and_algorithms/perm-tree.py +++ b/scratch/data_structures_and_algorithms/perm-tree.py diff --git a/data_structures_and_algorithms/permutation-palindrome.py b/scratch/data_structures_and_algorithms/permutation-palindrome.py index 0a2136a408f2..0a2136a408f2 100644 --- a/data_structures_and_algorithms/permutation-palindrome.py +++ b/scratch/data_structures_and_algorithms/permutation-palindrome.py diff --git a/data_structures_and_algorithms/permutations.py b/scratch/data_structures_and_algorithms/permutations.py index fc2c1ef7eebc..fc2c1ef7eebc 100644 --- a/data_structures_and_algorithms/permutations.py +++ b/scratch/data_structures_and_algorithms/permutations.py diff --git a/data_structures_and_algorithms/plot.py b/scratch/data_structures_and_algorithms/plot.py index 5601891a0d9b..5601891a0d9b 100644 --- a/data_structures_and_algorithms/plot.py +++ b/scratch/data_structures_and_algorithms/plot.py diff --git a/data_structures_and_algorithms/product-of-other-numbers.py b/scratch/data_structures_and_algorithms/product-of-other-numbers.py index d05e82d42b02..d05e82d42b02 100644 --- a/data_structures_and_algorithms/product-of-other-numbers.py +++ b/scratch/data_structures_and_algorithms/product-of-other-numbers.py diff --git a/data_structures_and_algorithms/queue-two-stacks.py b/scratch/data_structures_and_algorithms/queue-two-stacks.py index 63da08ebf79a..63da08ebf79a 100644 --- a/data_structures_and_algorithms/queue-two-stacks.py +++ b/scratch/data_structures_and_algorithms/queue-two-stacks.py diff --git a/data_structures_and_algorithms/rectangular-love.py b/scratch/data_structures_and_algorithms/rectangular-love.py index 47c0f53979c6..47c0f53979c6 100644 --- a/data_structures_and_algorithms/rectangular-love.py +++ b/scratch/data_structures_and_algorithms/rectangular-love.py diff --git a/data_structures_and_algorithms/recursive-string-permutations.py b/scratch/data_structures_and_algorithms/recursive-string-permutations.py index 70461ddf5dac..70461ddf5dac 100644 --- a/data_structures_and_algorithms/recursive-string-permutations.py +++ b/scratch/data_structures_and_algorithms/recursive-string-permutations.py diff --git a/data_structures_and_algorithms/reverse-linked-list.py b/scratch/data_structures_and_algorithms/reverse-linked-list.py index b7396b20ce3f..b7396b20ce3f 100644 --- a/data_structures_and_algorithms/reverse-linked-list.py +++ b/scratch/data_structures_and_algorithms/reverse-linked-list.py diff --git a/data_structures_and_algorithms/reverse-words.py b/scratch/data_structures_and_algorithms/reverse-words.py index 5df12ebabdc7..5df12ebabdc7 100644 --- a/data_structures_and_algorithms/reverse-words.py +++ b/scratch/data_structures_and_algorithms/reverse-words.py diff --git a/data_structures_and_algorithms/second-largest-item-bst.py b/scratch/data_structures_and_algorithms/second-largest-item-bst.py index bc167d975a7b..bc167d975a7b 100644 --- a/data_structures_and_algorithms/second-largest-item-bst.py +++ b/scratch/data_structures_and_algorithms/second-largest-item-bst.py diff --git a/data_structures_and_algorithms/shortest-path-inject-vertices.py b/scratch/data_structures_and_algorithms/shortest-path-inject-vertices.py index e08ea66b8f50..e08ea66b8f50 100644 --- a/data_structures_and_algorithms/shortest-path-inject-vertices.py +++ b/scratch/data_structures_and_algorithms/shortest-path-inject-vertices.py diff --git a/data_structures_and_algorithms/shuffle.py b/scratch/data_structures_and_algorithms/shuffle.py index bdfbad24263c..bdfbad24263c 100644 --- a/data_structures_and_algorithms/shuffle.py +++ b/scratch/data_structures_and_algorithms/shuffle.py diff --git a/data_structures_and_algorithms/string-reverse.py b/scratch/data_structures_and_algorithms/string-reverse.py index 8b4cdac1c271..8b4cdac1c271 100644 --- a/data_structures_and_algorithms/string-reverse.py +++ b/scratch/data_structures_and_algorithms/string-reverse.py diff --git a/data_structures_and_algorithms/temperature-tracker.py b/scratch/data_structures_and_algorithms/temperature-tracker.py index 6b042182f01c..6b042182f01c 100644 --- a/data_structures_and_algorithms/temperature-tracker.py +++ b/scratch/data_structures_and_algorithms/temperature-tracker.py diff --git a/data_structures_and_algorithms/test.txt b/scratch/data_structures_and_algorithms/test.txt index ce013625030b..ce013625030b 100644 --- a/data_structures_and_algorithms/test.txt +++ b/scratch/data_structures_and_algorithms/test.txt diff --git a/data_structures_and_algorithms/top-scores.py b/scratch/data_structures_and_algorithms/top-scores.py index 8e7b073dd8bd..8e7b073dd8bd 100644 --- a/data_structures_and_algorithms/top-scores.py +++ b/scratch/data_structures_and_algorithms/top-scores.py diff --git a/data_structures_and_algorithms/topo-sort.py b/scratch/data_structures_and_algorithms/topo-sort.py index fe295b0279ff..fe295b0279ff 100644 --- a/data_structures_and_algorithms/topo-sort.py +++ b/scratch/data_structures_and_algorithms/topo-sort.py diff --git a/data_structures_and_algorithms/trickling-water.py b/scratch/data_structures_and_algorithms/trickling-water.py index 45621990ecf9..45621990ecf9 100644 --- a/data_structures_and_algorithms/trickling-water.py +++ b/scratch/data_structures_and_algorithms/trickling-water.py diff --git a/data_structures_and_algorithms/which-appears-twice.py b/scratch/data_structures_and_algorithms/which-appears-twice.py index e9a4f0eb24d0..e9a4f0eb24d0 100644 --- a/data_structures_and_algorithms/which-appears-twice.py +++ b/scratch/data_structures_and_algorithms/which-appears-twice.py diff --git a/deepmind/part_one/balanced-binary-tree.py b/scratch/deepmind/part_one/balanced-binary-tree.py index 7fc174a2a9f3..7fc174a2a9f3 100644 --- a/deepmind/part_one/balanced-binary-tree.py +++ b/scratch/deepmind/part_one/balanced-binary-tree.py diff --git a/deepmind/part_one/dijkstra.py b/scratch/deepmind/part_one/dijkstra.py index 6975dbe4d1d6..6975dbe4d1d6 100644 --- a/deepmind/part_one/dijkstra.py +++ b/scratch/deepmind/part_one/dijkstra.py diff --git a/deepmind/part_one/efficiency.org b/scratch/deepmind/part_one/efficiency.org index 89a45c52ad8a..89a45c52ad8a 100644 --- a/deepmind/part_one/efficiency.org +++ b/scratch/deepmind/part_one/efficiency.org diff --git a/deepmind/part_one/find-rotation-point.py b/scratch/deepmind/part_one/find-rotation-point.py index 5c21d5167ce9..5c21d5167ce9 100644 --- a/deepmind/part_one/find-rotation-point.py +++ b/scratch/deepmind/part_one/find-rotation-point.py diff --git a/deepmind/part_one/inflight-entertainment.py b/scratch/deepmind/part_one/inflight-entertainment.py index 2116b27b0b97..2116b27b0b97 100644 --- a/deepmind/part_one/inflight-entertainment.py +++ b/scratch/deepmind/part_one/inflight-entertainment.py diff --git a/deepmind/part_one/kth-to-last.py b/scratch/deepmind/part_one/kth-to-last.py index 5335e419f7ec..5335e419f7ec 100644 --- a/deepmind/part_one/kth-to-last.py +++ b/scratch/deepmind/part_one/kth-to-last.py diff --git a/deepmind/part_one/merging-ranges.py b/scratch/deepmind/part_one/merging-ranges.py index 23b40793b8f1..23b40793b8f1 100644 --- a/deepmind/part_one/merging-ranges.py +++ b/scratch/deepmind/part_one/merging-ranges.py diff --git a/deepmind/part_one/recursive-string-permutations.py b/scratch/deepmind/part_one/recursive-string-permutations.py index f50db2838707..f50db2838707 100644 --- a/deepmind/part_one/recursive-string-permutations.py +++ b/scratch/deepmind/part_one/recursive-string-permutations.py diff --git a/deepmind/part_one/reverse-linked-list.py b/scratch/deepmind/part_one/reverse-linked-list.py index 82fac171d5d1..82fac171d5d1 100644 --- a/deepmind/part_one/reverse-linked-list.py +++ b/scratch/deepmind/part_one/reverse-linked-list.py diff --git a/deepmind/part_one/stock-price.py b/scratch/deepmind/part_one/stock-price.py index 7055b66af196..7055b66af196 100644 --- a/deepmind/part_one/stock-price.py +++ b/scratch/deepmind/part_one/stock-price.py diff --git a/deepmind/part_one/which-appears-twice.py b/scratch/deepmind/part_one/which-appears-twice.py index c01379295d32..c01379295d32 100644 --- a/deepmind/part_one/which-appears-twice.py +++ b/scratch/deepmind/part_one/which-appears-twice.py diff --git a/deepmind/part_two/.envrc b/scratch/deepmind/part_two/.envrc index b80e28b4b815..b80e28b4b815 100644 --- a/deepmind/part_two/.envrc +++ b/scratch/deepmind/part_two/.envrc diff --git a/deepmind/part_two/delete-node.py b/scratch/deepmind/part_two/delete-node.py index 4ed02ec30832..4ed02ec30832 100644 --- a/deepmind/part_two/delete-node.py +++ b/scratch/deepmind/part_two/delete-node.py diff --git a/deepmind/part_two/misc/matrix-traversals.py b/scratch/deepmind/part_two/misc/matrix-traversals.py index 52354f990e11..52354f990e11 100644 --- a/deepmind/part_two/misc/matrix-traversals.py +++ b/scratch/deepmind/part_two/misc/matrix-traversals.py diff --git a/deepmind/part_two/package-lock.json b/scratch/deepmind/part_two/package-lock.json index 94c89c5979c4..94c89c5979c4 100644 --- a/deepmind/part_two/package-lock.json +++ b/scratch/deepmind/part_two/package-lock.json diff --git a/deepmind/part_two/package.json b/scratch/deepmind/part_two/package.json index c9ef307ca0ee..c9ef307ca0ee 100644 --- a/deepmind/part_two/package.json +++ b/scratch/deepmind/part_two/package.json diff --git a/deepmind/part_two/reverse-string-in-place.ts b/scratch/deepmind/part_two/reverse-string-in-place.ts index d714dfef997f..d714dfef997f 100644 --- a/deepmind/part_two/reverse-string-in-place.ts +++ b/scratch/deepmind/part_two/reverse-string-in-place.ts diff --git a/deepmind/part_two/shell.nix b/scratch/deepmind/part_two/shell.nix index 606dd7167f7c..606dd7167f7c 100644 --- a/deepmind/part_two/shell.nix +++ b/scratch/deepmind/part_two/shell.nix diff --git a/deepmind/part_two/todo.org b/scratch/deepmind/part_two/todo.org index 510073e6e2cd..510073e6e2cd 100644 --- a/deepmind/part_two/todo.org +++ b/scratch/deepmind/part_two/todo.org diff --git a/third_party/README.md b/third_party/README.md new file mode 100644 index 000000000000..29e498a37726 --- /dev/null +++ b/third_party/README.md @@ -0,0 +1,5 @@ +# third_party + +The `third_party` directory hosts Nix expressions that package software that I +cannot or have not found in other Nix package repositorys like `nixpkgs` or +`depot`. diff --git a/rfcToKindle/LICENSE b/tools/rfcToKindle/LICENSE index 7a4a3ea2424c..7a4a3ea2424c 100644 --- a/rfcToKindle/LICENSE +++ b/tools/rfcToKindle/LICENSE diff --git a/rfcToKindle/README.md b/tools/rfcToKindle/README.md index e7b4fa841ef6..e7b4fa841ef6 100644 --- a/rfcToKindle/README.md +++ b/tools/rfcToKindle/README.md diff --git a/rfcToKindle/default.nix b/tools/rfcToKindle/default.nix index 3bfa71f2896d..3bfa71f2896d 100644 --- a/rfcToKindle/default.nix +++ b/tools/rfcToKindle/default.nix diff --git a/rfcToKindle/main.go b/tools/rfcToKindle/main.go index 0f4f2dd9ec4f..0f4f2dd9ec4f 100644 --- a/rfcToKindle/main.go +++ b/tools/rfcToKindle/main.go diff --git a/run/.envrc b/tools/run/.envrc index b80e28b4b815..b80e28b4b815 100644 --- a/run/.envrc +++ b/tools/run/.envrc diff --git a/run/README.md b/tools/run/README.md index d3cccecf910c..d3cccecf910c 100644 --- a/run/README.md +++ b/tools/run/README.md diff --git a/run/default.nix b/tools/run/default.nix index 113491536ee5..113491536ee5 100644 --- a/run/default.nix +++ b/tools/run/default.nix diff --git a/run/main.go b/tools/run/main.go index 04906ece91f7..04906ece91f7 100644 --- a/run/main.go +++ b/tools/run/main.go diff --git a/run/shell.nix b/tools/run/shell.nix index 8b97f04ca446..8b97f04ca446 100644 --- a/run/shell.nix +++ b/tools/run/shell.nix diff --git a/tools/symlinkManager/README.md b/tools/symlinkManager/README.md new file mode 100644 index 000000000000..b0fc58c8e989 --- /dev/null +++ b/tools/symlinkManager/README.md @@ -0,0 +1,14 @@ +# Dotfile Symlink Manager + +Find and delete all symlinks to the dotfiles defined in `$BRIEFCASE`. + +Oftentimes I corrupt the state of my configuration files. The intention with +this script is to help me clean things up when this happens. An example workflow +might look like: + +```shell +> symlink-mgr --audit +> symlink-mgr --seriously +> briefcase # changes directory to $BRIEFCASE +> make install +``` diff --git a/tools/symlinkManager/default.nix b/tools/symlinkManager/default.nix new file mode 100644 index 000000000000..6500991babb9 --- /dev/null +++ b/tools/symlinkManager/default.nix @@ -0,0 +1,15 @@ +{ + depot ? import <depot> {}, + briefcase ? import <briefcase> {}, + ... +}: + +depot.buildGo.program { + name = "symlink-mgr"; + srcs = [ + ./main.go + ]; + deps = with briefcase.gopkgs; [ + utils + ]; +} diff --git a/scripts/delete_dotfile_symlinks.go b/tools/symlinkManager/main.go index 497b2d57b8c1..5d133e37d97b 100644 --- a/scripts/delete_dotfile_symlinks.go +++ b/tools/symlinkManager/main.go @@ -1,21 +1,3 @@ -// Find and delete all symlinks to the dotfiles defined in $BRIEFCASE. -// -// Oftentimes I corrupt the state of my dotfiles. The intention with this script -// is to write some tooling to help me better manage my dotfile cleanliness. An -// example workflow might look like: -// -// ```shell -// > go run delete_dotfile_symlinks.go --audit -// > go run delete_dotfile_symlinks.go --seriously -// > cd .. -// > make install -// ``` -// -// Outstanding TODOs: -// - Package this with <depot>buildGo.nix. -// - How can this be run as script without `go run`? She-bang at the top? -// - See TODOs within this package. - package main import ( @@ -26,25 +8,9 @@ import ( "os" "path/filepath" "strings" + "utils" ) -// Wanted for go tooling: -// 1. jump-to-def -// 2. documentation at point -// 3. autocompletion - -// TODO: Consider adding this to a utils.go package. -func failOn(err error) { - if err != nil { - log.Fatal(err) - } -} - -// TODO: Consider adding this to a utils.go package. -func isSymlink(m os.FileMode) bool { - return m&os.ModeSymlink != 0 -} - var hostnames = map[string]string{ os.Getenv("DESKTOP"): "desktop", os.Getenv("LAPTOP"): "work_laptop", @@ -66,13 +32,13 @@ func main() { } home, err := os.UserHomeDir() - failOn(err) + utils.FailOn(err) count := 0 err = filepath.Walk(home, func(path string, info os.FileInfo, err error) error { - if isSymlink(info.Mode()) { + if utils.IsSymlink(info.Mode()) { dest, err := os.Readlink(path) - failOn(err) + utils.FailOn(err) var predicate func(string) bool @@ -80,7 +46,7 @@ func main() { predicate = func(dest string) bool { var hostname string hostname, err = os.Hostname() - failOn(err) + utils.FailOn(err) seeking, ok := hostnames[hostname] if !ok { log.Fatal(fmt.Sprintf("Hostname \"%s\" not supported in the hostnames map.", hostname)) @@ -99,14 +65,14 @@ func main() { } else if *seriously { fmt.Printf("rm %s\n", path) err = os.Remove(path) - failOn(err) + utils.FailOn(err) } count += 1 } } return nil }) - failOn(err) + utils.FailOn(err) if *audit { fmt.Printf("Would have deleted %d symlinks.\n", count) } else if *seriously { |