add scripts

This commit is contained in:
thek4n 2025-11-04 14:30:14 +03:00
parent 99601082ce
commit d547a8f1e0
11 changed files with 2108 additions and 6 deletions

View File

@ -25,4 +25,5 @@ gdb:.config/gdb
sandbox:
utils:.local/bin/myip .local/bin/genpass .local/bin/gensalt .local/bin/django-create-project .local/bin/mirror-site .local/bin/split-file .local/bin/extract .local/bin/destroy
chromium:.local/bin/pchromium .local/share/applications/pchromium.desktop
scripts:.local/bin/200ok .local/bin/bb .local/bin/emoji .local/bin/mksh .local/bin/nato .local/bin/pastas .local/bin/timer .local/bin/tryna .local/bin/trynafail
all:%less %t %note %tmux %zsh %nvim %git"

View File

@ -89,8 +89,7 @@ alias wget='wget -c'
alias ip='ip -c'
alias fastping='ping -c 100 -i 0.1'
# starts web server
alias www='python3 -m http.server 8080'
alias serveit='python3 -m http.server 8080'
# hardware
alias reboot='sudo /sbin/reboot'
@ -133,17 +132,17 @@ alias pastewww='paste.thek4n.ru'
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
if [ -n "${DISPLAY}" ]; then
alias _copy='sed -z "$ s/\n$//" | xclip -selection clipboard -i'
alias paste='xclip -selection clipboard -o'
alias pasta='xclip -selection clipboard -o'
else
alias _copy='read -rd "EOF" TTYCLIPBOARD'
alias paste='echo "$TTYCLIPBOARD"'
alias pasta='echo "$TTYCLIPBOARD"'
fi
elif [[ "${OSTYPE}" == "linux-android"* ]]; then
alias _copy='termux-clipboard-set'
alias paste='termux-clipboard-get'
alias pasta='termux-clipboard-get'
elif [[ "${OSTYPE}" == "darwin" ]]; then
alias _copy='pbcopy'
alias paste='pbpaste'
alias pasta='pbpaste'
fi
alias copy='tee /dev/stderr | _copy'

68
home/user/.local/bin/200ok Executable file
View File

@ -0,0 +1,68 @@
#!/bin/sh
set -eu
statuses="100 Continue
101 Switching Protocols
102 Processing
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
207 Multi-Status
208 Already Reported
300 Multiple Choices
301 Moved Permanently
302 Found
303 See Other
304 Not Modified
305 Use Proxy
307 Temporary Redirect
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URI Too Large
415 Unsupported Media Type
416 Request Range Not Satisfiable
417 Expectation Failed
418 I'm a teapot
420 Blaze it
422 Unprocessable Entity
423 Locked
424 Failed Dependency
425 No code
426 Upgrade Required
428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
449 Retry with
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
506 Variant Also Negotiates
507 Insufficient Storage
509 Bandwidth Limit Exceeded
510 Not Extended
511 Network Authentication Required"
if [ ${#} -eq 0 ]; then
echo "${statuses}"
else
echo "${statuses}" | grep -i --color=never "${@}"
fi

13
home/user/.local/bin/bb Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -eu
if test -t 1; then
exec 1>/dev/null
fi
if test -t 2; then
exec 2>/dev/null
fi
"${@}" &

1909
home/user/.local/bin/emoji Executable file

File diff suppressed because it is too large Load Diff

20
home/user/.local/bin/mksh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
set -eu
if [ ! ${#} -eq 1 ]; then
echo 'mksh takes one argument' 1>&2
exit 1
elif [ -e "${1}" ]; then
echo "${1} already exists" 1>&2
exit 1
fi
echo '#!/bin/sh
set -eu
' > "${1}"
chmod u+x "${1}"
"${EDITOR}" "${1}"

48
home/user/.local/bin/nato Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env ruby
DICTIONARY = {
"a" => "Alfa",
"b" => "Bravo",
"c" => "Charlie",
"d" => "Delta",
"e" => "Echo",
"f" => "Foxtrot",
"g" => "Golf",
"h" => "Hotel",
"i" => "India",
"j" => "Juliett",
"k" => "Kilo",
"l" => "Lima",
"m" => "Mike",
"n" => "November",
"o" => "Oscar",
"p" => "Papa",
"q" => "Quebec",
"r" => "Romeo",
"s" => "Sierra",
"t" => "Tango",
"u" => "Uniform",
"v" => "Victor",
"w" => "Whiskey",
"x" => "X-ray",
"y" => "Yankee",
"z" => "Zulu",
"1" => "One",
"2" => "Two",
"3" => "Three",
"4" => "Four",
"5" => "Five",
"6" => "Six",
"7" => "Seven",
"8" => "Eight",
"9" => "Nine",
"0" => "Zero"
}
ARGV.join(' ').split(' ').each do |word|
letters = word.downcase.each_char.map do |char|
DICTIONARY.fetch char, char
end
puts letters.join(' ')
end

18
home/user/.local/bin/pastas Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
set -eu
trap 'exit 0' INT
last_value=''
while true
do
value="$(xclip -selection clipboard -o)"
if [ "$last_value" != "$value" ]; then
echo "$value"
last_value="$value"
fi
sleep 0.1
done

6
home/user/.local/bin/timer Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
set -eu
sleep "${1}"
notify-send -- 'Timer complete' "${1}"

View File

@ -0,0 +1,10 @@
#!/bin/sh
set -u
"${@}"
#shellcheck disable=SC2181
while [ ! "${?}" -eq 0 ]; do
sleep 0.5
"${@}"
done

10
home/user/.local/bin/trynafail Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -u
"${@}"
# shellcheck disable=SC2181
while [ "${?}" -eq 0 ]; do
sleep 0.5
"${@}"
done