From cb67fb7efab8789e95378b2cd52300394e201543 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Thu, 18 Jul 2019 17:42:11 -0600 Subject: [PATCH] Updated file-structure and transfered data out of local bashrc --- bashcolors => bash/bashcolors.rc | 44 +------------------------------- bash/fun.rc | 20 +++++++++++++++ bash/osx/color-ls.rc | 36 ++++++++++++++++++++++++++ bash/osx/fun.rc | 14 ++++++++++ bash/rentdynamics.rc | 42 ++++++++++++++++++++++++++++++ bash/school.rc | 28 ++++++++++++++++++++ bash/time.rc | 6 +++++ bashrc | 38 ++++++++++++++------------- fun | 1 - 9 files changed, 167 insertions(+), 62 deletions(-) rename bashcolors => bash/bashcolors.rc (72%) create mode 100644 bash/fun.rc create mode 100644 bash/osx/color-ls.rc create mode 100644 bash/osx/fun.rc create mode 100644 bash/rentdynamics.rc create mode 100644 bash/school.rc create mode 100644 bash/time.rc delete mode 100644 fun diff --git a/bashcolors b/bash/bashcolors.rc similarity index 72% rename from bashcolors rename to bash/bashcolors.rc index 3d9addc..5cf6cd7 100644 --- a/bashcolors +++ b/bash/bashcolors.rc @@ -1,46 +1,4 @@ -# ------------------------------------------------------------ -# -- 'ls' colorscheme ------------------------------------------ -# ------------------------------------------------------------ - -# Colors are organized into (Foreground)(Background) bits as seen below: -# ======== -# 1 - Directory -# 2 - Symbolic link -# 3 - Socket -# 4 - Pipe -# 5 - Executable -# 6 - Block special -# 7 - Character special -# 8 - Executable with setgid bit set -# 9 - Executable with setgid bit set -# 10- Directory writable to others, with sticky bit -# 11- Directory writable to others, without sticky bit -# ======== -# a black -# b red -# c green -# d brown -# e blue -# f magenta -# g cyan -# h light grey -# CAPITAL (BOLD) -# x default - -# actual colorscheme -export LSCOLORS="ExxxxxDxBxxxxxxxxxxxxx" - -# for OSX, fixes spacing issues -f_notabs=0 - -# default ls to use defined colorscheme -alias ls='ls -G' - - -# ------------------------------------------------------------ -# -- BASH prompt colorscheme ----------------------------------- -# ------------------------------------------------------------ - +#!/bin/bash # Regular txtblk="$(tput setaf 0 2>/dev/null || echo '\e[0;30m')" # Black txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red diff --git a/bash/fun.rc b/bash/fun.rc new file mode 100644 index 0000000..de9dfdf --- /dev/null +++ b/bash/fun.rc @@ -0,0 +1,20 @@ +#!/bin/bash +alias cheerup="clear; echo; fortune | cowsay -f stegosaurus | lolcat; echo;" + +function pika { + local DIRECTORY="$HOME/Pictures/pika"; + + [ ! -d $DIRECTORY ] && echo "Pikachu directory required." && exit 1; + + # count the pikas + IMAGE_COUNT=$(ls -l $DIRECTORY | wc -l); + let "IMAGE_COUNT=IMAGE_COUNT-1"; + + # pick a random gif from the pikachu directory + IMAGE="$DIRECTORY/$((RANDOM % $IMAGE_COUNT)).gif"; + + echo; + imgcat $IMAGE + echo; +} +alias pikabox='while true; do clear; pika; sleep 120; done' diff --git a/bash/osx/color-ls.rc b/bash/osx/color-ls.rc new file mode 100644 index 0000000..2e9ba69 --- /dev/null +++ b/bash/osx/color-ls.rc @@ -0,0 +1,36 @@ +#!/bin/bash +# Colors are organized into (Foreground)(Background) bits as seen below: +# ======== +# 1 - Directory +# 2 - Symbolic link +# 3 - Socket +# 4 - Pipe +# 5 - Executable +# 6 - Block special +# 7 - Character special +# 8 - Executable with setgid bit set +# 9 - Executable with setgid bit set +# 10- Directory writable to others, with sticky bit +# 11- Directory writable to others, without sticky bit +# ======== +# a black +# b red +# c green +# d brown +# e blue +# f magenta +# g cyan +# h light grey +# CAPITAL (BOLD) +# x default + +# actual colorscheme +export LSCOLORS="ExxxxxDxBxxxxxxxxxxxxx" + +# for OSX, fixes spacing issues +f_notabs=0 + +# default ls to use defined colorscheme +alias ls='ls -G' + + diff --git a/bash/osx/fun.rc b/bash/osx/fun.rc new file mode 100644 index 0000000..4b73d35 --- /dev/null +++ b/bash/osx/fun.rc @@ -0,0 +1,14 @@ +#!/bin/bash +function planktimer() { + # dependencies: 'say' 'termdown' + while true; + do + termdown 1h30m; + clear; + figlet "Plank Time" | lolcat; + say -v $(say -v ? | sed -n "/en_/p" | sed "s/ .*//" | shuf -n 1) "plank time"; + read -n 1; + termdown 65; + say -v $(say -v ? | sed -n "/en_/p" | sed "s/ .*//" | shuf -n 1) "done"; + done +} diff --git a/bash/rentdynamics.rc b/bash/rentdynamics.rc new file mode 100644 index 0000000..d1a48c3 --- /dev/null +++ b/bash/rentdynamics.rc @@ -0,0 +1,42 @@ +#!/bin/bash +RD_PATH='/Users/w0ryn/Documents/RentDynamics'; + +alias rdvmail='VMAIL_HOME=~/.vmail/business1 vmail'; + + +function rnt() { +# filestructure needed: +# RD_PATH/project-name +# > /code (git clone) +# > /env (virtualenv) + deactivate >/dev/null 2>/dev/null || deactivate_node >/dev/null 2>/dev/null; + cd $RD_PATH; + + local cont=0; + [ $1 ] \ + && [ -d $RD_PATH/$1 ] \ + && cd $1 >/dev/null 2>/dev/null \ + || cont=1; + + if [ $cont -eq 0 ]; then + [ -f ./env/bin/activate ] \ + && source ./env/bin/activate \ + || echo No environment here, boss!; + [ -d ./code ] \ + && cd code \ + || echo No source folder here!; + fi +} +_rnt () { # autocompletion + # Set + local cur=${COMP_WORDS[COMP_CWORD]} + COMPREPLY=( $(compgen -W "$(ls $RD_PATH)" -- $cur) ) +} +complete -F _rnt rnt; + +function refresh_rd_db() { + psql postgres -c "DROP DATABASE rentdynamics;" + psql postgres -c "CREATE DATABASE rentdynamics with owner rd;" + psql postgres -c "DROP DATABASE rdrentplus;" + psql postgres -c "CREATE DATABASE rdrentplus with owner rd;" +} diff --git a/bash/school.rc b/bash/school.rc new file mode 100644 index 0000000..49b5cf8 --- /dev/null +++ b/bash/school.rc @@ -0,0 +1,28 @@ +#!/bin/bash + +SCHOOL_DIR="$HOME/Documents/School"; + +# ------------------------------------- +# -- School (Spring 2019) ------------- +# ------------------------------------- +alias school="cd $SCHOOL_DIR"; +alias classes='cat ~/Documents/School/.classes' #'echo \* \(cs2810\) comparch; echo \* \(cs3100\) opsys; echo \* \(cs3450\) softeng; echo \* \(cs5050\) advalgos; echo \* hackusu; echo \* gamenight; echo' +alias comparch='school; cd cs2810-comparch;' +alias cs2810='comparch' +alias opsys='school; cd cs3100-opsys' +alias cs3100='opsys' +alias softeng='school; cd cs3450-softeng' +alias cs3450='softeng' +alias advalgos='school; cd cs5050-advalgos' +alias cs5050='advalgos' + + +HW_TEMPLATE="$DOTWRYN/latex/homework_template.tex" +function hw() { + # Make new homework .tex from default template + [ ! $1 ] && echo "Homework filename required" && exit 1; + + NEW_HW="./$1.tex"; + [ ! -f $NEW_HW ] && cp $HW_TEMPLATE $NEW_HW; + vim $NEW_HW; +} diff --git a/bash/time.rc b/bash/time.rc new file mode 100644 index 0000000..bc3a304 --- /dev/null +++ b/bash/time.rc @@ -0,0 +1,6 @@ +#!/bin/bash +alias datereadable='date +"%A %B %d, %Y"' + +function clock() { + watch -t -n1 "date +'%H : %M : %S' | figlet"; +} diff --git a/bashrc b/bashrc index b799f04..6bae4c4 100644 --- a/bashrc +++ b/bashrc @@ -1,35 +1,37 @@ -RC_DIR="$HOME/.wryn" +#!/bin/bash +DOTWRYN="$HOME/.wryn" +RC_DIR="$DOTWRYN/bash" -# terminal colors -source $RC_DIR/bashcolors -# scripts for fun (see file for dependencies) -source $RC_DIR/fun +# source .wryn/bash files +for file in $(find $RC_DIR -maxdepth 1 -type f); do source $file; done; + +# osx +if [[ "$OSTYPE" == "darwin"* ]]; then + for file in $(find $RC_DIR/osx -type f); do source $file; done; +fi + +# linux +if [[ "$OSTYPE" == "linux-gnu" ]]; then + for file in $(find $RC_DIR/linux -type f); do source $file; done; +fi # --- Welcome message ----------------------------------------- exec figlet "Welcome, beautiful" | lolcat; echo; cowsay -p "damn u sexy" | lolcat; # --- Utility Alias ------------------------------------------- alias restart='clear; source ~/.bashrc; echo' -alias datereadable='date +"%A %B %d, %Y"' # --- !@#$ Aliases -------------------------------------------- alias clera='clear'; +alias sl='sl -alF | lolcat'; # --- Note-taking facilitated --------------------------------- NOTE_PATH='/Users/w0ryn/Documents/notes'; NOTE_EXTENSION='.txt'; alias mynotes='cd $NOTE_PATH'; function note() { vim $NOTE_PATH/$1$NOTE_EXTENSION; } -function notes() { NOTE="$NOTE_PATH/$1$NOTE_EXTENSION"; [ -f $NOTE ] && vim $NOTE || vim $NOTE_PATH; } +function notes() { NOTE="$NOTE_PATH/$1$NOTE_EXTENSION"; [ $1 ] && [ -f $NOTE ] && vim $NOTE || vim $NOTE_PATH; } -# --- Homework facilitated ------------------------------------ -HW_TEMPLATE="$RC_DIR/latex/homework_template.tex" -function hw() { - [ $# -ne 0 ] \ - && NEW_HW="./$1.tex" \ - || echo "Homework filename required" \ - && return; - - [ ! -f $NEW_HW ] && cp $HW_TEMPLATE $NEW_HW; - vim $NEW_HW || echo "Something went wrong :c"; -} +# --- ViM as default editor ----------------------------------- +export EDITOR='vim' +export VISUAL='vim' diff --git a/fun b/fun deleted file mode 100644 index 0acecd0..0000000 --- a/fun +++ /dev/null @@ -1 +0,0 @@ -alias cheerup="clear; echo; fortune | cowsay -f stegosaurus | lolcat; echo;"