From 27a5a9c401bc61972bb74fa754c3b09b19d0f083 Mon Sep 17 00:00:00 2001
From: MB <michael.blaschek@univie.ac.at>
Date: Mon, 3 May 2021 14:09:25 +0200
Subject: [PATCH] add bash stuff

---
 .gitignore     |  1 +
 Misc/README.md | 32 ++++++++++++++++++
 Misc/bashrc    | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 Misc/inputrc   | 32 ++++++++++++++++++
 4 files changed, 155 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Misc/README.md
 create mode 100644 Misc/bashrc
 create mode 100644 Misc/inputrc

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0021961
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+testing/*
diff --git a/Misc/README.md b/Misc/README.md
new file mode 100644
index 0000000..5866299
--- /dev/null
+++ b/Misc/README.md
@@ -0,0 +1,32 @@
+# Miscellaneous Topics	
+
+[[_TOC_]]
+
+## Customize your shell
+On a Linux system there are numerous ways of customizing user experience. And of course there is a way to customize the shell. It should be common by now, that people use [BASH](https://de.wikipedia.org/wiki/Bash_(Shell)), if not run `chsh -s /bin/bash` in your terminal and if you are not sure run `echo $SHELL` wich should show bash.
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Gnu-bash-logo.svg/216px-Gnu-bash-logo.svg.png)
+
+The main files to make your shell unique is to edit two files:
+
+- `.bashrc` - Main configuration file for each terminal, as oposed to `.bash_profile` that is only loaded when you first login.
+- `.inputrc` - Configuration file for keybaord shortcuts
+
+Please find examples of these two files here [bashrc](./bashrc) [inputrc](./inputrc). Please adjust these files to your needs. Some parts are only available on special systems.
+
+
+## Q: How to extract a table from a PDF?
+
+There is a tool for investigative reporting at news organizations, that developed this tool.  [Got to tabula](https://tabula.technology/)
+
+### How to Use Tabula
+
+1. run tabula depending on your OS and got to http://localhost:8080
+2. Upload a PDF file containing a data table.
+3. Browse to the page you want, then select the table by clicking and dragging to draw a box around the table.
+4. Click "Preview & Export Extracted Data". Tabula will try to extract the data and display a preview. Inspect the data to make sure it looks correct. If data is missing, you can go back to adjust your selection.
+5. Click the "Export" button.
+6. Now you can work with your data as text file or a spreadsheet rather than a PDF
+
+Note: Tabula only works on text-based PDFs, not scanned documents.
+
diff --git a/Misc/bashrc b/Misc/bashrc
new file mode 100644
index 0000000..1c280f8
--- /dev/null
+++ b/Misc/bashrc
@@ -0,0 +1,90 @@
+# BASH configuration file
+# By MB
+# some examples / options 
+
+# Source global definitions
+if [ -f /etc/bashrc ]; then
+	. /etc/bashrc
+fi
+
+# HISTORY
+#
+# don't put duplicate lines in the history. See bash(1) for more options
+# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
+export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
+# ... or force ignoredups and ignorespace
+export HISTCONTROL=ignoreboth:erasedups
+export HISTIGNORE='&:ls:ll:cd ~:cd ..:[bf]g:exit:h:history'
+# append to the history file, don't overwrite it
+shopt -s histappend
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+export HISTSIZE=2000
+export HISTFILESSIZE=2000
+export PROMPT_COMMAND="history -a"        # update histfile after every command
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+    alias ls='ls --color=auto -h --group-directories-first'
+    alias dir='dir --color=auto'
+    #alias vdir='vdir --color=auto'
+
+    alias grep='grep --color=auto'
+    alias fgrep='fgrep --color=auto'
+    alias egrep='egrep --color=auto'
+fi
+# some more ls aliases
+alias ll='ls -l'
+alias la='ls -A'
+alias l='ls -CF'
+alias ...="cd ../.."    #go to grandparent dir
+alias -- -="cd -"       #go to previous dir
+alias l.='ls -d .*'     #list hidden files
+
+# PATHs
+export PATH=${PATH}:${HOME}/bin     # add ./bin directory
+export PATH=${PATH}:${HOME}/.local/bin      # add .local/bin
+
+# Python / Anaconda
+# use your favorite python
+# module show anaconda3 - use PATH
+# or which python3
+PYTHONROOT=
+if [ -f "${PYTHONROOT}/etc/profile.d/conda.sh" ]; then
+    # Sourcing this, is similar to conda init
+    . "${PYTHONROOT}/etc/profile.d/conda.sh"
+else
+    export PATH="${PYTHONROOT}/bin:$PATH"
+fi
+# do not generate .pyc files
+export PYTHONDONTWRITEBYTECODE=1
+
+# Define your favorite editor
+# /usr/bin/nano
+export EDITOR=/usr/bin/vim
+# Define your language
+# run locale 
+# export LANG=en_US.UTF-8
+
+# User Limits
+ulimit -u 10000  # max user processes 1024
+
+# Limit number of Threads
+# export MKL_NUM_THREADS=1
+# export NUMEXPR_NUM_THREADS=1
+export OMP_NUM_THREADS=4  # OpenMP Threads
+
+
+# Special Modifications 
+## environmental modules
+export MODULES_PAGER=cat  # or less 
+# Alias for JET to show running user services
+alias running_services='systemctl list-units --user --type=service'
+  
\ No newline at end of file
diff --git a/Misc/inputrc b/Misc/inputrc
new file mode 100644
index 0000000..3dbd72a
--- /dev/null
+++ b/Misc/inputrc
@@ -0,0 +1,32 @@
+# https://en.wikipedia.org/wiki/ANSI_escape_code
+# use cursor up/down to search in history
+"\e[B": history-search-forward
+"\e[A": history-search-backward
+# pos1, home
+"\e[1~": beginning-of-line
+# end 
+"\e[4~": end-of-line
+# page up/down
+#"\e[5~": history-search-backward
+#"\e[6~": history-search-forward
+# backward delete
+"\e[3~": delete-char
+# insert
+"\e[2~": quoted-insert
+# ctrl + cursors (forward / backward)
+"\e[5C": forward-word
+"\e[5D": backward-word
+"\e\e[C": forward-word
+"\e\e[D": backward-word
+#
+# some general options for inputrc
+#
+set completion-ignore-case On
+set show-all-if-ambiguous on
+set completion-query-items 350
+set page-completions off
+set match-hidden-files off
+
+# Include system wide settings which are ignored
+# by default if one has their own .inputrc
+$include /etc/inputrc
-- 
GitLab