48 Commits

Author SHA1 Message Date
1d8ec5e402 added aliases alias 2025-03-29 19:24:33 +01:00
8d37dfd5ad added function to display fingerprint in pubkey command 2024-09-05 16:31:56 +02:00
bea9c85c9a added taglist alias and tagpush functions 2024-03-24 10:00:30 +01:00
0eb28cf6cc added ability to dynamically source files from file in home directory
added explanation and example in README.md
2024-03-24 09:50:29 +01:00
3c9736d165 added clarifications in README.md 2024-03-24 09:43:01 +01:00
759f0c9494 added user, password & container name to samba server, added alias to stop samba server 2024-03-24 06:03:51 +01:00
39cb410c3e added check for git command presence to enable git functions in terminal fancyfying 2023-12-19 16:56:06 +01:00
d792ce8809 fixed bashrc, removed variable, not working 2023-12-19 16:54:37 +01:00
dc984eb128 removed network host from sambaserver, fixed samba options 2023-12-17 12:33:18 +01:00
5d6c22f1b8 added infinitenothing alias 2023-12-17 12:32:32 +01:00
c53a382a4f fixed typo in bashrc path, variabilized bashrc path 2023-12-14 15:13:51 +01:00
bcaffe612c fixed move function in deploy.sh 2023-12-14 15:07:11 +01:00
391b85bea5 fixed new fancyfy scheme in deploy.sh 2023-12-14 15:02:45 +01:00
e24f3337a1 fixed terminal_fancyfy not working for server
excluded fancyfy from source in for loop
added sourcing only the correct file
2023-12-14 14:24:21 +01:00
fdb5d070e4 moved from static list of file to include to for cycle 2023-12-12 15:47:25 +01:00
ab8821aa4c fixed typo, updated variable fancyfy 2023-12-12 14:50:24 +01:00
4833a0a72e added dockerpull alias 2023-12-12 14:47:22 +01:00
761f7cf482 updated docker logs aliases 2023-12-12 14:46:33 +01:00
fd349baa99 variabilized terminal fancifying (client/server) 2023-12-12 14:45:02 +01:00
3c4e7d7858 added nocomments alias
removes comments from file and prints the rest
2023-10-02 14:38:23 +02:00
756bfbc542 added convenience alias 'sshfingerprint' 2023-03-31 20:25:47 +02:00
d235ac670d removed leading underscore in public key name echo 2022-09-12 16:35:29 +02:00
3a1f00ae34 neated the output of "pubkey" alias 2022-09-03 19:22:12 +02:00
8a87db917d added sshagent alias 2022-08-21 16:33:25 +02:00
dc2300b9cb added docker aliases 2022-08-21 16:22:16 +02:00
464b77caa4 moved to variabilized home in acme.sh alias 2022-08-21 16:19:30 +02:00
74d4d88ac6 added bashrc refresh alias 2022-08-03 08:24:25 +02:00
42c11470b9 moved to *any* type public key
preparing for ED25519 key
2022-08-03 08:23:08 +02:00
ae3732ebbb added acme.sh alias 2022-08-03 08:22:13 +02:00
1c41cd039d fixed dnsversion alias 2022-04-02 16:03:11 +02:00
799af1f6a1 added dnsversion alias
to check remote servers
2022-04-02 16:01:21 +02:00
c51a067dda removed blinking of cursor 2022-04-02 16:00:37 +02:00
8a8f304c1c fix sourcing paths, use relatives 2022-02-10 18:12:27 +01:00
ead9cb0d71 added new ansible workspace alias 2022-02-10 17:41:29 +01:00
6dd1d386d1 fixed sed path in server customization 2022-02-10 16:33:07 +01:00
9c4db7fef6 added revert server to client bash customization 2022-02-10 16:22:29 +01:00
fe4a896ada removed force option, not needed anymore 2022-02-10 16:19:35 +01:00
c33ae90b33 fixed reference in ~/.bashrc 2022-02-10 16:08:13 +01:00
09cf9b8bbe added delete and move functions 2022-02-10 16:05:04 +01:00
2913920987 removed copying functions, no need anymore 2022-02-10 15:58:07 +01:00
ee267c0c50 moved from copying the settings to using them in place 2022-02-10 15:58:07 +01:00
6179e8d809 removed cleanup function 2022-02-10 15:58:07 +01:00
e8f69fbbad added sshconfig alias 2022-01-03 10:13:49 +01:00
53752a866e added termbin alias 2021-08-18 11:42:16 +02:00
a4885fa060 added forced update method, do not use now (UNTESTED) 2021-08-15 14:44:02 +02:00
627282b2cc added newlines for better formatting, may the Force of better explanation be with you 2021-08-15 14:37:41 +02:00
a8eaab7e81 added sambashare convenience alias, updated README.md with usage documentation section 2021-07-18 18:41:56 +02:00
6b2dded19a updated README.md
not actually KDE-related, just Linux in general
2021-07-17 16:09:01 +02:00
8 changed files with 158 additions and 54 deletions

View File

@@ -1,4 +1,27 @@
# personal-kde-config
Personal KDE and other Linux-related configs to help me succeed in life (or at least simplify it).
# Personal Linux config
Personal Linux-related configs to help me succeed in life (or at least simplify it).
Feel free to try this out, or even add "cool stuff" to help each other out!
Feel free to try or poke around in the source (it's all human-readable bash), or heck even add "cool stuff" to help each other out!
## Usage
Explaining section for not-so-intuitive configurations
- alias `sambaserver`: (¡requires Docker!) please `cd` into the directoy is needed to be shared and execute `sambaserver`, then just login with default username `user` and the default password `P4ssw0rd` with the host computer as URL/IP, autodiscovery of both the host and the share was tested working on Windows and a Samsung Tablet.
- alias `sambastop`: (¡requires Docker!) when you're finished, this command stops and removes the samba container.
- alias `termbin`: (¡requires Netcat!) use when piping a cat/echo/file/etc to upload to termbin.com
## Modular sourcing mechanism
Create a file in your home directory called `~/.bash_sources`, and put a script path on every line of this file, it will be sourced automatically.<br>
WARNING: it has to be a full path, for example `/path/to/script.sh` and not abbreviated (as in `~/script.sh`)... idk bash decided like so.<br>
WARNING 2: every line needs to be a path to a file, not a direct command, sourcing a file is possible; souring an "export" or a function... not so much!
#### For example:
`/home/user/.bash_sources`:
```bash
/home/user/.bash_path
/path/to/some/other/script.sh
```
`/home/user/.bash_path`:
```bash
export PATH=~/bin/myproject/bin:$PATH
```

View File

@@ -1,13 +1,15 @@
for source in colored_commands \
convenience_aliases \
git_functions \
histcontrol \
home_bin_folder \
ls_aliases \
safety_aliases \
terminal_colors \
terminal_fancyfying; do
if [ -f ~/.bashrc_overrides/$source ]; then
. ~/.bashrc_overrides/$source
fi
# Source all the overrides in this folder
for source in $(find "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -type f | grep -Ev "_all|terminal_fancyfying"); do
. "${source}"
done
. "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/terminal_fancyfying_${TERMINAL_FANCYFY}"
# If the file ~/.bash_sources exist, source every line it contains
if [ -f ~/.bash_sources ]; then
while IFS= read -r line; do
# Skip empty lines and comments (#)
if [ -n "$line" ] && ! [[ "$line" == \#* ]]; then
. "$line"
fi
done < ~/.bash_sources
fi

View File

@@ -1,4 +1,19 @@
alias pubkey='cat ~/.ssh/id_rsa.pub'
alias pubkey='for PUBKEY_FILE in $(ls ~/.ssh/id_*.pub); do echo "${PUBKEY_FILE} :" | sed -e "s/.*id_//;s/\.pub//"; cat "${PUBKEY_FILE}"; ssh-keygen -lf "${PUBKEY_FILE}" -E sha256; echo; done'
alias taglist='git tag | tr - \~ | sort -V | tr \~ -'
alias hosts='sudo nano /etc/hosts'
alias historygrep='history | grep'
alias sshconfig='nano ~/.ssh/config'
alias aliases='nano ~/.bash_aliases'
alias bashrc='. ~/.bashrc'
alias sshagent='eval `ssh-agent` && ssh-add ~/.ssh/id_!(*.pub)'
alias sshfingerprint='ssh-keygen -lf'
alias nocomments='grep -vE "^$|^#|^;"'
alias newrepo='bash <(curl -s https://get.bjphoster.com/new-git-repo.sh)'
alias newansibleworkspace='bash <(curl -s https://get.bjphoster.com/new-ansible-workspace.sh)'
alias infinitenothing='while true; do sleep 1; done'
alias sambaserver='docker run -dit --rm --name sambaserver -p 137:137 -p 138:138 -p 139:139 -p 445:445 -v `pwd`:/share dperson/samba -n -p -u "user;P4ssw0rd" -s "share;/share;yes;no;yes;user;user" -w "WORKGROUP"'
alias sambastop='docker stop sambaserver; docker rm sambaserver'
alias acme.sh='docker run -it --rm -v ~/acme.sh:/acme.sh neilpang/acme.sh'
alias termbin='nc termbin.com 9999'
alias dnsversion='dig txt chaos version.bind'

View File

@@ -0,0 +1,9 @@
alias dockerpull='docker compose pull'
alias dockerup='docker compose up'
alias dockerupd='docker compose up -d'
alias dockerdown='docker compose down'
alias dockerdownv='docker compose down --volumes'
alias dockerlogs='docker compose logs'
alias dockerlogsf='docker compose logs --follow'
alias dockerlogst='docker compose logs --tail=10'
alias dockerlogstf='docker compose logs --tail=10 --follow'

View File

@@ -21,3 +21,16 @@ __git_prompt() {
__git_history() {
echo "$(git log --oneline | cut -d ' ' -f 1)"
}
tagpush() {
if [ -z "$1" ]; then
echo "Usage: tagpush <tag>"
return
fi
git tag "$1"
# for every remote
for REMOTE in $(git remote) ; do
# push current branch and newly created tag
git push "$REMOTE" $(git branch | grep "*" | sed 's/\* //') "$1"
done
}

View File

@@ -1,4 +1,7 @@
GIT_FUNCTIONS=true
command -v git &>/dev/null
if [ $? -eq 0 ]; then
GIT_FUNCTIONS=true
fi
# Spaced
#PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) "
@@ -7,10 +10,10 @@ GIT_FUNCTIONS=true
# another version I really like
PS1="${PURPLE}\# ${LIGHTBLUE}{${LIGHTGREEN}\u${BROWN}@${LIGHTGREEN}\$(hostname --fqdn)${LIGHTBLUE}} ${LIGHTPURPLE}[${CYAN}\w${LIGHTPURPLE}] "
if [ $GIT_FUNCTIONS ]; then
if [ $GIT_FUNCTIONS = "true" ]; then
#PS1="$PS1${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]"
PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) "
fi
#PS1="$PS1${RED}#${FORMAT_RESET}"
PS1="$PS1${RED}${FORMAT_BLINK}\$${FORMAT_RESET}"
PS1="$PS1${RED}\$${FORMAT_RESET}"

View File

@@ -1,11 +1,14 @@
GIT_FUNCTIONS=true
command -v git &>/dev/null
if [ $? -eq 0 ]; then
GIT_FUNCTIONS=true
fi
# Spaced
#PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) "
# Not spaced
PS1="${LIGHTBLUE}[${LIGHTRED}\u${LIGHTBLUE}@${LIGHTBROWN}$(hostname --fqdn)${LIGHTBLUE}]${LIGHTPURPLE}(${GREEN}\w${LIGHTPURPLE})"
if [ $GIT_FUNCTIONS ]; then
if [ $GIT_FUNCTIONS = "true" ]; then
#PS1="$PS1${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]"
PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) "
fi

102
deploy.sh
View File

@@ -1,18 +1,32 @@
#!/usr/bin/env bash
THIS="$(dirname "$(readlink -fm "$0")")"
SERVER=false
FORCE=false
CLEANUP=false
FANCYFY="client"
CURRENT_FANCYFY=""
DELETE=false
MOVE=false
PRESENT=false
_bashrc_present() {
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
echo true
exit
fi
echo false
}
_arguments() {
if [ "$(_bashrc_present)" = true ]; then
PRESENT=true
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY ~/.bashrc | sed 's/.*=//')"
fi
for PARM in "$@"; do
if [ "${PARM}" = "--server" ]; then
SERVER=true
elif [ "${PARM}" = "--force" ]; then
FORCE=true
elif [ "${PARM}" = "--cleanup" ]; then
CLEANUP=true
FANCYFY="server"
elif [ "${PARM}" = "--delete" ]; then
DELETE=true
elif [ "${PARM}" = "--move" ]; then
MOVE=true
elif [ "${PARM}" = "-h" ] || [ "${PARM}" = "--help" ]; then
_help
exit 0
@@ -24,45 +38,67 @@ _help() {
echo "Usage: $(readlink -fm "$0") [-h | --help] [--cleanup]"
echo
echo "Options:"
echo " -h | --help : Prints this help message and quits"
echo " --server: Customizes the terminal feel for a server installation"
echo " --cleanup: Removes the source folder after installation"
echo " -h | --help"
echo " Prints this help message and quits"
echo " --force"
echo " Force the reinstallation of the files"
echo " --delete"
echo " Delete the reference in ${BASHRC}"
echo " --move"
echo " Create a new reference if the location of this folder has been changed"
echo " --server"
echo " Customizes the terminal feel for a server installation"
echo
}
_bash_overrides() {
cp -r bashrc_overrides ~/.bashrc_overrides
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
echo "if [ -f ~/.bashrc_overrides/_all ]; then" >> ~/.bashrc
echo " . ~/.bashrc_overrides/_all" >> ~/.bashrc
echo "fi" >> ~/.bashrc
_delete() {
sed -i '/REF:bashrc_overrides:REF/{N;N;d}' ~/.bashrc
}
_cleanup() {
rm -rf ${THIS}
_bashrc_ref() {
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
echo "export TERMINAL_FANCYFY=${1}" >> ~/.bashrc
echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc
}
_move() {
_delete
_bashrc_ref "${FANCYFY}"
}
_main() {
_arguments "$@"
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ] && [ "${FORCE}" = false ]; then
echo "bash overrides already in place"
echo "skipping..."
echo
if [ "${DELETE}" = true ]; then
_delete
echo "removed custom configs"
elif [ "${MOVE}" = true ]; then
if [ "${PRESENT}" = false ]; then
_bashrc_ref "${FANCYFY}"
echo "unable to move to current directory"
echo "bash overrides not previously present"
echo "adding bash overrides..."
echo
else
_move
echo "moved custom config directory to ${THIS}"
echo
fi
elif [ "${PRESENT}" = true ]; then
if [ "${CURRENT_FANCYFY}" != "${FANCYFY}" ]; then
sed -i "s/TERMINAL_FANCYFY=${CURRENT_FANCYFY}/TERMINAL_FANCYFY=${FANCYFY}/" ~/.bashrc
echo "customized fancyfying"
echo
else
echo "bash overrides already in place"
echo "skipping..."
echo
fi
else
_bash_overrides
_bashrc_ref "${FANCYFY}"
echo "bash overrides added"
echo
fi
if [ "${SERVER}" = true ]; then
sed -i 's/terminal_fancyfying/terminal_fancyfying_server/' ~/.bashrc_overrides/_all
fi
if [ "${CLEANUP}" = true ]; then
echo "cleaning up..."
_cleanup
fi
}
_main "$@"