<commit_before># This playbook installs apps and packages needed for general development
- hosts: localhost
  pre_tasks:
    - name: Make .config directory
      file:
        path: ~/.config
        state: directory
    - name: Make projects directory
      file:
        path: ~/projects
        state: directory
    - name: Make .bin directory
      file:
        path: ~/.bin
        state: directory
    - name: Stow dotfiles for ack
      command: stow ack
      changed_when: false
    - name: Stow dotfiles for Git
      command: stow git
      changed_when: false
    - name: Stow dotfiles for Neovim
      command: stow neovim
      changed_when: false
    - name: Stow dotfiles for the Starship prompt
      command: stow starship
      changed_when: false
    - name: Stow dotfiles for tmux
      command: stow tmux
      changed_when: false
  tasks:
    - name: Install packages to allow apt to use a repository over HTTPS
      become: yes
      shell: apt update && apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
      register: result
      changed_when: result.stdout is not search("0 newly installed")
    - name: Update Homebrew and upgrade all existing packages
      homebrew:
        update_homebrew: yes
        upgrade_all: yes
    - name: Install ack
      homebrew:
        name: ack
        state: present
    - name: Install bat
      homebrew:
        name: bat
        state: present
    - name: Install coreutils
      homebrew:
        name: coreutils
        state: present
    - name: Install fd
      homebrew:
        name: fd
        state: present
    - name: Install fdupes
      homebrew:
        name: fdupes
        state: present
    - name: Install fzf
      homebrew:
        name: fzf
        state: present
    - name: Install git
      homebrew:
        name: git
        state: present
    - name: Install grep
      homebrew:
        name: grep
        state: present
    - name: Install gron
      homebrew:
        name: gron
        state: present
    - name: Install imagemagick
      homebrew:
        name: imagemagick
        state: present
    - name: Install jq
      homebrew:
        name: jq
        state: present
    - name: Install less
      homebrew:
        name: less
        state: present
    - name: Install mosh
      homebrew:
        name: mosh
        state: present
    - name: Install neovim
      homebrew:
        name: neovim
        state: present
    - name: Install Node.js
      homebrew:
        name: node
        state: present
    - name: Install python
      homebrew:
        name: python
        state: present
    - name: Install python3
      homebrew:
        name: python3
        state: present
    - name: Install shellcheck
      homebrew:
        name: shellcheck
        state: present
    - name: Install the Starship prompt
      homebrew:
        name: starship
        state: present
    - name: Install tidy-html5
      homebrew:
        name: tidy-html5
        state: present
    - name: Install tldr
      homebrew:
        name: tldr
        state: present
    - name: Install tmux
      homebrew:
        name: tmux
        state: present
    - name: Install tokei
      homebrew:
        name: tokei
        state: present
    - name: Install tree
      homebrew:
        name: tree
        state: present
    - name: Install uncrustify
      homebrew:
        name: uncrustify
        state: present
    - name: Install unzip
      homebrew:
        name: unzip
        state: present
    - name: Install watch
      homebrew:
        name: watch
        state: present
    - name: Install yq
      homebrew:
        name: yq
        state: present
    - name: Install zsh
      become: yes
      shell: apt install -y zsh
      register: result
      changed_when: result.stdout is not search("0 newly installed")
    - name: Install fzf zsh support
      shell: $(brew --prefix)/opt/fzf/install --all
      changed_when: false
    - name: Install gvm dependencies
      become: yes
      shell: apt install curl git mercurial make binutils bison gcc build-essential
      register: result
      changed_when: result.stdout is not search("0 newly installed")
    - name: Install gvm
      shell: GVM_NO_UPDATE_PROFILE=true zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
      args:
        executable: /bin/bash
      register: result
      changed_when: result.stdout is not search("Already installed! Remove old installation by running")
      failed_when: result.rc != 0 and result.stdout is not search("Already installed! Remove old installation by running")
    - name: Install go1.13.1 via gvm
      shell: brew install go && gvm install go1.13.1 && brew remove go
      register: result
      changed_when: false
    - name: Make go1.13.1 the default via gvm
      shell: gvm use go1.13.1 --default
      changed_when: false
      failed_when: false
    - name: Install "prettier" Node.js package globally
      npm:
        name: prettier
        global: yes
    - name: Install "markdown-cli" Node.js package globally
      npm:
        name: markdown-cli
        global: yes
    - name: Install "bash-language-server" Node.js package globally
      npm:
        name: bash-language-server
        global: yes
    - name: Install "yaml-language-server" Node.js package globally
      npm:
        name: yaml-language-server
        global: yes
    - name: Install neovim Python modules
      shell: pip3 install msgpack neovim -U
      register: result
      changed_when: "result.stdout is not search('Requirement already up-to-date: neovim') and result.stdout is not search('Requirement already up-to-date: msgpack')"
    - name: Install vim-plug
      command: curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
      changed_when: false
    - name: Install nvim plugins
      command: nvim --headless +GoUpdateBinaries +PlugUpdate +PlugUpgrade +UpdateRemotePlugins +qall
      changed_when: false
    - name: Install Oh My Zsh
      shell: sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
      register: result
      changed_when: result.stdout is not search("You already have Oh My Zsh installed.")
      failed_when: result.rc != 0 and result.stdout is not search("You already have Oh My Zsh installed.")
    - name: Remove the default ~/.zshrc
      file:
        path: ~/.zshrc
        state: absent
      changed_when: false
    - name: Stow dotfiles for Oh My Zsh
      command: stow zsh
      changed_when: false
    - name: Change user shell to Zsh
      shell: command -v zsh | sudo tee -a /etc/shells && sudo usermod --shell $(command -v zsh) $(whoami)
      changed_when: false
      failed_when: false
    - openssh_keypair:
        path: ~/.ssh/id_rsa
    - name: Install imcat
      shell: git clone https://github.com/stolk/imcat.git && cd imcat && make && mv imcat ~/.bin && cd .. && rm -rf imcat
      changed_when: false
    - name: Update tldr
      shell: tldr --update
      changed_when: false
<commit_msg>Update global NPM packages via Ansible<commit_after># This playbook installs apps and packages needed for general development
- hosts: localhost
  pre_tasks:
    - name: Make .config directory
      file:
        path: ~/.config
        state: directory
    - name: Make projects directory
      file:
        path: ~/projects
        state: directory
    - name: Make .bin directory
      file:
        path: ~/.bin
        state: directory
    - name: Stow dotfiles for ack
      command: stow ack
      changed_when: false
    - name: Stow dotfiles for Git
      command: stow git
      changed_when: false
    - name: Stow dotfiles for Neovim
      command: stow neovim
      changed_when: false
    - name: Stow dotfiles for the Starship prompt
      command: stow starship
      changed_when: false
    - name: Stow dotfiles for tmux
      command: stow tmux
      changed_when: false
  tasks:
    - name: Install packages to allow apt to use a repository over HTTPS
      become: yes
      shell: apt update && apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
      register: result
      changed_when: result.stdout is not search("0 newly installed")
    - name: Update Homebrew and upgrade all existing packages
      homebrew:
        update_homebrew: yes
        upgrade_all: yes
    - name: Install ack
      homebrew:
        name: ack
        state: present
    - name: Install bat
      homebrew:
        name: bat
        state: present
    - name: Install coreutils
      homebrew:
        name: coreutils
        state: present
    - name: Install fd
      homebrew:
        name: fd
        state: present
    - name: Install fdupes
      homebrew:
        name: fdupes
        state: present
    - name: Install fzf
      homebrew:
        name: fzf
        state: present
    - name: Install git
      homebrew:
        name: git
        state: present
    - name: Install grep
      homebrew:
        name: grep
        state: present
    - name: Install gron
      homebrew:
        name: gron
        state: present
    - name: Install imagemagick
      homebrew:
        name: imagemagick
        state: present
    - name: Install jq
      homebrew:
        name: jq
        state: present
    - name: Install less
      homebrew:
        name: less
        state: present
    - name: Install mosh
      homebrew:
        name: mosh
        state: present
    - name: Install neovim
      homebrew:
        name: neovim
        state: present
    - name: Install Node.js
      homebrew:
        name: node
        state: present
    - name: Install python
      homebrew:
        name: python
        state: present
    - name: Install python3
      homebrew:
        name: python3
        state: present
    - name: Install shellcheck
      homebrew:
        name: shellcheck
        state: present
    - name: Install the Starship prompt
      homebrew:
        name: starship
        state: present
    - name: Install tidy-html5
      homebrew:
        name: tidy-html5
        state: present
    - name: Install tldr
      homebrew:
        name: tldr
        state: present
    - name: Install tmux
      homebrew:
        name: tmux
        state: present
    - name: Install tokei
      homebrew:
        name: tokei
        state: present
    - name: Install tree
      homebrew:
        name: tree
        state: present
    - name: Install uncrustify
      homebrew:
        name: uncrustify
        state: present
    - name: Install unzip
      homebrew:
        name: unzip
        state: present
    - name: Install watch
      homebrew:
        name: watch
        state: present
    - name: Install yq
      homebrew:
        name: yq
        state: present
    - name: Install zsh
      become: yes
      shell: apt install -y zsh
      register: result
      changed_when: result.stdout is not search("0 newly installed")
    - name: Install fzf zsh support
      shell: $(brew --prefix)/opt/fzf/install --all
      changed_when: false
    - name: Install gvm dependencies
      become: yes
      shell: apt install curl git mercurial make binutils bison gcc build-essential
      register: result
      changed_when: result.stdout is not search("0 newly installed")
    - name: Install gvm
      shell: GVM_NO_UPDATE_PROFILE=true zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
      args:
        executable: /bin/bash
      register: result
      changed_when: result.stdout is not search("Already installed! Remove old installation by running")
      failed_when: result.rc != 0 and result.stdout is not search("Already installed! Remove old installation by running")
    - name: Install go1.13.1 via gvm
      shell: brew install go && gvm install go1.13.1 && brew remove go
      register: result
      changed_when: false
    - name: Make go1.13.1 the default via gvm
      shell: gvm use go1.13.1 --default
      changed_when: false
      failed_when: false
    - name: Update all global NPM packages
      shell: npm update -g
      changed_when: false
    - name: Install "prettier" Node.js package globally
      npm:
        name: prettier
        global: yes
    - name: Install "markdown-cli" Node.js package globally
      npm:
        name: markdown-cli
        global: yes
    - name: Install "bash-language-server" Node.js package globally
      npm:
        name: bash-language-server
        global: yes
    - name: Install "yaml-language-server" Node.js package globally
      npm:
        name: yaml-language-server
        global: yes
    - name: Install neovim Python modules
      shell: pip3 install msgpack neovim -U
      register: result
      changed_when: "result.stdout is not search('Requirement already up-to-date: neovim') and result.stdout is not search('Requirement already up-to-date: msgpack')"
    - name: Install vim-plug
      command: curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
      changed_when: false
    - name: Install nvim plugins
      command: nvim --headless +GoUpdateBinaries +PlugUpdate +PlugUpgrade +UpdateRemotePlugins +qall
      changed_when: false
    - name: Install Oh My Zsh
      shell: sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
      register: result
      changed_when: result.stdout is not search("You already have Oh My Zsh installed.")
      failed_when: result.rc != 0 and result.stdout is not search("You already have Oh My Zsh installed.")
    - name: Remove the default ~/.zshrc
      file:
        path: ~/.zshrc
        state: absent
      changed_when: false
    - name: Stow dotfiles for Oh My Zsh
      command: stow zsh
      changed_when: false
    - name: Change user shell to Zsh
      shell: command -v zsh | sudo tee -a /etc/shells && sudo usermod --shell $(command -v zsh) $(whoami)
      changed_when: false
      failed_when: false
    - openssh_keypair:
        path: ~/.ssh/id_rsa
    - name: Install imcat
      shell: git clone https://github.com/stolk/imcat.git && cd imcat && make && mv imcat ~/.bin && cd .. && rm -rf imcat
      changed_when: false
    - name: Update tldr
      shell: tldr --update
      changed_when: false

{'fraction_non_alphanumeric': 0.07618981833252746, 'fraction_numerical': 0.00359190440008289, 'mean_word_length': 1.9993784959602237, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '949444', 'n_tokens_mistral': 4250, 'n_tokens_neox': 4165, 'n_words': 1445}