<commit_before>#!/bin/bash
set -e

# install.sh
#	This script installs my basic setup for a debian laptop

USERNAME=fschl

apt_sources() {
    cat <<-EOF > /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free

deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free

# stable-updates, previously known as 'volatile'
deb http://ftp.de.debian.org/debian/ stable-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable-updates main contrib non-free

deb http://ftp.de.debian.org/debian/ stable-proposed-updates main
deb http://ftp.de.debian.org/debian/ testing main
EOF

}

base_applications() {

    echo "update and installing baseapps..."

    apt-get update
    apt-get upgrade

    apt-get install -y \
            alsa-utils \
            apt-transport-https \
            automake \
            bash-completion \
            bmon \
            bzip2 \
            ca-certificates \
            cmake \
            coreutils \
            curl \
            gcc \
            git \
            gnupg \
            gnupg-agent \
            gnupg-curl \
            grep \
            htop \
            iotop \
            locales \
            make \
            mount \
            net-tools \
            pulseaudio \
            rsync \
            ssh \
            sudo \
            tar \
            tree \
            xclip \
            zip \
            --no-install-recommends

    echo "... DONE... cleaning up\n\n"
    apt-get autoremove
    apt-get autoclean
    apt-get clean

    echo "... setting capslock to control"
    sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard

}

no_suspend() {
    # https://wiki.debian.org/SystemdSuspendSedation
    sudo sed -i "s/HandleLidSwitch=.*/HandleLidSwitch=ignore/" /etc/systemd/logind.conf
    sudo sed -i "s/HandleLidSwitchDocked=.*/HandleLidSwitchDocked=ignore/" /etc/systemd/logind.conf
    sudo sed -i "s/IdleActionSec=.*/IdleActionSec=90min/" /etc/systemd/logind.conf

    sudo systemctl restart systemd-logind.service
}


install_i3() {

    echo "update and installing i3wm and some tools..."
    apt-get update
    apt-get install -y \
            feh \
            fswebcam \
            i3 \
            i3lock \
            i3status \
            rxvt-unicode-256color \
            scrot \
            slim \
            xorg \
            --no-install-recommends

    echo "... DONE... cleaning up\n\n"
    apt-get autoremove
    apt-get autoclean
    apt-get clean

    no_suspend
}

install_docker() {

    echo "installing docker from get.docker.com | sh..."
    adduser -aG docker "$USERNAME"

    curl -sSL https://get.docker.com/ | sh

}

install_compose() {

    VERS="1.7.1"
    echo "installing docker-compose $VERS ... curling from github"

    curl -SL https://github.com/docker/compose/releases/download/$VERS/docker-compose-Linux-x86_64 \
         -o /usr/bin/docker-compose
    chmod +x /usr/bin/docker-compose

    echo "... done"

    /usr/bin/docker-compose version
}

get_dotfiles() {

    (
        git clone https://github.com/fschl/dotfiles.git "/home/$USERNAME/dotfiles"
        cd "/home/$USERNAME/dotfiles" && make

        git clone https://github.com/fschl/dockerfiles.git "/home/$USERNAME/dockerfiles"

        git clone https://github.com/fschl/.emacs.d.git "/home/$USERNAME/.emacs.d"
    )
}

# install/update golang from source
install_golang() {
    export GO_VERSION=1.6.2
    export GO_SRC=/usr/local/go

    # if we are passing the version
    if [[ ! -z "$1" ]]; then
        export GO_VERSION=$1
    fi

    # subshell because we `cd`
    (
    curl -sSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | sudo tar -v -C /usr/local -xz
    )

    # get commandline tools
    (
    set -x
    set +e
    go get github.com/golang/lint/golint
    go get golang.org/x/tools/cmd/cover
    go get golang.org/x/review/git-codereview
    go get golang.org/x/tools/cmd/goimports
    go get golang.org/x/tools/cmd/gorename

    go get github.com/FiloSottile/vendorcheck
    go get github.com/nsf/gocode
    #done
    )<commit_msg>update install<commit_after>#!/bin/bash
set -e

# install.sh
#	This script installs my basic setup for a debian laptop

USERNAME=fschl

apt_sources() {
    cat <<-EOF > /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free

deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free

# stable-updates, previously known as 'volatile'
deb http://ftp.de.debian.org/debian/ stable-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable-updates main contrib non-free

deb http://ftp.de.debian.org/debian/ stable-proposed-updates main
deb http://ftp.de.debian.org/debian/ testing main
EOF

}

base_applications() {

    echo "update and installing baseapps..."

    apt-get update
    apt-get upgrade

    apt-get install -y \
            apt-transport-https \
            automake \
            bash-completion \
            bmon \
            bzip2 \
            ca-certificates \
            cmake \
            coreutils \
            curl \
            dnsutils \
            gcc \
            git \
            gnupg \
            gnupg2 \
            gnupg-agent \
            gnupg-curl \
            grep \
            htop \
            iotop \
            locales \
            make \
            mount \
            net-tools \
            rsync \
            ssh \
            sudo \
            tar \
            tmux \
            tree \
            unattended-upgrades \
            xclip \
            zip \
            --no-install-recommends

    echo "... DONE... cleaning up\n\n"
    apt-get autoremove
    apt-get autoclean
    apt-get clean

    echo "... setting capslock to control"
    sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard

}

no_suspend() {
    # https://wiki.debian.org/SystemdSuspendSedation
    sudo sed -i "s/HandleLidSwitch=.*/HandleLidSwitch=ignore/" /etc/systemd/logind.conf
    sudo sed -i "s/HandleLidSwitchDocked=.*/HandleLidSwitchDocked=ignore/" /etc/systemd/logind.conf
    sudo sed -i "s/IdleActionSec=.*/IdleActionSec=90min/" /etc/systemd/logind.conf

    sudo systemctl restart systemd-logind.service
}


install_i3() {

    echo "update and installing i3wm and some tools..."
    apt-get update
    apt-get install -y \
            alsa-utils \
            feh \
            fswebcam \
            i3 \
            i3lock \
            i3status \
            keepass2 \
            pulseaudio \
            rxvt-unicode-256color \
            scrot \
            shotwell \
            slim \
            xorg \
            --no-install-recommends

    echo "... DONE... cleaning up\n\n"
    apt-get autoremove
    apt-get autoclean
    apt-get clean

    no_suspend
}

install_docker() {

    echo "installing docker from get.docker.com | sh..."
    adduser -aG docker "$USERNAME"

    curl -sSL https://get.docker.com/ | sh

}

install_compose() {

    VERS="1.7.1"
    echo "installing docker-compose $VERS ... curling from github"

    curl -SL https://github.com/docker/compose/releases/download/$VERS/docker-compose-Linux-x86_64 \
         -o /usr/bin/docker-compose
    chmod +x /usr/bin/docker-compose

    echo "... done"

    /usr/bin/docker-compose version
}

get_dotfiles() {

    (
        git clone https://github.com/fschl/dotfiles.git "/home/$USERNAME/dotfiles"
        cd "/home/$USERNAME/dotfiles" && make

        git clone https://github.com/fschl/dockerfiles.git "/home/$USERNAME/dockerfiles"

        git clone https://github.com/fschl/.emacs.d.git "/home/$USERNAME/.emacs.d"
    )
}

# install/update golang from source
install_golang() {
    export GO_VERSION=1.6.2
    export GO_SRC=/usr/local/go

    # if we are passing the version
    if [[ ! -z "$1" ]]; then
        export GO_VERSION=$1
    fi

    # subshell because we `cd`
    (
        curl -sSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | sudo tar -v -C /usr/local -xz
    )

    # get commandline tools
    (
        set -x
        set +e
        go get github.com/golang/lint/golint
        go get golang.org/x/tools/cmd/cover
        go get golang.org/x/review/git-codereview
        go get golang.org/x/tools/cmd/goimports
        go get golang.org/x/tools/cmd/gorename

        go get github.com/FiloSottile/vendorcheck
        go get github.com/nsf/gocode
        #done
    )
{'fraction_non_alphanumeric': 0.11785470280118424, 'fraction_numerical': 0.005921202459576406, 'mean_word_length': 1.7149922720247295, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3972131', 'n_tokens_mistral': 3077, 'n_tokens_neox': 2834, 'n_words': 615}