mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
Added some scripts for lynx
This commit is contained in:
5
scripts/.local/scripts/duck
Executable file
5
scripts/.local/scripts/duck
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
url="https://lite.duckduckgo.com/lite?kd=1&kp=1&q=$(urlencode "$*")"
|
||||||
|
|
||||||
|
exec lynx "$url"
|
||||||
34
scripts/.local/scripts/urlencode
Executable file
34
scripts/.local/scripts/urlencode
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# yeah, i totally stole this from stack exchange, no shame
|
||||||
|
|
||||||
|
rawurlencode() {
|
||||||
|
local string="${1}"
|
||||||
|
local strlen=${#string}
|
||||||
|
local encoded=""
|
||||||
|
local pos c o
|
||||||
|
|
||||||
|
for ((pos = 0; pos < strlen; pos++)); do
|
||||||
|
c=${string:$pos:1}
|
||||||
|
case "$c" in
|
||||||
|
[-_.~a-zA-Z0-9]) o="${c}" ;;
|
||||||
|
*) printf -v o '%%%02x' "'$c'" ;;
|
||||||
|
esac
|
||||||
|
encoded+="${o}"
|
||||||
|
done
|
||||||
|
echo "${encoded}" # You can either set a return variable (FASTER)
|
||||||
|
REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
|
||||||
|
}
|
||||||
|
|
||||||
|
if test -n "$1"; then
|
||||||
|
rawurlencode "$*"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=
|
||||||
|
while read -r line; do
|
||||||
|
rawurlencode "$line"
|
||||||
|
done
|
||||||
@@ -14,8 +14,8 @@ autoload -Uz colors && colors
|
|||||||
# Load Useful Functions
|
# Load Useful Functions
|
||||||
source "$ZDOTDIR/zsh-functions"
|
source "$ZDOTDIR/zsh-functions"
|
||||||
|
|
||||||
zsh_add_file "zsh-aliases"
|
|
||||||
zsh_add_file "zsh-exports"
|
zsh_add_file "zsh-exports"
|
||||||
|
zsh_add_file "zsh-aliases"
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
||||||
|
|||||||
@@ -60,3 +60,4 @@ fi
|
|||||||
|
|
||||||
# tmux
|
# tmux
|
||||||
#alias ta() { tmux -f ~/.config/tmux/tmux.config attach "$@" }
|
#alias ta() { tmux -f ~/.config/tmux/tmux.config attach "$@" }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user