From c6ae66c57db28e8a25348ade3f28e5c250b87ead Mon Sep 17 00:00:00 2001 From: MorganGeek Date: Tue, 7 Jul 2020 15:19:29 +0200 Subject: [PATCH] aliases for git diff and text parsing --- dot_zsh_functions | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dot_zsh_functions b/dot_zsh_functions index 53ea94f..74b1577 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -412,3 +412,18 @@ function is_earlier { false fi } +function gitydiff { + local path_to_file="$1" + git show "HEAD:$path_to_file" | colordiff -y - "$path_to_file" +} +function dl_stopwords { + curl -Lks https://raw.githubusercontent.com/MorganGeek/bookmarks/master/stopwords.txt -o "$HOME/stopwords.txt" +} +function file_getwords { + dl_stopwords; + \cat "$1" | tr '[:upper:]' '[:lower:]' | \grep -o -E '\w{3,}' | \grep --invert-match --word-regexp --fixed-strings --file="$HOME/stopwords.txt" | \sed 's/s$//g' | \sed 's/ing$//g' | sort | uniq -c | sort --numeric-sort --reverse +} +function file_getpairs { + dl_stopwords; + \cat "$1" | tr '[:upper:]' '[:lower:]' | \grep -o -E '\w{3,} \w{3,}' | \grep --invert-match --word-regexp --fixed-strings --file="$HOME/stopwords.txt" | \sed 's/s$//g' | \sed 's/ing$//g' | sort | uniq -c | sort --numeric-sort --reverse +}