aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rw-r--r--bash/Positive.oggbin0 -> 99826 bytes
-rw-r--r--bash/agents.sh10
-rw-r--r--bash/aliases.sh24
-rw-r--r--bash/bash_profile.sh1
-rw-r--r--bash/bashrc.sh28
-rw-r--r--bash/colors.sh228
-rw-r--r--bash/config.sh32
-rw-r--r--bash/env.sh58
-rw-r--r--bash/facepalm/Positive.mp3bin0 -> 59008 bytes
-rw-r--r--bash/facepalm/rotten-apple.sh19
-rw-r--r--bash/fake-symlinks.sh9
-rw-r--r--bash/init.sh7
-rw-r--r--bash/npm.sh13
-rw-r--r--bash/platform.sh9
-rw-r--r--bash/symlinks.sh34
-rwxr-xr-xbash/tmuxinator-templates.sh9
-rw-r--r--bash/util.sh23
-rw-r--r--bash/x.sh6
-rw-r--r--bash/youtube.sh31
19 files changed, 541 insertions, 0 deletions
diff --git a/bash/Positive.ogg b/bash/Positive.ogg
new file mode 100644
index 0000000..22cb563
--- /dev/null
+++ b/bash/Positive.ogg
Binary files differ
diff --git a/bash/agents.sh b/bash/agents.sh
new file mode 100644
index 0000000..8b33b6a
--- /dev/null
+++ b/bash/agents.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+eval "$(thefuck --alias f)"
+
+export GPG_TTY=$(tty)
+
+if [ -n "$DESKTOP_SESSION" ];then
+ eval $(gnome-keyring-daemon --start)
+ export SSH_AUTH_SOCK
+fi
diff --git a/bash/aliases.sh b/bash/aliases.sh
new file mode 100644
index 0000000..dfa5c21
--- /dev/null
+++ b/bash/aliases.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+unalias -a
+
+alias open="xdg-open"
+alias ros="rlwrap ros -l ~/.sbclrc"
+alias l="ls -lahF"
+alias ll="ls -lhF"
+alias yt-dl="youtube-dl -o '$YT_TEMPLATE'"
+alias copy="xclip -sel clip"
+alias pia-vpn="sudo openvpn --config $DOTFILES/VPN/euandreh.ovpn"
+alias git="AWS_ACCESS_KEY_ID=$ANNEX_AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$ANNEX_AWS_SECRET_ACCESS_KEY git"
+
+alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
+alias fim="play $DOTFILES/bash/Positive.ogg &> /dev/null"
+
+alias mux="tmuxinator"
+
+# git
+alias ,s="git status"
+alias ,d="git diff"
+alias ,ds="git diff --staged"
+
+alias ,r="source ~/.bashrc"
diff --git a/bash/bash_profile.sh b/bash/bash_profile.sh
new file mode 100644
index 0000000..12ce7f9
--- /dev/null
+++ b/bash/bash_profile.sh
@@ -0,0 +1 @@
+source ~/annex/dev/code/dotfiles/bash/bashrc.sh
diff --git a/bash/bashrc.sh b/bash/bashrc.sh
new file mode 100644
index 0000000..4a7f189
--- /dev/null
+++ b/bash/bashrc.sh
@@ -0,0 +1,28 @@
+export DOTFILES=~/annex/dev/code/dotfiles
+
+source $DOTFILES/bash/platform.sh
+source $DOTFILES/bash/config.sh
+source $DOTFILES/bash/env.sh
+source $DOTFILES/bash/colors.sh
+source $DOTFILES/bash/aliases.sh
+source $DOTFILES/bash/util.sh
+source $DOTFILES/bash/agents.sh
+source $DOTFILES/bash/symlinks.sh
+source $DOTFILES/bash/youtube.sh
+source $DOTFILES/bash/tmuxinator-templates.sh
+source $DOTFILES/bash/fake-symlinks.sh
+source $DOTFILES/bash/init.sh
+source $DOTFILES/bash/npm.sh
+source $DOTFILES/bash/x.sh
+source $DOTFILES/bash/facepalm/rotten-apple.sh
+source $DOTFILES/encrypted/env.sh
+
+set -h
+source ~/dev/nu/nucli/nu.bashcompletion
+
+# Here's the place to do custom nix-shell config
+if [[ -z $IN_NIX_SHELL ]]; then
+ printf ""
+else
+ printf ""
+fi
diff --git a/bash/colors.sh b/bash/colors.sh
new file mode 100644
index 0000000..7548803
--- /dev/null
+++ b/bash/colors.sh
@@ -0,0 +1,228 @@
+#!/usr/bin/env bash
+
+# Customize BASH PS1 prompt to show current GIT repository and branch.
+# by Mike Stewart - http://MediaDoneRight.com
+
+# SETUP CONSTANTS
+# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
+# I don't remember where I found this. o_O
+
+# Reset
+Color_Off="\[\033[0m\]" # Text Reset
+
+# Regular Colors
+Black="\[\033[0;30m\]" # Black
+Red="\[\033[0;31m\]" # Red
+Green="\[\033[0;32m\]" # Green
+Yellow="\[\033[0;33m\]" # Yellow
+Blue="\[\033[0;34m\]" # Blue
+Purple="\[\033[0;35m\]" # Purple
+Cyan="\[\033[0;36m\]" # Cyan
+White="\[\033[0;37m\]" # White
+
+# Bold
+BBlack="\[\033[1;30m\]" # Black
+BRed="\[\033[1;31m\]" # Red
+BGreen="\[\033[1;32m\]" # Green
+BYellow="\[\033[1;33m\]" # Yellow
+BBlue="\[\033[1;34m\]" # Blue
+BPurple="\[\033[1;35m\]" # Purple
+BCyan="\[\033[1;36m\]" # Cyan
+BWhite="\[\033[1;37m\]" # White
+
+# Underline
+UBlack="\[\033[4;30m\]" # Black
+URed="\[\033[4;31m\]" # Red
+UGreen="\[\033[4;32m\]" # Green
+UYellow="\[\033[4;33m\]" # Yellow
+UBlue="\[\033[4;34m\]" # Blue
+UPurple="\[\033[4;35m\]" # Purple
+UCyan="\[\033[4;36m\]" # Cyan
+UWhite="\[\033[4;37m\]" # White
+
+# Background
+On_Black="\[\033[40m\]" # Black
+On_Red="\[\033[41m\]" # Red
+On_Green="\[\033[42m\]" # Green
+On_Yellow="\[\033[43m\]" # Yellow
+On_Blue="\[\033[44m\]" # Blue
+On_Purple="\[\033[45m\]" # Purple
+On_Cyan="\[\033[46m\]" # Cyan
+On_White="\[\033[47m\]" # White
+
+# High Intensty
+IBlack="\[\033[0;90m\]" # Black
+IRed="\[\033[0;91m\]" # Red
+IGreen="\[\033[0;92m\]" # Green
+IYellow="\[\033[0;93m\]" # Yellow
+IBlue="\[\033[0;94m\]" # Blue
+IPurple="\[\033[0;95m\]" # Purple
+ICyan="\[\033[0;96m\]" # Cyan
+IWhite="\[\033[0;97m\]" # White
+
+# Bold High Intensty
+BIBlack="\[\033[1;90m\]" # Black
+BIRed="\[\033[1;91m\]" # Red
+BIGreen="\[\033[1;92m\]" # Green
+BIYellow="\[\033[1;93m\]" # Yellow
+BIBlue="\[\033[1;94m\]" # Blue
+BIPurple="\[\033[1;95m\]" # Purple
+BICyan="\[\033[1;96m\]" # Cyan
+BIWhite="\[\033[1;97m\]" # White
+
+# High Intensty backgrounds
+On_IBlack="\[\033[0;100m\]" # Black
+On_IRed="\[\033[0;101m\]" # Red
+On_IGreen="\[\033[0;102m\]" # Green
+On_IYellow="\[\033[0;103m\]" # Yellow
+On_IBlue="\[\033[0;104m\]" # Blue
+On_IPurple="\[\033[10;95m\]" # Purple
+On_ICyan="\[\033[0;106m\]" # Cyan
+On_IWhite="\[\033[0;107m\]" # White
+
+# Various variables you might want for your PS1 prompt instead
+Time12h="\T"
+Time12a="\@"
+PathShort="\w"
+PathFull="\W"
+NewLine="\n"
+Jobs="\j"
+
+
+# This PS1 snippet was adopted from code for MAC/BSD I saw from: http://allancraig.net/index.php?option=com_content&view=article&id=108:ps1-export-command-for-git&catid=45:general&Itemid=96
+# I tweaked it to work on UBUNTU 11.04 & 11.10 plus made it mo' better
+
+export PS1='$(if [ $? != 0 ]; then \
+ echo "'$BIRed' (!!) '$Color_Off'"; \
+fi)'$IBlack$Time12h$Color_Off' '$BYellow$PathShort/$Color_Off'\
+$(git branch &>/dev/null;\
+if [ $? -eq 0 ]; then \
+ echo "$(echo `git status` | grep "Changes" > /dev/null 2>&1; \
+ if [ "$?" != "0" ]; then \
+ # @4 - Clean repository - nothing to commit
+ echo "'$Green'"$(__git_ps1 " (%s)")"'$Color_Off'"; \
+ else \
+ # @5 - Changes to working tree
+ echo "'$IRed'"$(__git_ps1 " {%s}")"'$Color_Off'"; \
+ fi)" - $(echo "'$IBlack'"`git sha | head -c 7`"'$Color_Off'"); \
+fi)$(if [[ $IN_NIX_SHELL == 1 ]]; then\
+ echo "\n'$IBlack'~>'$Color_Off' '$Purple'nix-shell'$Color_Off' ('$BIBlue'$name'$Color_Off')'$Color_Off'" ;\
+fi)$(echo "\n'$BIPurple'\$'$Color_Off' ";)'
+
+
+export end="\033[0m"
+export black="\033[0;30m"
+export blackb="\033[1;30m"
+export white="\033[0;37m"
+export whiteb="\033[1;37m"
+export red="\033[0;31m"
+export redb="\033[1;31m"
+export green="\033[0;32m"
+export greenb="\033[1;32m"
+export yellow="\033[0;33m"
+export yellowb="\033[1;33m"
+export blue="\033[0;34m"
+export blueb="\033[1;34m"
+export purple="\033[0;35m"
+export purpleb="\033[1;35m"
+export lightblue="\033[0;36m"
+export lightblueb="\033[1;36m"
+
+function black {
+ echo -e "${black}${1}${end}"
+}
+export -f black
+
+function blackb {
+ echo -e "${blackb}${1}${end}"
+}
+export -f blackb
+
+function white {
+ echo -e "${white}${1}${end}"
+}
+export -f white
+
+function whiteb {
+ echo -e "${whiteb}${1}${end}"
+}
+export -f whiteb
+
+function red {
+ echo -e "${red}${1}${end}"
+}
+export -f red
+
+function redb {
+ echo -e "${redb}${1}${end}"
+}
+export -f redb
+
+function green {
+ echo -e "${green}${1}${end}"
+}
+export -f green
+
+function greenb {
+ echo -e "${greenb}${1}${end}"
+}
+export -f greenb
+
+function yellow {
+ echo -e "${yellow}${1}${end}"
+}
+export -f yellow
+
+function yellowb {
+ echo -e "${yellowb}${1}${end}"
+}
+export -f yellowb
+
+function blue {
+ echo -e "${blue}${1}${end}"
+}
+export -f blue
+
+function blueb {
+ echo -e "${blueb}${1}${end}"
+}
+export -f blueb
+
+function purple {
+ echo -e "${purple}${1}${end}"
+}
+export -f purple
+
+function purpleb {
+ echo -e "${purpleb}${1}${end}"
+}
+export -f purpleb
+
+function lightblue {
+ echo -e "${lightblue}${1}${end}"
+}
+export -f lightblue
+
+function lightblueb {
+ echo -e "${lightblueb}${1}${end}"
+}
+export -f lightblueb
+
+function ,colors {
+ black "black"
+ blackb "blackb"
+ white "white"
+ whiteb "whiteb"
+ red "red"
+ redb "redb"
+ green "green"
+ greenb "greenb"
+ yellow "yellow"
+ yellowb "yellowb"
+ blue "blue"
+ blueb "blueb"
+ purple "purple"
+ purpleb "purpleb"
+ lightblue "lightblue"
+ lightblueb "lightblueb"
+}
diff --git a/bash/config.sh b/bash/config.sh
new file mode 100644
index 0000000..26ef085
--- /dev/null
+++ b/bash/config.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+# ~/.bashrc: executed by bash(1) for non-login shells.
+
+# derived from Ubuntu's default .bashrc
+
+
+# If not running interactively, don't do anything
+case $- in
+ *i*) ;;
+ *) return;;
+esac
+
+# don't put duplicate linesin the history. # See bash(1) for more options
+HISTCONTROL=ignoredups
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=1000000
+HISTFILESIZE=2000000
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+isLinux && {
+ shopt -s globstar
+}
diff --git a/bash/env.sh b/bash/env.sh
new file mode 100644
index 0000000..ad930f7
--- /dev/null
+++ b/bash/env.sh
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+
+
+export PATH="$HOME/annex/bin/:$PATH"
+
+#
+# Git Annex
+#
+
+export RSYNC_NET_URL=16686@ch-s010.rsync.net
+export R=$RSYNC_NET_URL
+
+
+#
+# Perl6
+#
+
+export PATH=~/.rakudobrew/bin:$PATH
+
+
+#
+# Haskel Stack
+#
+
+export PATH=~/.local/bin:$PATH
+
+
+
+#
+# Misc
+#
+
+export EDITOR=vi
+export PATH="$HOME/dev/code/dotfiles/scripts/:$PATH"
+export YT_TEMPLATE="~/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s"
+export INPUTRC=~/.inputrc
+
+
+
+#
+# Global (not NixOS) NPM
+#
+
+export PATH="$HOME/.npm-packages/bin/:$PATH"
+
+
+
+#
+# NixOS
+#
+
+export SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
+
+#
+# Leiningen
+#
+
+export LEIN_SUPPRESS_USER_LEVEL_REPO_WARNINGS=1
diff --git a/bash/facepalm/Positive.mp3 b/bash/facepalm/Positive.mp3
new file mode 100644
index 0000000..a560be1
--- /dev/null
+++ b/bash/facepalm/Positive.mp3
Binary files differ
diff --git a/bash/facepalm/rotten-apple.sh b/bash/facepalm/rotten-apple.sh
new file mode 100644
index 0000000..0cdf329
--- /dev/null
+++ b/bash/facepalm/rotten-apple.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+isMac && {
+ unalias open
+
+ alias limpar-derived-data="rm -rf ~/Library/Developer/Xcode/DerivedData/"
+ alias fim="afplay $DOTFILES/bash/facepalm/Positive.mp3"
+
+ if [ -f $(brew --prefix)/etc/bash_completion ]; then
+ . $(brew --prefix)/etc/bash_completion
+ fi
+
+ [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
+
+ [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
+
+
+ alias ast="open -a \"Android Studio\""
+}
diff --git a/bash/fake-symlinks.sh b/bash/fake-symlinks.sh
new file mode 100644
index 0000000..cd9dc6a
--- /dev/null
+++ b/bash/fake-symlinks.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+if [[ -n "$EMACS_GITHUB_TOKEN" ]]; then
+ cat $DOTFILES/git/gitconfig.ini | envsubst > ~/.gitconfig
+fi
+
+cp $DOTFILES/gitlab-ci.yml $DOTFILES/../org.euandre.misc/.gitlab-ci.yml
+cp $DOTFILES/gitlab-ci.yml $DOTFILES/../org.euandre.http/.gitlab-ci.yml
+cp $DOTFILES/gitlab-ci.yml $DOTFILES/../org.euandre.om-auth/.gitlab-ci.yml
diff --git a/bash/init.sh b/bash/init.sh
new file mode 100644
index 0000000..2239015
--- /dev/null
+++ b/bash/init.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+pushd ~/ > /dev/null
+
+mr checkout > /dev/null
+
+popd > /dev/null
diff --git a/bash/npm.sh b/bash/npm.sh
new file mode 100644
index 0000000..f0a5d30
--- /dev/null
+++ b/bash/npm.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+npm_i() {
+ (which $1 &> /dev/null) || {
+ yellow "Installing $2"
+ npm i -g $2
+ }
+}
+
+npm_i eq edn-eq
+npm_i react-native react-native-cli
+npm_i detox detox-cli
+npm_i xml2json xml2json-command
diff --git a/bash/platform.sh b/bash/platform.sh
new file mode 100644
index 0000000..4929341
--- /dev/null
+++ b/bash/platform.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+isMac () {
+ [[ `uname` == 'Darwin' ]]
+}
+
+isLinux () {
+ [[ `uname` == 'Linux' ]]
+}
diff --git a/bash/symlinks.sh b/bash/symlinks.sh
new file mode 100644
index 0000000..ccdf4a6
--- /dev/null
+++ b/bash/symlinks.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+ln -fs $DOTFILES/encrypted/borg ~/.config/
+
+ln -fs $DOTFILES/bash/bashrc.sh ~/.bashrc
+ln -fs $DOTFILES/bash/bash_profile.sh ~/.bash_profile
+ln -fs $DOTFILES/spacemacs.el ~/.spacemacs
+ln -fs $DOTFILES/git/gitattributes ~/.gitattributes
+ln -fs $DOTFILES/git/gitignore ~/.gitignore_global
+ln -fs $DOTFILES/git/bash_git.sh ~/.bash_git
+ln -fs $DOTFILES/sbclrc.lisp ~/.sbclrc
+ln -fs $DOTFILES/inputrc.conf ~/.inputrc
+ln -fs $DOTFILES/nixos/npmrc.sh ~/.npmrc
+
+ln -fs $DOTFILES/git/mrconfig.ini ~/.mrconfig
+
+ln -fs /run/media/andreh/UTCLOUD ~/UTCLOUD
+
+mkdir -p ~/.lein
+ln -fs $DOTFILES/lein/profiles.clj ~/.lein/profiles.clj
+
+ln -fs $DOTFILES/Xmodmap.conf ~/.Xmodmap
+
+ln -fs $DOTFILES/tmux/tmux.conf ~/.tmux.conf
+
+## xmonad
+mkdir -p ~/.xmonad
+ln -fs $DOTFILES/xmonad/xsession.sh ~/.xsession
+ln -fs $DOTFILES/xmonad/xmonad.hs ~/.xmonad/xmonad.hs
+ln -fs $DOTFILES/xmonad/xmobar.hs ~/.xmobarrc
+
+## OfflineIMAP
+# ln -fs $DOTFILES/mail/offlineimaprc.ini ~/.offlineimaprc
+# ln -fs $DOTFILES/mail/mbsyncrc.ini ~/.mbsyncrc
diff --git a/bash/tmuxinator-templates.sh b/bash/tmuxinator-templates.sh
new file mode 100755
index 0000000..77cf461
--- /dev/null
+++ b/bash/tmuxinator-templates.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+mkdir -p ~/.tmuxinator
+
+templates=(annex pires songbooks sosps)
+
+for template in ${templates[@]}; do
+ cp $DOTFILES/tmux/projects/$template.yml ~/.tmuxinator/$template.yml
+done
diff --git a/bash/util.sh b/bash/util.sh
new file mode 100644
index 0000000..b0db4ad
--- /dev/null
+++ b/bash/util.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+extract () {
+ if [ -f $1 ] ; then
+ case $1 in
+ *.tar.bz2) tar xvjf $1 ;;
+ *.tar.gz) tar xvzf $1 ;;
+ *.bz2) bunzip2 $1 ;;
+ *.rar) unrar x $1 ;;
+ *.gz) gunzip $1 ;;
+ *.tar) tar xvf $1 ;;
+ *.tbz2) tar xvjf $1 ;;
+ *.tgz) tar xvzf $1 ;;
+ *.zip) unzip $1 ;;
+ *.Z) uncompress $1 ;;
+ *.7z) 7z x $1 ;;
+ *.xz) unxz $1 ;;
+ *) echo "don't know how to extract '$1'..." ;;
+ esac
+ else
+ echo "'$1' is not a valid file!"
+ fi
+}
diff --git a/bash/x.sh b/bash/x.sh
new file mode 100644
index 0000000..5858d1f
--- /dev/null
+++ b/bash/x.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+isLinux && {
+ xmodmap ~/.Xmodmap
+ xset r rate 250 50
+}
diff --git a/bash/youtube.sh b/bash/youtube.sh
new file mode 100644
index 0000000..b64300d
--- /dev/null
+++ b/bash/youtube.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+export DEFAULT_PLAYLIST_END=15
+
+download() {
+ youtube-dl "$1" \
+ --download-archive ~/annex/txt/youtube-dl-seen.conf \
+ --prefer-free-formats \
+ --playlist-end $2 \
+ --output "~/Downloads/yt-dl/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"
+}
+
+export -f download
+
+download_user() {
+ download "https://www.youtube.com/user/$1" ${2-$DEFAULT_PLAYLIST_END}
+}
+
+export -f download_user
+
+download_channel() {
+ download "https://www.youtube.com/channel/$1" ${2-$DEFAULT_PLAYLIST_END}
+}
+
+export -f download_channel
+
+download_playlist() {
+ download "https://www.youtube.com/playlist?list=$1" ${2-$DEFAULT_PLAYLIST_END}
+}
+
+export -f download_playlist