Add stuff for bashrc
This commit is contained in:
		
							parent
							
								
									5b9bbb54cd
								
							
						
					
					
						commit
						7c9ecccc7d
					
				
							
								
								
									
										21
									
								
								.config/tea/autocomplete.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								.config/tea/autocomplete.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| #! /bin/bash | ||||
| 
 | ||||
| : ${PROG:=$(basename ${BASH_SOURCE})} | ||||
| 
 | ||||
| _cli_bash_autocomplete() { | ||||
|   if [[ "${COMP_WORDS[0]}" != "source" ]]; then | ||||
|     local cur opts base | ||||
|     COMPREPLY=() | ||||
|     cur="${COMP_WORDS[COMP_CWORD]}" | ||||
|     if [[ "$cur" == "-"* ]]; then | ||||
|       opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion ) | ||||
|     else | ||||
|       opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) | ||||
|     fi | ||||
|     COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||||
|     return 0 | ||||
|   fi | ||||
| } | ||||
| 
 | ||||
| complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete $PROG | ||||
| unset PROG | ||||
							
								
								
									
										54
									
								
								.desktop/messages.txt
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										54
									
								
								.desktop/messages.txt
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,54 @@ | ||||
| I'd just like to interject for a moment... | ||||
| Is plex running right now? | ||||
| Why not check calcurse right now? | ||||
| Check for the daily coding challenge! | ||||
| What the dog doin? | ||||
| Is sloth still running? | ||||
| Is gluttony still running? | ||||
| Ganooooo Looonix | ||||
| Genpoo | ||||
| Reminder that set-motd is a command | ||||
| Reminder that sha is a command | ||||
| Reminder that weather is a command | ||||
| Reminder that http is a command | ||||
| Reminder that google is a command | ||||
| Reminder that clipboard is a command | ||||
| Reminder to use vifm for that operation | ||||
| Can you automate that? | ||||
| 1) Make each program do one thing well | ||||
| 2) To do a new job, build fresh rather than complicate old programs | ||||
| 3) Expect the output of your program to be the input to another | ||||
| 4) Keep output to the point | ||||
| 5) Design and build things to be tried early | ||||
| 6) Use tools to lighten tasks, even if they will be thrown out after | ||||
| 7) Build modular programs | ||||
| 8) Write readable programs | ||||
| 9) Write simple programs | ||||
| 10) Write transparent programs | ||||
| 11) Build on a potential user's expected knowledge | ||||
| 12) Write flexible programs | ||||
| 13) Value dev time over machine time | ||||
| 14) Make data compilcated, not the program itself | ||||
| 15) Keep It Simple, Stupid | ||||
| 16) "All information should be free" | ||||
| 17) Mistrust authority -- promote decenteralization | ||||
| Remember to throw that into vimwiki! | ||||
| Hey go workout, its probably arm day | ||||
| I hope you enjoy reading these as much as I enjoy making them | ||||
| Water the plants! | ||||
| Go bake a loaf of bread | ||||
| Be sure to take a break now and again | ||||
| Amogus | ||||
| Amogus Amogus Amogus | ||||
| funny monke | ||||
| I use gentoo btw | ||||
| Anything you say can and will be misquoted against you | ||||
| cat "food in cans"; cat: can't open food in cans | ||||
| Gameing | ||||
| gameing | ||||
| I'd tell you a DNS joke but it could take up to 24 hours for everyone to get it | ||||
| Is the request portal still up? | ||||
| Remember to use 'f' in vim, very useful | ||||
| Go get some water | ||||
| Docker isnt to bad, tbh | ||||
| Light a candle, if programming | ||||
							
								
								
									
										5
									
								
								.local/bin/bkmark
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								.local/bin/bkmark
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,5 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| SOURCE="/home/tyler/.frequent" | ||||
| 
 | ||||
| xdotool type $(cat $SOURCE | dmenu -l 50 | cut -d ' ' -f1) | ||||
							
								
								
									
										144
									
								
								.local/bin/pass-completion.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								.local/bin/pass-completion.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,144 @@ | ||||
| # completion file for bash | ||||
| 
 | ||||
| # Copyright (C) 2012 - 2014 Jason A. Donenfeld <Jason@zx2c4.com> and | ||||
| # Brian Mattern <rephorm@rephorm.com>. All Rights Reserved. | ||||
| # This file is licensed under the GPLv2+. Please see COPYING for more information. | ||||
| 
 | ||||
| _pass_complete_entries () { | ||||
| 	local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}" | ||||
| 	prefix="${prefix%/}/" | ||||
| 	local suffix=".gpg" | ||||
| 	local autoexpand=${1:-0} | ||||
| 
 | ||||
| 	local IFS=$'\n' | ||||
| 	local items=($(compgen -f $prefix$cur)) | ||||
| 
 | ||||
| 	# Remember the value of the first item, to see if it is a directory. If | ||||
| 	# it is a directory, then don't add a space to the completion | ||||
| 	local firstitem="" | ||||
| 	# Use counter, can't use ${#items[@]} as we skip hidden directories | ||||
| 	local i=0 item | ||||
| 
 | ||||
| 	for item in ${items[@]}; do | ||||
| 		[[ $item =~ /\.[^/]*$ ]] && continue | ||||
| 
 | ||||
| 		# if there is a unique match, and it is a directory with one entry | ||||
| 		# autocomplete the subentry as well (recursively) | ||||
| 		if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then | ||||
| 			while [[ -d $item ]]; do | ||||
| 				local subitems=($(compgen -f "$item/")) | ||||
| 				local filtereditems=( ) item2 | ||||
| 				for item2 in "${subitems[@]}"; do | ||||
| 					[[ $item2 =~ /\.[^/]*$ ]] && continue | ||||
| 					filtereditems+=( "$item2" ) | ||||
| 				done | ||||
| 				if [[ ${#filtereditems[@]} -eq 1 ]]; then | ||||
| 					item="${filtereditems[0]}" | ||||
| 				else | ||||
| 					break | ||||
| 				fi | ||||
| 			done | ||||
| 		fi | ||||
| 
 | ||||
| 		# append / to directories | ||||
| 		[[ -d $item ]] && item="$item/" | ||||
| 
 | ||||
| 		item="${item%$suffix}" | ||||
| 		COMPREPLY+=("${item#$prefix}") | ||||
| 		if [[ $i -eq 0 ]]; then | ||||
| 			firstitem=$item | ||||
| 		fi | ||||
| 		let i+=1 | ||||
| 	done | ||||
| 
 | ||||
| 	# The only time we want to add a space to the end is if there is only | ||||
| 	# one match, and it is not a directory | ||||
| 	if [[ $i -gt 1 || ( $i -eq 1 && -d $firstitem ) ]]; then | ||||
| 		compopt -o nospace | ||||
| 	fi | ||||
| } | ||||
| 
 | ||||
| _pass_complete_folders () { | ||||
| 	local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}" | ||||
| 	prefix="${prefix%/}/" | ||||
| 
 | ||||
| 	local IFS=$'\n' | ||||
| 	local items=($(compgen -d $prefix$cur)) | ||||
| 	for item in ${items[@]}; do | ||||
| 		[[ $item == $prefix.* ]] && continue | ||||
| 		COMPREPLY+=("${item#$prefix}/") | ||||
| 	done | ||||
| } | ||||
| 
 | ||||
| _pass_complete_keys () { | ||||
| 	local GPG="gpg" | ||||
| 	command -v gpg2 &>/dev/null && GPG="gpg2" | ||||
| 
 | ||||
| 	local IFS=$'\n' | ||||
| 	# Extract names and email addresses from gpg --list-keys | ||||
| 	local keys="$($GPG --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')" | ||||
| 	COMPREPLY+=($(compgen -W "${keys}" -- ${cur})) | ||||
| } | ||||
| 
 | ||||
| _pass() | ||||
| { | ||||
| 	COMPREPLY=() | ||||
| 	local cur="${COMP_WORDS[COMP_CWORD]}" | ||||
| 	local commands="init ls find grep show insert generate edit rm mv cp git help version ${PASSWORD_STORE_EXTENSION_COMMANDS[*]}" | ||||
| 	if [[ $COMP_CWORD -gt 1 ]]; then | ||||
| 		local lastarg="${COMP_WORDS[$COMP_CWORD-1]}" | ||||
| 		case "${COMP_WORDS[1]}" in | ||||
| 			init) | ||||
| 				if [[ $lastarg == "-p" || $lastarg == "--path" ]]; then | ||||
| 					_pass_complete_folders | ||||
| 					compopt -o nospace | ||||
| 				else | ||||
| 					COMPREPLY+=($(compgen -W "-p --path" -- ${cur})) | ||||
| 					_pass_complete_keys | ||||
| 				fi | ||||
| 				;; | ||||
| 			ls|list|edit) | ||||
| 				_pass_complete_entries | ||||
| 				;; | ||||
| 			show|-*) | ||||
| 				COMPREPLY+=($(compgen -W "-c --clip" -- ${cur})) | ||||
| 				_pass_complete_entries 1 | ||||
| 				;; | ||||
| 			insert) | ||||
| 				COMPREPLY+=($(compgen -W "-e --echo -m --multiline -f --force" -- ${cur})) | ||||
| 				_pass_complete_entries | ||||
| 				;; | ||||
| 			generate) | ||||
| 				COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force -i --in-place" -- ${cur})) | ||||
| 				_pass_complete_entries | ||||
| 				;; | ||||
| 			cp|copy|mv|rename) | ||||
| 				COMPREPLY+=($(compgen -W "-f --force" -- ${cur})) | ||||
| 				_pass_complete_entries | ||||
| 				;; | ||||
| 			rm|remove|delete) | ||||
| 				COMPREPLY+=($(compgen -W "-r --recursive -f --force" -- ${cur})) | ||||
| 				_pass_complete_entries | ||||
| 				;; | ||||
| 			git) | ||||
| 				COMPREPLY+=($(compgen -W "init push pull config log reflog rebase" -- ${cur})) | ||||
| 				;; | ||||
| 		esac | ||||
| 
 | ||||
| 		# To add completion for an extension command define a function like this: | ||||
| 		# __password_store_extension_complete_<COMMAND>() { | ||||
| 		#     COMPREPLY+=($(compgen -W "-o --option" -- ${cur})) | ||||
| 		#     _pass_complete_entries 1 | ||||
| 		# } | ||||
| 		# | ||||
| 		# and add the command to the $PASSWORD_STORE_EXTENSION_COMMANDS array | ||||
| 		if [[ " ${PASSWORD_STORE_EXTENSION_COMMANDS[*]} " == *" ${COMP_WORDS[1]} "* ]] && type "__password_store_extension_complete_${COMP_WORDS[1]}" &> /dev/null; then | ||||
| 			"__password_store_extension_complete_${COMP_WORDS[1]}" | ||||
| 		fi | ||||
| 	else | ||||
| 		COMPREPLY+=($(compgen -W "${commands}" -- ${cur})) | ||||
| 		_pass_complete_entries 1 | ||||
| 	fi | ||||
| } | ||||
| 
 | ||||
| complete -o filenames -F _pass pass | ||||
							
								
								
									
										54
									
								
								.local/bin/vifmimg
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										54
									
								
								.local/bin/vifmimg
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,54 @@ | ||||
| #!/bin/sh | ||||
| export PCACHE="$HOME/.cache/vifm/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$PWD/$6")" | sha256sum | awk '{print $1}')" | ||||
| 
 | ||||
| pclear() { | ||||
| 	printf '{"action": "remove", "identifier": "vifm-preview"}\n' > "$FIFO_UEBERZUG" | ||||
| } | ||||
| 
 | ||||
| image() { | ||||
| 		printf '{"action": "add", "identifier": "vifm-preview", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$2" "$3" "$4" "$5" "$6" > "$FIFO_UEBERZUG" | ||||
| } | ||||
| 
 | ||||
| main() { | ||||
|     case "$1" in | ||||
|         "clear") | ||||
| 			pclear "$@" | ||||
| 			;; | ||||
|         "draw") | ||||
| 			FILE="$PWD/$6" | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "$FILE" | ||||
| 			;; | ||||
|         "video") | ||||
| 			[ ! -f "$PCACHE" ] && \ | ||||
| 				ffmpegthumbnailer -i "$6" -o "${PCACHE}.jpg" -s 0 -q 5 | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.jpg" | ||||
| 			;; | ||||
|         "epub") | ||||
| 			[ ! -f "$PCACHE" ] && \ | ||||
| 				epub-thumbnailer "$6" "$PCACHE" 1024 | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "$PCACHE" | ||||
| 			;; | ||||
|         "pdf") | ||||
| 			[ ! -f "${PCACHE}.jpg" ] && \ | ||||
| 				pdftoppm -jpeg -f 1 -singlefile "$6" "$PCACHE" | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.jpg" | ||||
| 			;; | ||||
|         "djvu") | ||||
| 			[ ! -f "${PCACHE}.jpg" ] && \ | ||||
| 				ddjvu -format=tiff -quality=90 -page=1 "$6" "$PCACHE.jpg" | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.jpg" | ||||
| 			;; | ||||
|         "audio") | ||||
| 			[ ! -f "${PCACHE}.jpg" ] && \ | ||||
| 				ffmpeg -hide_banner -i "$6" "${PCACHE}.jpg" -y >/dev/null | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.jpg" | ||||
| 			;; | ||||
|         "font") | ||||
| 			[ ! -f "${PCACHE}.jpg" ] && \ | ||||
| 				fontpreview -i "$6" -o "${PCACHE}.jpg" | ||||
| 			image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.jpg" | ||||
| 			;; | ||||
|         *) | ||||
|     esac | ||||
| } | ||||
| main "$@" | ||||
							
								
								
									
										22
									
								
								.local/bin/vifmrun
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								.local/bin/vifmrun
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,22 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| if [ -z "$(command -v vifm)" ]; then | ||||
| 	printf "vifm isn't installed on your system!\n" | ||||
| 	exit 1 | ||||
| elif [ -z "$(command -v ueberzug)" ]; then | ||||
| 	exec vifm "$@" | ||||
| else | ||||
| 	cleanup() { | ||||
| 		exec 3>&- | ||||
| 	    rm "$FIFO_UEBERZUG" | ||||
| 	} | ||||
| 	[ ! -d "$HOME/.cache/vifm" ] && mkdir -p "$HOME/.cache/vifm" | ||||
| 	export FIFO_UEBERZUG="$HOME/.cache/vifm/ueberzug-${$}" | ||||
|         export PATH="${PATH}:$HOME/.config/vifm/scripts" | ||||
| 	mkfifo "$FIFO_UEBERZUG" | ||||
| 	ueberzug layer -s <"$FIFO_UEBERZUG" -p json & | ||||
| 	exec 3>"$FIFO_UEBERZUG" | ||||
| 	trap cleanup EXIT | ||||
| 	vifm "$@" 3>&- | ||||
| 	vifmimg clear | ||||
| fi | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user