Skip to content

Commit b6d4852

Browse files
committed
new file: 500KBfile.txt
new file: BASHshortcuts.txt modified: README.md new file: aarray.sh new file: colors/16-colors.sh new file: colors/256-colors.sh new file: colors/256a-colors.sh new file: colors/259+colorswithformats.sh new file: colors/blnk new file: colors/colorchart new file: colors/colortable new file: depreciated/README.md new file: depreciated/frags.sh new file: es/sieve.sh new file: file new file: frags new file: funky/command new file: gm/wae new file: header.sh new file: int-or-string.sh new file: lf/lf new file: lf/lf1 new file: lf/lf2 new file: lf/lf3 new file: lf/lf4 new file: libshm/libandroid-shmem-gnu.log new file: libshm/libandroid-shmem-gnu2.log new file: libshm/libandroid-shmem-gnu3.log new file: libshm/libandroid-shmem-gnu4.log new file: libshm/libandroid-shmem.log new file: oneliners new file: pk.sh new file: proot/ktest.sh new file: proot/proots.md new file: pwd.sh new file: returntest.sh new file: rnd/9.11.sh new file: rnd/9.12.sh new file: rnd/9.13.sh new file: rnd/9.14.sh new file: rnd/9.15.sh new file: rnd/9.16.sh new file: rnd/9.17.sh new file: rnd/a new file: rnd/we.sh new file: rwl.sh new file: sed1line.txt new file: sp.sh new file: space.sh new file: spinning new file: stdoutbench.sh new file: systemvars.txt new file: tmp new file: wl new file: wul
1 parent 05b484d commit b6d4852

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+9613
-2
lines changed

500KBfile.txt

Lines changed: 6401 additions & 0 deletions
Large diffs are not rendered by default.

BASHshortcuts.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
List Of Useful Bash Keyboard Shortcuts
2+
3+
ALT key shortcuts
4+
1. ALT+A – Go to the beginning of a line.
5+
6+
2. ALT+B – Move one character before the cursor.
7+
8+
3. ALT+C – Suspends the running command/process. Same as CTRL+C
9+
10+
4. ALT+D – Closes the empty Terminal (I.e it closes the Terminal when there is nothing typed). Also deletes all chracters after the cursor.
11+
12+
5. ALT+F – Move forward one character.
13+
14+
6. ALT+T – Swaps the last two words.
15+
16+
7. ALT+U – Capitalize all characters in a word after the cursor.
17+
18+
8. ALT+L – Uncaptalize all characters in a word after the cursor.
19+
20+
9. ALT+R – Undo any changes to a command that you have brought from the history if you’ve edited it.
21+
22+
10. ALT+. (note the dot at the end) – Use the last word of the previous command.
23+
24+
CTRL key shortcuts
25+
1. CTRL+A – Quickly move to the beginning of line.
26+
27+
2. CTRL+B – To move backward one character.
28+
29+
3. CTRL+C – Stop the currently running command
30+
31+
4. CTRL+D – Delete one character backward.
32+
33+
5. CTRL+E – Move to the end of line
34+
35+
6. CTRL+F – Move forward one character
36+
37+
7. CTRL+G – Leave the history searching mode without running the command.
38+
39+
8. CTRL+H – Delete the characters before the cursor, same as BASKSPACE.
40+
41+
9. CTRL+J – Same as ENTER/RETURN key.
42+
43+
10. CTRL+K – Delete all characters after the cursor.
44+
45+
11. CTRL+L – Clears the screen and redisplay the line.
46+
47+
12. CTRL+M – Same as CTRL+J or RETURN.
48+
49+
13. CTRL+N – Display next line in command history.
50+
51+
14. CTRL+O – Run the command that you found using reverse search i.e CTRL+R.
52+
53+
15. CTRL+P – Displays the previous line in command history.
54+
55+
16. CTRL+R – Searches the history backward (Reverse search).
56+
57+
17. CTRL+S – Searches the history forward.
58+
59+
18. CTRL+T – Swaps the last two characters.
60+
61+
19. CTRL+U – Delete all characters before the cursor (Kills backward from point to the beginning of line).
62+
63+
20. CTRL+V – Makes the next character typed verbatim
64+
65+
21. CTRL+W – Delete the words before the cursor.
66+
67+
22. CTRL+X – Lists the possible filename completions of the current word.
68+
69+
23. CTRL+XX – Move between start of command line and current cursor position (and back again).
70+
71+
24. CTRL+Y – Retrieves last item that you deleted or cut.
72+
73+
25. CTRL+Z – Stops the current command. You can resume it with fg in the foreground or bg in the background.
74+
75+
26. CTRL+[ – Equivalent to ESC key.
76+
77+
Miscellaneous
78+
1. !! – Repeats the last command.
79+
80+
2. ESC+t – Swaps the last two words.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# frags.bash
2-
frags.bash
1+
Various script fragments.

aarray.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Bash 4 / ksh93
2+
3+
typeset -A homedir # Declare associative array
4+
homedir=( # Compound assignment
5+
[jim]=/home/jim
6+
[silvia]=/home/silvia
7+
[alex]=/home/alex
8+
)
9+
10+
homedir[ormaaj]=/home/ormaaj # Ordinary assignment adds another single element
11+
12+
for user in "${!homedir[@]}"; do # Enumerate all indices (user names)
13+
printf 'Home directory of user %s is: %q\n' "$user" "${homedir[$user]}"
14+
done

colors/16-colors.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# From https://misc.flogisoft.com/bash/tip_colors_and_formatting
3+
# This program is free software. It comes without any warranty, to
4+
# the extent permitted by applicable law. You can redistribute it
5+
# and/or modify it under the terms of the Do What The Fuck You Want
6+
# To Public License, Version 2, as published by Sam Hocevar. See
7+
# http://sam.zoy.org/wtfpl/COPYING for more details.
8+
9+
#Background
10+
for clbg in {40..47} {100..107} 49 ; do
11+
#Foreground
12+
for clfg in {30..37} {90..97} 39 ; do
13+
#Formatting
14+
for attr in 0 1 2 4 5 7 ; do
15+
#Print the result
16+
echo -en "\e[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \e[0m"
17+
done
18+
echo #Newline
19+
done
20+
done
21+
22+
exit 0

colors/256-colors.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# From https://misc.flogisoft.com/bash/tip_colors_and_formatting
3+
4+
# This program is free software. It comes without any warranty, to
5+
# the extent permitted by applicable law. You can redistribute it
6+
# and/or modify it under the terms of the Do What The Fuck You Want
7+
# To Public License, Version 2, as published by Sam Hocevar. See
8+
# http://sam.zoy.org/wtfpl/COPYING for more details.
9+
10+
for fgbg in 38 48 ; do # Foreground / Background
11+
for color in {0..255} ; do # Colors
12+
# Display the color
13+
printf "\e[${fgbg};5;%sm %3s \e[0m" $color $color
14+
# Display 6 colors per lines
15+
if [ $((($color + 1) % 6)) == 4 ] ; then
16+
echo # New line
17+
fi
18+
done
19+
echo # New line
20+
done
21+
22+
exit 0

colors/256a-colors.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# taken from https://misc.flogisoft.com/bash/tip_colors_and_formatting#colors2
3+
# with a blacklist of the hardest colors to see agaist a black or white background
4+
5+
blacklist=(0 1 7 9 {15..18} {232..235} {250..255})
6+
#blacklist=()
7+
colors=$(printf '%d\n' {0..255} ${blacklist[@]} | sort -n | uniq -u)
8+
9+
slot=0
10+
for fgbg in 38 48 ; do # Foreground / Background
11+
for color in $colors ; do # Colors
12+
# Display the color
13+
printf "\e[${fgbg};5;%sm %3s \e[0m" $color $color
14+
# Display 6 colors per lines
15+
if [ $((($slot + 1) % 6)) == 4 ] ; then
16+
echo # New line
17+
fi
18+
slot=$((slot + 1))
19+
done
20+
echo # New line
21+
done

colors/259+colorswithformats.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash -e
2+
# Copyright 2018 by SDRausty. All rights reserved. 🌎 🌍 🌏 🌐 🗺
3+
# Hosting https://sdrausty.github.io/wae courtesy https://pages.github.com
4+
# https://sdrausty.github.io/wae/CONTRIBUTORS Thank you for your help.
5+
# https://sdrausty.github.io/wae/README has information about wae.
6+
################################################################################
7+
8+
for attr2 in 38 48 ; do # Foreground / Background
9+
for attr0 in {0..258} ; do # Colors
10+
for attr3 in {0..4} {7..9} ; do
11+
# Display the color
12+
printf "\\e[%s;%s;5;%sm %s %-3s \\e[0m" "$attr3" "$attr2" "$attr0" "$attr3" "$attr0"
13+
# Display 10 colors per lines
14+
if [ $(((attr0 + 1) % 10)) == 10 ] ; then
15+
printf "\\e[0m\\n\\n" # New line
16+
fi
17+
done
18+
echo # New line
19+
done
20+
done
21+
22+
exit 0

colors/blnk

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash -e
2+
# Copyright 2017-2018 by SDRausty. All rights reserved. 🌎 🌍 🌏 🌐 🗺
3+
# Hosting https://sdrausty.github.io/TermuxArch courtesy https://pages.github.com
4+
# https://sdrausty.github.io/TermuxArch/CONTRIBUTORS Thank you for your help.
5+
# https://sdrausty.github.io/TermuxArch/README has information about this project.
6+
################################################################ ###############
7+
DATA[0]=" ___ __ __ _ _ "
8+
DATA[1]=" / _ | ________/ / / / (_)__ __ ____ __ (_)__ "
9+
DATA[2]=" / __ |/ __/ __/ _ \ / /__/ / _ \/ // /\ \ / / / _ \ "
10+
DATA[3]="/_/ |_/_/ \__/_//_/ /____/_/_//_/\_,_//_\_\ /_/_//_/ "
11+
DATA[4]=" "
12+
DATA[5]=" ______ ___ ___ __ "
13+
DATA[6]="/_ __/__ ______ _ __ ____ __ / _ \/ _ \___ ___ / / "
14+
DATA[7]=" / / / -_) __/ ' \/ // /\ \ / / ___/ , _/ _ \/ _ \/ __/"
15+
DATA[8]="/_/ \__/_/ /_/_/_/\_,_//_\_\ /_/ /_/|_|\___/\___/\__/ "
16+
17+
# virtual coordinate system is X*Y ${#DATA} * 5
18+
19+
REAL_OFFSET_X=0
20+
REAL_OFFSET_Y=0
21+
22+
draw_char() {
23+
V_COORD_X=$1
24+
V_COORD_Y=$2
25+
26+
tput cup $((REAL_OFFSET_Y + V_COORD_Y)) $((REAL_OFFSET_X + V_COORD_X))
27+
28+
printf %c ${DATA[V_COORD_Y]:V_COORD_X:1}
29+
}
30+
31+
32+
trap 'exit 1' INT TERM
33+
trap 'tput setaf 9; tput cvvis; clear' EXIT
34+
35+
tput civis
36+
clear
37+
38+
while :; do
39+
40+
for ((c=1; c <= 7; c++)); do
41+
tput setaf $c
42+
for ((x=0; x<${#DATA[0]}; x++)); do
43+
for ((y=0; y<=9; y++)); do
44+
draw_char $x $y
45+
done
46+
done
47+
done
48+
49+
done

colors/colorchart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
#!/bin/bash
3+
#
4+
# This file echoes a bunch of color codes to the
5+
# terminal to demonstrate what's available. Each
6+
# line is the color code of one forground color,
7+
# out of 17 (default + 16 escapes), followed by a
8+
# test use of that color on all nine background
9+
# colors (default + 8 escapes).
10+
#
11+
12+
T='gYw' # The test text
13+
14+
echo -e "\n 40m 41m 42m 43m\
15+
44m 45m 46m 47m";
16+
17+
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
18+
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
19+
' 36m' '1;36m' ' 37m' '1;37m';
20+
do FG=${FGs// /}
21+
echo -en " $FGs \033[$FG $T "
22+
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
23+
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
24+
done
25+
echo;
26+
done
27+
echo
28+
29+

colors/colortable

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
color(){
3+
for c; do
4+
printf '\e[48;5;%dm%03d' $c $c
5+
done
6+
printf '\e[0m \n'
7+
}
8+
9+
IFS=$' \t\n'
10+
color {0..15}
11+
for ((i=0;i<6;i++)); do
12+
color $(seq $((i*36+16)) $((i*36+51)))
13+
done
14+
color {232..255}

depreciated/README.md

Whitespace-only changes.

depreciated/frags.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
namestartarch() { # ${@%/} removes trailing slash
3+
darch="$(echo "${rootdir%/}" |sed 's#//*#/#g')"
4+
if [[ "$darch" = "/arch" ]] ; then
5+
aarch=""
6+
startbi2=arch
7+
else
8+
aarch="$(echo "$darch" |sed 's/\//\+/g')"
9+
startbi2=arch
10+
fi
11+
declare -g startbin=start"$startbi2$aarch"
12+
}
13+

es/sieve.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2017-2018 by SDRausty. All rights reserved. 🌎 🌍 🌏 🌐 🗺
3+
# Hosting https://sdrausty.github.io/TermuxArch courtesy https://pages.github.com
4+
# https://sdrausty.github.io/TermuxArch/CONTRIBUTORS Thank you for your help.
5+
# https://sdrausty.github.io/TermuxArch/README has information about this project.
6+
# sieve.sh
7+
# Ref Example 27-13. The Sieve of Eratosthenes
8+
# tldp.org/LDP/abs/html/arrays.html
9+
# Must invoke with command-line argument (limit of primes).
10+
# -------------------------------------------------------- #
11+
# https://www.bing.com/search?q="Sieve of Eratosthenes"
12+
################################################################################
13+
14+
if test "$BASH" = "" || "$BASH" -uc "a=();true \"\${a[@]}\"" 2>/dev/null;then
15+
# Bash 4.4, Zsh
16+
set -euo pipefail
17+
else
18+
# Bash 4.3 and older chokes on empty arrays with set -u.
19+
set -eo pipefail
20+
fi
21+
shopt -s nullglob globstar
22+
23+
UPPER_LIMIT="$1" # From command-line.
24+
(( SPLIT=UPPER_LIMIT/2 )) # Halfway to max number.
25+
26+
declare -a Primes
27+
mapfile -t Primes < <(seq "$UPPER_LIMIT")
28+
29+
i=1
30+
until (( ( i += 1 ) > SPLIT )) # Need check only halfway.
31+
do
32+
if [[ -n "${Primes[i]}" ]]
33+
then
34+
t="$i"
35+
until (( ( t += i ) > UPPER_LIMIT ))
36+
do
37+
Primes[t]=
38+
done
39+
fi
40+
done
41+
echo "${Primes[*]}"
42+
43+
exit $?

file

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
000001002003004005006007008009010011012013014015
2+
016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051
3+
052053054055056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087
4+
088089090091092093094095096097098099100101102103104105106107108109110111112113114115116117118119120121122123
5+
124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
6+
160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
7+
196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
8+
232233234235236237238239240241242243244245246247248249250251252253254255

0 commit comments

Comments
 (0)