You've already forked personal-linux-config
							
							Compare commits
	
		
			27 Commits
		
	
	
		
			799af1f6a1
			...
			0.8.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0eb28cf6cc | |||
| 3c9736d165 | |||
| 759f0c9494 | |||
| 39cb410c3e | |||
| d792ce8809 | |||
| dc984eb128 | |||
| 5d6c22f1b8 | |||
| c53a382a4f | |||
| bcaffe612c | |||
| 391b85bea5 | |||
| e24f3337a1 | |||
| fdb5d070e4 | |||
| ab8821aa4c | |||
| 4833a0a72e | |||
| 761f7cf482 | |||
| fd349baa99 | |||
| 3c4e7d7858 | |||
| 756bfbc542 | |||
| d235ac670d | |||
| 3a1f00ae34 | |||
| 8a87db917d | |||
| dc2300b9cb | |||
| 464b77caa4 | |||
| 74d4d88ac6 | |||
| 42c11470b9 | |||
| ae3732ebbb | |||
| 1c41cd039d | 
							
								
								
									
										21
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								README.md
									
									
									
									
									
								
							| @@ -6,5 +6,22 @@ Feel free to try or poke around in the source (it's all human-readable bash), or | |||||||
| ## Usage | ## Usage | ||||||
| Explaining section for not-so-intuitive configurations | Explaining section for not-so-intuitive configurations | ||||||
|  |  | ||||||
| - alias `sambaserver`: please `cd` into the directoy is needed to be shared and execute `sambaserver` followed by `"shareuser;<SUBSTITUTE-YOUR-PASSWORD-HERE>"`, then just login with username `shareuser` and the provided password 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 `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 `termbin`: use when piping a cat/echo/file/etc to upload to termbin.com (¡requires Netcat!) | - 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 | ||||||
|  | ``` | ||||||
|   | |||||||
| @@ -1,11 +1,15 @@ | |||||||
| for source in colored_commands \ | # Source all the overrides in this folder | ||||||
|               convenience_aliases \ | for source in $(find "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -type f | grep -Ev "_all|terminal_fancyfying"); do | ||||||
|               git_functions \ |   . "${source}" | ||||||
|               histcontrol \ |  | ||||||
|               home_bin_folder \ |  | ||||||
|               ls_aliases \ |  | ||||||
|               safety_aliases \ |  | ||||||
|               terminal_colors \ |  | ||||||
|               terminal_fancyfying; do |  | ||||||
|   . "$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/$source" |  | ||||||
| done | 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 | ||||||
|   | |||||||
| @@ -1,10 +1,17 @@ | |||||||
| 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}"; echo; done' | ||||||
| alias hosts='sudo nano /etc/hosts' | alias hosts='sudo nano /etc/hosts' | ||||||
| alias historygrep='history | grep' | alias historygrep='history | grep' | ||||||
| alias sshconfig='nano ~/.ssh/config' | alias sshconfig='nano ~/.ssh/config' | ||||||
|  | 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 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 newansibleworkspace='bash <(curl -s https://get.bjphoster.com/new-ansible-workspace.sh)' | ||||||
|  | alias infinitenothing='while true; do sleep 1; done' | ||||||
|  |  | ||||||
| alias sambaserver='docker run -it --rm --network host -p 137:137 -p 138:138 -p 139:139 -p 445:445 -v `pwd`:/share dperson/samba -n -p -s "sambashare;/share;yes;no;no;shareuser" -w "WORKGROUP"' | 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 termbin='nc termbin.com 9999' | ||||||
| alias dnsversion='dig txt chaos version.bind @' | alias dnsversion='dig txt chaos version.bind' | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								bashrc_overrides/docker_aliases
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								bashrc_overrides/docker_aliases
									
									
									
									
									
										Normal 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' | ||||||
| @@ -1,4 +1,7 @@ | |||||||
| GIT_FUNCTIONS=true | command -v git &>/dev/null | ||||||
|  | if [ $? -eq 0 ]; then | ||||||
|  |   GIT_FUNCTIONS=true | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| # Spaced | # Spaced | ||||||
| #PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) " | #PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) " | ||||||
| @@ -7,7 +10,7 @@ GIT_FUNCTIONS=true | |||||||
| # another version I really like | # another version I really like | ||||||
| PS1="${PURPLE}\# ${LIGHTBLUE}{${LIGHTGREEN}\u${BROWN}@${LIGHTGREEN}\$(hostname --fqdn)${LIGHTBLUE}} ${LIGHTPURPLE}[${CYAN}\w${LIGHTPURPLE}] " | 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${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]" | ||||||
|   PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) " |   PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) " | ||||||
| fi | fi | ||||||
| @@ -1,11 +1,14 @@ | |||||||
| GIT_FUNCTIONS=true | command -v git &>/dev/null | ||||||
|  | if [ $? -eq 0 ]; then | ||||||
|  |   GIT_FUNCTIONS=true | ||||||
|  | fi | ||||||
|  |  | ||||||
| # Spaced | # Spaced | ||||||
| #PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) " | #PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) " | ||||||
| # Not spaced | # Not spaced | ||||||
| PS1="${LIGHTBLUE}[${LIGHTRED}\u${LIGHTBLUE}@${LIGHTBROWN}$(hostname --fqdn)${LIGHTBLUE}]${LIGHTPURPLE}(${GREEN}\w${LIGHTPURPLE})" | 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${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]" | ||||||
|   PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) " |   PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) " | ||||||
| fi | fi | ||||||
|   | |||||||
							
								
								
									
										60
									
								
								deploy.sh
									
									
									
									
									
								
							
							
						
						
									
										60
									
								
								deploy.sh
									
									
									
									
									
								
							| @@ -1,14 +1,28 @@ | |||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
|  |  | ||||||
| THIS="$(dirname "$(readlink -fm "$0")")" | THIS="$(dirname "$(readlink -fm "$0")")" | ||||||
| SERVER=false | FANCYFY="client" | ||||||
|  | CURRENT_FANCYFY="" | ||||||
| DELETE=false | DELETE=false | ||||||
| MOVE=false | MOVE=false | ||||||
|  | PRESENT=false | ||||||
|  |  | ||||||
|  | _bashrc_present() { | ||||||
|  |   if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then | ||||||
|  |     echo true | ||||||
|  |     exit | ||||||
|  |   fi | ||||||
|  |   echo false | ||||||
|  | } | ||||||
|  |  | ||||||
| _arguments() { | _arguments() { | ||||||
|  |   if [ "$(_bashrc_present)" = true ]; then | ||||||
|  |     PRESENT=true | ||||||
|  |     CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY ~/.bashrc | sed 's/.*=//')" | ||||||
|  |   fi | ||||||
|   for PARM in "$@"; do |   for PARM in "$@"; do | ||||||
|     if [ "${PARM}" = "--server" ]; then |     if [ "${PARM}" = "--server" ]; then | ||||||
|       SERVER=true |       FANCYFY="server" | ||||||
|     elif [ "${PARM}" = "--delete" ]; then |     elif [ "${PARM}" = "--delete" ]; then | ||||||
|       DELETE=true |       DELETE=true | ||||||
|     elif [ "${PARM}" = "--move" ]; then |     elif [ "${PARM}" = "--move" ]; then | ||||||
| @@ -29,7 +43,7 @@ _help() { | |||||||
|   echo "  --force" |   echo "  --force" | ||||||
|   echo "    Force the reinstallation of the files" |   echo "    Force the reinstallation of the files" | ||||||
|   echo "  --delete" |   echo "  --delete" | ||||||
|   echo "    Delete the reference in ~/.bashrc" |   echo "    Delete the reference in ${BASHRC}" | ||||||
|   echo "  --move" |   echo "  --move" | ||||||
|   echo "    Create a new reference if the location of this folder has been changed" |   echo "    Create a new reference if the location of this folder has been changed" | ||||||
|   echo "  --server" |   echo "  --server" | ||||||
| @@ -38,17 +52,18 @@ _help() { | |||||||
| } | } | ||||||
|  |  | ||||||
| _delete() { | _delete() { | ||||||
|   sed -i '/REF:bashrc_overrides:REF/{N;d}' ~/.bashrc |   sed -i '/REF:bashrc_overrides:REF/{N;N;d}' ~/.bashrc | ||||||
| } | } | ||||||
|  |  | ||||||
| _bashrc_ref() { | _bashrc_ref() { | ||||||
|   echo "#REF:bashrc_overrides:REF" >> ~/.bashrc |   echo "#REF:bashrc_overrides:REF" >> ~/.bashrc | ||||||
|  |   echo "export TERMINAL_FANCYFY=${1}" >> ~/.bashrc | ||||||
|   echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc |   echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc | ||||||
| } | } | ||||||
|  |  | ||||||
| _move() { | _move() { | ||||||
|   _delete |   _delete | ||||||
|   _bashrc_ref |   _bashrc_ref "${FANCYFY}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _main() { | _main() { | ||||||
| @@ -56,23 +71,34 @@ _main() { | |||||||
|  |  | ||||||
|   if [ "${DELETE}" = true ]; then |   if [ "${DELETE}" = true ]; then | ||||||
|     _delete |     _delete | ||||||
|  |     echo "removed custom configs" | ||||||
|   elif [ "${MOVE}" = true ]; then |   elif [ "${MOVE}" = true ]; then | ||||||
|     _move |     if [ "${PRESENT}" = false ]; then | ||||||
|   elif [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then |       _bashrc_ref "${FANCYFY}" | ||||||
|     echo "bash overrides already in place" |       echo "unable to move to current directory" | ||||||
|     echo "skipping..." |       echo "bash overrides not previously present" | ||||||
|     echo |       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 |   else | ||||||
|     _bashrc_ref |     _bashrc_ref "${FANCYFY}" | ||||||
|     echo "bash overrides added" |     echo "bash overrides added" | ||||||
|     echo |     echo | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|   if [ "${SERVER}" = true ]; then |  | ||||||
|     sed -i 's/terminal_fancyfying/terminal_fancyfying_server/' ${THIS}/bashrc_overrides/_all |  | ||||||
|   else |  | ||||||
|     sed -i 's/terminal_fancyfying_server/terminal_fancyfying/' ${THIS}/bashrc_overrides/_all |  | ||||||
|   fi |  | ||||||
| } | } | ||||||
|  |  | ||||||
| _main "$@" | _main "$@" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user