28 Commits

Author SHA1 Message Date
  Alois Mahdal 285da2510c Fix error being printed to stdout 1 month ago
  Alois Mahdal 5c18697676 Fix quoting in bashum handlers 1 month ago
  Alois Mahdal 86d58cea76 Report errors better with cal() 1 month ago
  Alois Mahdal 9e6a966263 Add MYPY_CACHE_DIR to sweep mypy caching under the rug 1 month ago
  Alois Mahdal 5b857e64c1 Keep meta-data while copy-pasting files with xpst() 1 month ago
  Alois Mahdal 629c553f48 Add xpst_l() and xpst_la(), symlinking variants of xpst() 1 month ago
  Alois Mahdal 6bd87b80de Add xt() and xtt() for typing clipboard out with xdotool 1 month ago
  Alois Mahdal 48f04b37c9 Replace old xaa() with xop() usage copying its arguments to clipboard 1 month ago
  Alois Mahdal 054629317d Add xdl() and xxdl() for quick downloading files 1 month ago
  Alois Mahdal b1fab65a91 Add command/clipboard based xtrans() and xfromc() 1 month ago
  Alois Mahdal a1397ac0ff Expand set of quick-padding functions x4xx?() 1 month ago
  Alois Mahdal 9dfc30b9e9 Fix typos in x*() docstrings 1 month ago
  Alois Mahdal 61ac9f4993 Announce sdup (from minions) replacing lrep() and prep() 1 month ago
  Alois Mahdal fff4b3a300 Add utility function to replicate STDIN horizontally 1 month ago
  Alois Mahdal 939759a76b Add spec_cksources() to verify Sources: in spec files 1 month ago
  Alois Mahdal 3a95e4dff6 Improve sleeping/beeping Bash functions 1 month ago
  Alois Mahdal 2a8a12d42e Add prepend() to simplify mass-renaming files by prepending a string 1 month ago
  Alois Mahdal 1fd6890a95 update signature 1 month ago
  Alois Mahdal cd9f64f8ca Try and fixe Bash history 1 month ago
  Alois Mahdal bf667b8115 Add mutt dotfile 1 month ago
  Alois Mahdal 87a9e25499 Set cursor size 1 month ago
  Alois Mahdal c7d862bb3b Cleanup of coding style quoting, docstring and bogus files 1 month ago
  Alois Mahdal 84cbb9710b Move .gittum to .config/gittum 1 month ago
  Alois Mahdal 4d213f1fd0 Move .bashum to .config/bashum 1 month ago
  Alois Mahdal 0faf608f97 Drop (currently not working) clementine bar 1 month ago
  Alois Mahdal f53426b162 Move .i3 to .config/i3 1 month ago
  Alois Mahdal 26efba26bc Use proper directory name also for exit status temp 2 years ago
  Alois Mahdal 69ef003392 Update bashum setup and init scripts with new directory name 2 years ago
60 changed files with 445 additions and 135 deletions
  1. 0
    1
      dotfiles/bash
  2. 0
    18
      dotfiles/bashum/head.bashrc
  3. 0
    1
      dotfiles/bashum/host/morel.bashrc
  4. 2
    0
      dotfiles/config/Xlib/global.Xdefaults
  5. 16
    3
      dotfiles/config/bashum/colors.bashrc
  6. 0
    0
      dotfiles/config/bashum/defaults.bashrc
  7. 18
    0
      dotfiles/config/bashum/head.bashrc
  8. 0
    0
      dotfiles/config/bashum/host/README
  9. 0
    0
      dotfiles/config/bashum/host/den.bashrc
  10. 0
    0
      dotfiles/config/bashum/host/kana.bashrc
  11. 0
    0
      dotfiles/config/bashum/host/malinovka.bashrc
  12. 0
    0
      dotfiles/config/bashum/host/malista.bashrc
  13. 1
    0
      dotfiles/config/bashum/host/morel.bashrc
  14. 0
    0
      dotfiles/config/bashum/host/singletop.bashrc
  15. 0
    0
      dotfiles/config/bashum/host/tamtam.bashrc
  16. 0
    0
      dotfiles/config/bashum/host/tamten.bashrc
  17. 251
    25
      dotfiles/config/bashum/main.bashrc
  18. 11
    11
      dotfiles/config/bashum/post.bashrc
  19. 4
    4
      dotfiles/config/bashum/setup
  20. 0
    0
      dotfiles/config/bashum/user/amahdal.bashrc
  21. 1
    1
      dotfiles/config/gittum/bin/metacm
  22. 0
    0
      dotfiles/config/gittum/bin/remote-edit
  23. 21
    0
      dotfiles/config/gittum/bin/setup
  24. 0
    0
      dotfiles/config/gittum/bin/sibling
  25. 35
    9
      dotfiles/config/gittum/bin/slurp
  26. 0
    0
      dotfiles/config/gittum/bin/who
  27. 0
    0
      dotfiles/config/gittum/bin/whoo
  28. 0
    0
      dotfiles/config/gittum/bin/xtragc
  29. 0
    0
      dotfiles/config/gittum/disabled-commands
  30. 1
    0
      dotfiles/config/gittum/host/adoref.gitconfig
  31. 1
    0
      dotfiles/config/gittum/host/malakar.gitconfig
  32. 1
    0
      dotfiles/config/gittum/host/morel.gitconfig
  33. 1
    0
      dotfiles/config/gittum/host/nauron.gitconfig
  34. 1
    0
      dotfiles/config/gittum/host/tamten.gitconfig
  35. 1
    0
      dotfiles/config/gittum/host/vagrus.gitconfig
  36. 16
    11
      dotfiles/config/gittum/main.gitconfig
  37. 0
    0
      dotfiles/config/gittum/template/msg_bumpv
  38. 0
    0
      dotfiles/config/gittum/template/msg_wip
  39. 0
    0
      dotfiles/config/i3/bin/cstatus
  40. 0
    0
      dotfiles/config/i3/bin/i3-focuswin
  41. 0
    0
      dotfiles/config/i3/bin/i3-lswin
  42. 0
    0
      dotfiles/config/i3/bin/i3staplus
  43. 11
    22
      dotfiles/config/i3/config
  44. 0
    0
      dotfiles/config/i3/macros/9.xdotool
  45. 0
    0
      dotfiles/config/i3/macros/apostrophe.xdotool
  46. 0
    0
      dotfiles/config/i3/macros/asterisk.xdotool
  47. 0
    0
      dotfiles/config/i3/macros/bracketleft.xdotool
  48. 0
    0
      dotfiles/config/i3/macros/bracketright.xdotool
  49. 0
    0
      dotfiles/config/i3/macros/comma.xdotool
  50. 0
    0
      dotfiles/config/i3/macros/grave.xdotool
  51. 0
    0
      dotfiles/config/i3/macros/period.xdotool
  52. 0
    0
      dotfiles/config/i3/macros/semicolon.xdotool
  53. 0
    0
      dotfiles/config/i3/macros/slash.xdotool
  54. 49
    0
      dotfiles/config/i3/macros/xt.dash
  55. 1
    0
      dotfiles/config/mutt/muttrc
  56. 0
    21
      dotfiles/gittum/bin/setup
  57. 0
    2
      dotfiles/gittum/template/msg_flake8
  58. 0
    3
      dotfiles/gittum/template/msg_tmp
  59. 0
    2
      dotfiles/gittum/template/msg_typo
  60. 2
    1
      dotfiles/signature

+ 0
- 1
dotfiles/bash View File

@@ -1 +0,0 @@
1
-bashum

+ 0
- 18
dotfiles/bashum/head.bashrc View File

@@ -1,18 +0,0 @@
1
-#!/bin/bash
2
-
3
-mkdir -p /var/tmp/bash-rv
4
-
5
-BASHUM_TASK_CTX=false
6
-BASHUM_BMO_NAG=false
7
-
8
-for include in \
9
-  "${HOME}/.bash/colors.bashrc" \
10
-  "${HOME}/.bash/defaults.bashrc" \
11
-  "${HOME}/.bash/main.bashrc" \
12
-  "${HOME}/.bash/user/$USER.bashrc" \
13
-  "${HOME}/.bash/host/$(hostname -s).bashrc" \
14
-  "${HOME}/.bash/post.bashrc";
15
-do
16
-  test -f "$include" && . "$include";
17
-done
18
-true

+ 0
- 1
dotfiles/bashum/host/morel.bashrc View File

@@ -1 +0,0 @@
1
-../../../../../config/dotfiles/bash/host/morel.bashrc

+ 2
- 0
dotfiles/config/Xlib/global.Xdefaults View File

@@ -1,3 +1,5 @@
1
+Xcursor.size:               8
2
+
1 3
 URxvt.mapAlert:             true
2 4
 
3 5
 !## extensions

dotfiles/bashum/colors.bashrc → dotfiles/config/bashum/colors.bashrc View File

@@ -1,11 +1,19 @@
1 1
 #!/bin/bash
2
+#shellcheck disable=SC1087,SC2034
2 3
 
3 4
 #
4 5
 # Context symbol used in title and prompt
5 6
 #
6 7
 BASHUM_CTXSYM=${BASHUM_CTXSYM:-}
7 8
 
8
-# get some fancy colorz
9
+#
10
+# ANSI color codes
11
+#
12
+# Don't use these in prompts or line editing will likely be
13
+# broken.  (Bash/readline will count these character despite
14
+# the fact they don't move the cursor.)  Use BASHUM_PS_COLOR_*
15
+# instead.
16
+#
9 17
 BASHUM_COLOR_BLACK=$'\033[0;30m'
10 18
 BASHUM_COLOR_RED=$'\033[0;31m'
11 19
 BASHUM_COLOR_GREEN=$'\033[0;32m'
@@ -24,7 +32,13 @@ BASHUM_COLOR_LCYAN=$'\033[1;36m'
24 32
 BASHUM_COLOR_LWHITE=$'\033[1;37m'
25 33
 BASHUM_COLOR_NORMAL=$'\033[1;0m'
26 34
 
27
-# get some fancy colorz
35
+#
36
+# ANSI color codes
37
+#
38
+# Unlike BASHUM_COLOR_*, these have extra escapes for Bash
39
+# so that they can be used in Bash prompt without breaking
40
+# line editing.
41
+#
28 42
 BASHUM_PS_COLOR_BLACK=$'\[\033[0;30m\]'
29 43
 BASHUM_PS_COLOR_RED=$'\[\033[0;31m\]'
30 44
 BASHUM_PS_COLOR_GREEN=$'\[\033[0;32m\]'
@@ -43,7 +57,6 @@ BASHUM_PS_COLOR_LCYAN=$'\[\033[1;36m\]'
43 57
 BASHUM_PS_COLOR_LWHITE=$'\[\033[1;37m\]'
44 58
 BASHUM_PS_COLOR_NORMAL=$'\[\033[1;0m\]'
45 59
 
46
-#shellcheck disable=SC1087
47 60
 bashum__colordemo() {
48 61
     local bla=$BASHUM_COLOR_BLACK
49 62
     local red=$BASHUM_COLOR_RED

dotfiles/bashum/defaults.bashrc → dotfiles/config/bashum/defaults.bashrc View File


+ 18
- 0
dotfiles/config/bashum/head.bashrc View File

@@ -0,0 +1,18 @@
1
+#!/bin/bash
2
+
3
+mkdir -p /var/tmp/bashum-rv
4
+
5
+BASHUM_TASK_CTX=false
6
+BASHUM_BMO_NAG=false
7
+
8
+for include in \
9
+  "${HOME}/.config/bashum/colors.bashrc" \
10
+  "${HOME}/.config/bashum/defaults.bashrc" \
11
+  "${HOME}/.config/bashum/main.bashrc" \
12
+  "${HOME}/.config/bashum/user/$USER.bashrc" \
13
+  "${HOME}/.config/bashum/host/$(hostname -s).bashrc" \
14
+  "${HOME}/.config/bashum/post.bashrc";
15
+do
16
+  test -f "$include" && . "$include"
17
+done
18
+true

dotfiles/bashum/host/README → dotfiles/config/bashum/host/README View File


dotfiles/bashum/host/den.bashrc → dotfiles/config/bashum/host/den.bashrc View File


dotfiles/bashum/host/kana.bashrc → dotfiles/config/bashum/host/kana.bashrc View File


dotfiles/bashum/host/malinovka.bashrc → dotfiles/config/bashum/host/malinovka.bashrc View File


dotfiles/bashum/host/malista.bashrc → dotfiles/config/bashum/host/malista.bashrc View File


+ 1
- 0
dotfiles/config/bashum/host/morel.bashrc View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/config/bashum/host/morel.bashrc

dotfiles/bashum/host/singletop.bashrc → dotfiles/config/bashum/host/singletop.bashrc View File


dotfiles/bashum/host/tamtam.bashrc → dotfiles/config/bashum/host/tamtam.bashrc View File


dotfiles/bashum/host/tamten.bashrc → dotfiles/config/bashum/host/tamten.bashrc View File


dotfiles/bashum/main.bashrc → dotfiles/config/bashum/main.bashrc View File

@@ -13,6 +13,21 @@ test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
13 13
 ### SUBZ ###
14 14
 ### '''' ###
15 15
 
16
+prepend() {
17
+    #
18
+    # pre-pend $2 to filename $1
19
+    #
20
+    local path=$1
21
+    local prefix=$2
22
+    local dirpath
23
+    local filename
24
+    local abspath
25
+    abspath=$(readlink -f "$path")
26
+    dirpath=$(dirname "$abspath")
27
+    filename=$(basename "$abspath")
28
+    echo mv "$path" "$dirpath/$prefix-$filename"
29
+}
30
+
16 31
 smv() {
17 32
     #
18 33
     # scp but rm the source
@@ -39,17 +54,58 @@ smvr() {
39 54
     scp -r "$src" "$dst" && rm -r "$src"
40 55
 }
41 56
 
42
-
43
-bb() {
57
+snore() {
44 58
     #
45
-    # Ring the bell
59
+    # Sleep loudly-ish for $1 time
46 60
     #
47 61
     local stime=${1:-0}
48 62
     test "$stime" == 0 || echo -e "sleeping for $BASHUM_COLOR_LGREEN$stime$BASHUM_COLOR_NORMAL"
49 63
     sleep "$stime"
64
+}
65
+
66
+dotsleep() {
67
+    #
68
+    # Sleep with dots for $1 seconds
69
+    #
70
+    local secs=$1
71
+    echo -e "sleeping for $BASHUM_COLOR_LGREEN$secs$BASHUM_COLOR_NORMAL seconds"
72
+    local secs_togo=$secs
73
+    while test "$secs_togo" -gt 0; do
74
+        sleep 1
75
+        echo -n .
76
+        ((secs_togo--))
77
+    done
78
+    echo
79
+}
80
+
81
+bb() {
82
+    #
83
+    # Ring the bell after $1 time of sleep
84
+    #
85
+    local stime=${1:-0}
86
+    snore "$stime"
50 87
     printf '\a'
51 88
 }
52 89
 
90
+spec_cksources() {
91
+    #
92
+    # Check Source?: URL's in RPM spec file $1
93
+    #
94
+    local file=$1
95
+    local hdr
96
+    local url
97
+    rpmspec -P "$file" \
98
+      | grep -E 'Source[0-9]+: *http' \
99
+      | while read -r hdr url; do
100
+            echo -n "$hdr: $url .."
101
+            curl -fsSL -I "$url" >/dev/null || {
102
+                echo fail
103
+                return 1
104
+            }
105
+            echo ok
106
+        done
107
+}
108
+
53 109
 nn() {
54 110
     #
55 111
     # Ring the bell and send notification $1 after $2 time
@@ -72,10 +128,34 @@ pp() {
72 128
     read -r junk -p "Press Enter to continue"
73 129
 }
74 130
 
131
+wrep() {
132
+    #
133
+    # Print each line on STDIN $1 times horizontally
134
+    #
135
+    echo >&2 "use sdup -w instead!"
136
+    local rep=${1:-1}; shift
137
+    local delim=${1:-" "}; shift
138
+    local line
139
+    local n
140
+    while read -r line; do
141
+        local head=true
142
+        n=$rep
143
+        while test "$n" -gt 0;
144
+        do
145
+            $head || echo -n "$delim"
146
+            $head && head=false
147
+            echo -n "$line"
148
+            ((n--))
149
+        done
150
+        echo
151
+    done
152
+}
153
+
75 154
 lrep() {
76 155
     #
77 156
     # Print each line on STDIN $1 times
78 157
     #
158
+    echo >&2 "use sdup -l instead!"
79 159
     local rep=${1:-1}; shift
80 160
     local line
81 161
     local n
@@ -93,6 +173,7 @@ prep() {
93 173
     #
94 174
     # Print STDIN $1 times
95 175
     #
176
+    echo >&2 "use sdup instead!"
96 177
     local rep=${1:-1}; shift
97 178
     local data
98 179
     data=$(cat)
@@ -419,13 +500,73 @@ xop() {
419 500
     # Common clipboard operations with fixnl() on top
420 501
     #
421 502
     local op=$1
422
-    local file=${2:-/dev/stdin}
503
+    local arg=${2:-/dev/stdin}
423 504
     case $op in
424
-        oo) xclip -selection clipboard -o    | fixnl ;;
425
-        o)  xclip -o                         | fixnl ;;
426
-        ii) fixnl -c | xclip -selection clipboard -i ;;
427
-        i)  fixnl -c | xclip -i                      ;;
428
-    esac <"$file"
505
+        aa) <<<"$arg" fixnl -c | xclip -selection clipboard -i ;;
506
+        a)  <<<"$arg" fixnl -c | xclip -i                      ;;
507
+        ii) <"$arg"   fixnl -c | xclip -selection clipboard -i ;;
508
+        i)  <"$arg"   fixnl -c | xclip -i                      ;;
509
+        oo) <"$arg"   xclip -selection clipboard -o    | fixnl ;;
510
+        o)  <"$arg"   xclip -o                         | fixnl ;;
511
+        *)  return 2 ;;
512
+    esac
513
+}
514
+
515
+xt() {
516
+    #
517
+    # Type out selection clipboard content using xdotool
518
+    #
519
+    local stime=${1:-3}
520
+    local body
521
+    snore "$stime"
522
+    body=$(xo)
523
+    xdotool type "$body"
524
+}
525
+
526
+xtt() {
527
+    #
528
+    # Type out C-C clipboard content using xdotool
529
+    #
530
+    local stime=${1:-3}
531
+    local body
532
+    snore "$stime"
533
+    body=$(xoo)
534
+    xdotool type "$body"
535
+}
536
+
537
+xdl() {
538
+    #
539
+    # Download URL from primary clipboard to path $1
540
+    #
541
+    local dest=$1
542
+    local url
543
+    url=$(xo)
544
+    _xdl "$dest" "$url"
545
+}
546
+
547
+xxdl() {
548
+    #
549
+    # Download URL from C-C clipboard to path $1
550
+    #
551
+    local dest=$1
552
+    local url
553
+    url=$(xoo)
554
+    _xdl "$dest" "$url"
555
+}
556
+
557
+_xdl() {
558
+    #
559
+    # Download URL from primary clipboard to path $1
560
+    #
561
+    local dest=$1
562
+    local url=$2
563
+    local es
564
+    test -n "$dest" || return 2
565
+    test -f "$dest" && return 2
566
+    test -n "$url" || return 2
567
+    curl -fsSL "$url" >"$dest"; es=$?
568
+    bb
569
+    return $es
429 570
 }
430 571
 
431 572
 xod() {
@@ -481,7 +622,7 @@ xvxx() {
481 622
     # back to the browser and paste it over the old (still selected) text.
482 623
     # That's it, no need to make up and save temporary files.
483 624
     #
484
-    # If you quickly realize you need to re-edit the text, use xvvx().
625
+    # If you quickly realize you need to re-edit the text, use xxvxx().
485 626
     #
486 627
     xop o | vipe | xop ii
487 628
 }
@@ -509,7 +650,37 @@ xpst() {
509 650
                 echo "does not exist: $path"
510 651
                 continue
511 652
             }
512
-            cp -r "$path" .
653
+            cp -ar "$path" .
654
+        done
655
+}
656
+
657
+xpst_l() {
658
+    #
659
+    # Symlink paths from clipboard, with relative paths
660
+    #
661
+    { xop o; echo; } \
662
+      | while read -r path; do
663
+            echo "path='$path'" >&2
664
+            test -e "$path" || {
665
+                echo "does not exist: $path"
666
+                continue
667
+            }
668
+            ln -sr "$path" .
669
+        done
670
+}
671
+
672
+xpst_la() {
673
+    #
674
+    # Symlink paths from clipboard, with absolute paths
675
+    #
676
+    { xop o; echo; } \
677
+      | while read -r path; do
678
+            echo "path='$path'" >&2
679
+            test -e "$path" || {
680
+                echo "does not exist: $path"
681
+                continue
682
+            }
683
+            ln -s "$path" .
513 684
         done
514 685
 }
515 686
 
@@ -535,7 +706,7 @@ vxx() {
535 706
     # or another GUI application.  Run the command with `vxx`, edit
536 707
     # the text, move back to the application and paste it.
537 708
     #
538
-    # If you quickly realize you need to re-edit the text, use xvvx().
709
+    # If you quickly realize you need to re-edit the text, use xxvxx().
539 710
     #
540 711
     vipe | xop ii
541 712
 }
@@ -544,7 +715,7 @@ xcxx() {
544 715
     #
545 716
     # Filter text in primary clipboard using command $@ and save it to C-C clipboard
546 717
     #
547
-    # Similar to xvvx() but instead of interactive editing, provided filter
718
+    # Similar to xvxx() but instead of interactive editing, provided filter
548 719
     # command is run.
549 720
     #
550 721
     local cmd=("$@")
@@ -552,6 +723,42 @@ xcxx() {
552 723
     return "${PIPESTATUS[1]}"
553 724
 }
554 725
 
726
+xtrans() {
727
+    #
728
+    # Translate text in primary clipboard using code $1 and output it
729
+    #
730
+    # Similar to xcxx but assumes code snippet, and prints the result
731
+    # to make it easier to check it visually.
732
+    #
733
+    local code=$1
734
+    test $# -gt 1 && code=$(printf '%q ' "$@")
735
+#   echo >&2 "debug:code=$code"
736
+    local es
737
+    xop o | bash -c "$code" | xop ii
738
+    es="${PIPESTATUS[1]}"
739
+    xop oo >&2
740
+    echo >&2
741
+    return "$es"
742
+}
743
+
744
+xfromc() {
745
+    #
746
+    # Get text using code $1 and output it
747
+    #
748
+    # Similar to xtrans but assumes code snippet, and prints the result
749
+    # to make it easier to check it visually.
750
+    #
751
+    local code=$1
752
+    test $# -gt 1 && code=$(printf '%q ' "$@")
753
+    echo >&2 "debug:code=$code"
754
+    local es
755
+    bash -c "$code" | xop ii
756
+    es="${PIPESTATUS[0]}"
757
+    xop oo >&2
758
+    echo >&2
759
+    return "$es"
760
+}
761
+
555 762
 vx() {
556 763
     #
557 764
     # Edit stdin and save it to primary clipboard
@@ -609,6 +816,14 @@ cal() {
609 816
         64:*)
610 817
             command cal -M "$@"
611 818
             ;;
819
+        127:*)
820
+            echo >&2 "cal(): cal command is not installed"
821
+            return 127
822
+            ;;
823
+        *)
824
+            echo >&2 "cal(): error: cal_es=$cal_es, cal_v=$cal_v"
825
+            return 5
826
+            ;;
612 827
     esac
613 828
 }
614 829
 
@@ -617,18 +832,17 @@ cal() {
617 832
 ### '''' ###
618 833
 
619 834
 HISTCONTROL=ignoredups:erasedups
620
-shopt -s histappend
621
-PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
835
+# shopt -s histappend
836
+# PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
622 837
 
623 838
 HISTIGNORE="$HISTIGNORE:ls:ll:la:cd"
624
-HISTIGNORE="$HISTIGNORE:git dc:git st"
625
-HISTIGNORE="$HISTIGNORE:reset"
839
+HISTIGNORE="$HISTIGNORE:git st"
626 840
 HISTIGNORE="$HISTIGNORE:se *:sc *"
627
-HISTSIZE=-1
628
-HISTFILESIZE=100000
841
+HISTSIZE=33333
842
+HISTFILESIZE=33333
629 843
 HISTTIMEFORMAT='%F %T '
630 844
 GLOBIGNORE=.:..
631
-shopt -s histverify
845
+# shopt -s histverify
632 846
 
633 847
 # some more aliases
634 848
 alias cls='clear'
@@ -650,25 +864,35 @@ alias lsblk='lsblk -o +UUID,LABEL'
650 864
 alias pstree='pstree -h'
651 865
 alias virsh='virsh --connect qemu:///system'
652 866
 alias wttr='curl -s "wttr.in/?1&n&q"'
653
-alias xaa='xclip -o | audit2allow'
654 867
 alias xi='xop i'
655 868
 alias xii='xop ii'
869
+alias xa='xop a'
870
+alias xaa='xop aa'
656 871
 alias xo='xop o'
657 872
 alias xoo='xop oo'
658 873
 alias reboot="echo -n . ; sync ; echo -n . ; sync ; echo -n . ; systemctl reboot"
659 874
 alias poweroff="echo -n . ; sync ; echo -n . ; sync ; echo -n . ; systemctl poweroff"
660 875
 
661
-x4x() {
876
+x4xx() {
662 877
     #
663 878
     # Pad text from primary clipboard with 4 spaces; save to C-C clipboard
664 879
     #
665 880
     # ...that is, for inclusion as Markdown verbatim text.
666 881
     #
667
-    xo | pad4 | xii
882
+    xop oo | pad4 | xop ii
668 883
 }
669 884
 
670
-RV_TMP="/tmp/bash-rv"
671
-mkdir -p "$RV_TMP"
885
+x4x() {
886
+    #
887
+    # Pad text from primary clipboard with 4 spaces; save back
888
+    #
889
+    # ...that is, for inclusion as Markdown verbatim text.
890
+    #
891
+    xop -o | pad4 | xop i
892
+}
893
+
894
+BASHUM__RV_TMP="/tmp/bashum-rv"
895
+mkdir -p "$BASHUM__RV_TMP"
672 896
 
673 897
 ### ...... ###
674 898
 ### OTHERS ###
@@ -686,6 +910,8 @@ export PRETTY_DEBUG_EXCLUDE=inigrep
686 910
 export MDVIMB__CONVERTER=cmark
687 911
 export MDVIMB__STYLE=darkzen    # pergamen
688 912
 
913
+export MYPY_CACHE_DIR="$HOME/.cache/mypy/the_darn_cache"
914
+
689 915
 #shellcheck disable=SC2034
690 916
 {
691 917
     GIT_PS1_SHOWDIRTYSTATE=true

dotfiles/bashum/post.bashrc → dotfiles/config/bashum/post.bashrc View File

@@ -9,7 +9,7 @@ __bashum__lastrv() {
9 9
     local rvfile        # path to return value cache file
10 10
     local lastrv        # actual last return value
11 11
     local do_rm         # true if we should remove the cache
12
-    rvfile="$RV_TMP/$$.lastrv"
12
+    rvfile="$BASHUM__RV_TMP/$$.lastrv"
13 13
     lastrv="$(cat "$rvfile")"
14 14
     do_rm=false
15 15
     test "$1" == "-r" && do_rm=true
@@ -23,7 +23,7 @@ __bashum__lastrv() {
23 23
 }
24 24
 
25 25
 __bashum__save_rv() {
26
-    local rvfile="$RV_TMP/$$.lastrv"
26
+    local rvfile="$BASHUM__RV_TMP/$$.lastrv"
27 27
     [ -w "${rvfile%/*}" ] && echo "$1" > "$rvfile"
28 28
 }
29 29
 
@@ -102,13 +102,13 @@ __bashum__wdir() {
102 102
     #
103 103
     local mode=${1:-normal}
104 104
     case $mode:$PWD in
105
-        shrinky:*)              __bashum__shrinkypath "$PWD" ;;
106
-        normal:*)               echo "${PWD/$HOME/\~}" ;;
107
-        short:$HOME)            echo "~" ;;
108
-        short:$HOME/??????????) echo "${PWD/$HOME/\~}" ;;
109
-        short:$HOME/*/*)        echo "…${PWD##*/}" ;;
110
-        short:$HOME/*)          echo "${PWD/$HOME/\~}" ;;
111
-        short:*)                echo "$PWD" ;;
105
+        shrinky:*)                  __bashum__shrinkypath "$PWD" ;;
106
+        normal:*)                   echo "${PWD/$HOME/\~}" ;;
107
+        short:"$HOME")              echo "~" ;;
108
+        short:"$HOME"/??????????)   echo "${PWD/$HOME/\~}" ;;
109
+        short:"$HOME"/*/*)          echo "…${PWD##*/}" ;;
110
+        short:"$HOME"/*)            echo "${PWD/$HOME/\~}" ;;
111
+        short:*)                    echo "$PWD" ;;
112 112
     esac
113 113
 }
114 114
 
@@ -118,8 +118,8 @@ __bashum__shrinkypath() {
118 118
     #
119 119
     local path=$1
120 120
     case $path in
121
-        $HOME)      echo "~"; return ;;
122
-        $HOME/*)    echo -n "~"; __bashum__shrink_relpath "${path#$HOME/}" ;;
121
+        "$HOME")    echo "~"; return ;;
122
+        "$HOME"/*)  echo -n "~"; __bashum__shrink_relpath "${path#$HOME/}" ;;
123 123
         *)          echo "$path"; return ;;
124 124
     esac
125 125
 }

dotfiles/bashum/setup → dotfiles/config/bashum/setup View File

@@ -1,17 +1,17 @@
1 1
 #!/bin/bash
2 2
 
3 3
 put() {
4
-    echo "$1" >> "$HOME/.bashrc"
4
+    echo "$1" >>"$HOME/.bashrc"
5 5
 }
6 6
 
7 7
 mark="# added by https://gitea.vornet.cz/netvor/mydots"
8 8
 if grep -qFe "$mark" "$HOME/.bashrc";
9 9
 then
10
-    echo "already set up, giving up";
10
+    echo >&2 "already set up, giving up";
11 11
     exit 1;
12 12
 else
13 13
     put ''
14 14
     put '# added by https://gitea.vornet.cz/netvor/mydots'
15
-    put 'test -f "${HOME}/.bash/head.bashrc" \'
16
-    put ' && . "${HOME}/.bash/head.bashrc"'
15
+    put 'test -f "${HOME}/.config/bashum/head.bashrc" \'
16
+    put ' && . "${HOME}/.config/bashum/head.bashrc"'
17 17
 fi

dotfiles/bashum/user/amahdal.bashrc → dotfiles/config/bashum/user/amahdal.bashrc View File


dotfiles/gittum/bin/metacm → dotfiles/config/gittum/bin/metacm View File

@@ -12,7 +12,7 @@ mktmpl() {
12 12
     local mtmpl_name="$1"; shift
13 13
     local mtmpl_path
14 14
     local tmpl_path
15
-    mtmpl_path="$HOME/.gittum/template/$mtmpl_name"
15
+    mtmpl_path="$HOME/.config/gittum/template/$mtmpl_name"
16 16
     test -f "$mtmpl_path" || die "no such meta-template: $mtmpl_path"
17 17
     bash -n "$mtmpl_path" || die
18 18
     tmpl_path="/.$(mktemp -t gittum-metacm.XXXXXXXX)"

dotfiles/gittum/bin/remote-edit → dotfiles/config/gittum/bin/remote-edit View File


+ 21
- 0
dotfiles/config/gittum/bin/setup View File

@@ -0,0 +1,21 @@
1
+#!/bin/bash
2
+
3
+gitver=$(git --version | cut -d ' ' -f 3)
4
+if [[ "x$gitver" > "x1.8" ]]; then
5
+    tilde='~'
6
+else
7
+    tilde=$HOME
8
+fi
9
+
10
+host=$(hostname -s)
11
+user=$(whoami)
12
+
13
+mkconfig() {
14
+    echo "[include]"
15
+    echo "    path = $tilde/.config/gittum/main.gitconfig"
16
+    echo "    path = $tilde/.config/gittum/host/$host.gitconfig"
17
+    echo "    path = $tilde/.config/gittum/user/$user.gitconfig"
18
+    echo "    path = $tilde/.config/gittum/private.gitconfig"
19
+}
20
+
21
+mkconfig >>"$HOME/.gitconfig"

dotfiles/gittum/bin/sibling → dotfiles/config/gittum/bin/sibling View File


dotfiles/gittum/bin/slurp → dotfiles/config/gittum/bin/slurp View File

@@ -24,6 +24,17 @@ allowed_slurp() {
24 24
     test -f "$ok_file"
25 25
 }
26 26
 
27
+this_branch_upstream() {
28
+    #
29
+    # Print upstream of current bvranch
30
+    #
31
+    git branch -vv \
32
+      | grep '^\*' \
33
+      | cut -d \] -f1 \
34
+      | cut -d \[ -f2 \
35
+      | cut -d :  -f1
36
+}
37
+
27 38
 allowed_push() {
28 39
     #
29 40
     # Is push allowed for the remote branch??
@@ -38,15 +49,24 @@ allowed_push() {
38 49
     #       main   aaf02f0 [main/master: ahead 25] Some other commit
39 50
     #     * master add0a03 [jdsumsion/master] Some commit
40 51
     #
41
-    local tbranch=$(
42
-        git branch -vv \
43
-          | grep '^\*' \
44
-          | cut -d \] -f1 \
45
-          | cut -d \[ -f2 \
46
-          | cut -d :  -f1
47
-    )
52
+    local tbranch
53
+    test -n "$ok_file" || return 1
54
+    tbranch=$(this_branch_upstream)
48 55
     test -n "$tbranch" || return 0
49
-    grep -qxF "PUSH $tbranch" "$ok_file" 2>/dev/null
56
+    grep -qxE "PUSH ([^ ]+ )?$tbranch" "$ok_file" 2>/dev/null
57
+}
58
+
59
+has_flag() {
60
+    #
61
+    # Has $ok_file have flag $1 for this branch?
62
+    #
63
+    local flag=$1
64
+    local tbranch
65
+    test -n "$ok_file" || return 1
66
+    tbranch=$(this_branch_upstream)
67
+    grep -xE "PUSH [^ ]+ $tbranch" "$ok_file" \
68
+     | cut -d' ' -f2 \
69
+     | grep -qwe "$flag"
50 70
 }
51 71
 
52 72
 git_relative() {
@@ -92,7 +112,11 @@ go_push() {
92 112
     #
93 113
     if $force_push || allowed_push;
94 114
     then
95
-        git push -o ci.skip
115
+        if has_flag ci; then
116
+            git push
117
+        else
118
+            git push -o ci.skip
119
+        fi
96 120
     fi
97 121
 }
98 122
 
@@ -101,9 +125,11 @@ main() {
101 125
     local ok_file
102 126
     local force_slurp=false
103 127
     local force_push=false
128
+    local skip_ci=true
104 129
     while true; do case $1 in
105 130
         --force-slurp)  force_slurp=true; shift ;;
106 131
         --force-push)   force_push=true;  shift ;;
132
+        --skip-ci)      skip_ci=true; shift ;;
107 133
         --)             shift; break ;;
108 134
         -*)             usage ;;
109 135
         *)              break ;;

dotfiles/gittum/bin/who → dotfiles/config/gittum/bin/who View File


dotfiles/gittum/bin/whoo → dotfiles/config/gittum/bin/whoo View File


dotfiles/gittum/bin/xtragc → dotfiles/config/gittum/bin/xtragc View File


dotfiles/gittum/disabled-commands → dotfiles/config/gittum/disabled-commands View File


+ 1
- 0
dotfiles/config/gittum/host/adoref.gitconfig View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/adoref.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/malakar.gitconfig View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/malakar.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/morel.gitconfig View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/morel.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/nauron.gitconfig View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/nauron.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/tamten.gitconfig View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/tamten.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/vagrus.gitconfig View File

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/vagrus.gitconfig

dotfiles/gittum/main.gitconfig → dotfiles/config/gittum/main.gitconfig View File

@@ -11,15 +11,19 @@
11 11
   blog = log --graph --oneline --pretty=tformat:'%Cred%h%Creset - %C(yellow)%s%Creset %C(green)<%an>%Creset %C(blue)@%d%Creset' --abbrev-commit
12 12
   cm = commit --verbose
13 13
   cma = commit --verbose --amend
14
-  cmf = !~/.gittum/bin/metacm msg_flake8
15
-  cmt = !~/.gittum/bin/metacm msg_tmp
16
-  cmr = !~/.gittum/bin/metacm msg_typo
17
-  cmv = !~/.gittum/bin/metacm msg_bumpv
18
-  cmw = !~/.gittum/bin/metacm msg_wip
14
+  cme = commit --allow-empty -m 'WIP empty commit just for the kicks'
15
+  cmv = !~/.config/gittum/bin/metacm msg_bumpv
16
+  cmw = !~/.config/gittum/bin/metacm msg_wip
19 17
   co = checkout
20 18
   com = checkout master
21 19
   cp = cherry-pick
22 20
   dc = !clear && git diff --cached
21
+  dcw = !clear && git diff --cached --word-diff=color
22
+  dcp = !clear && git diff --cached --word-diff=porcelain
23
+  dcc = !clear && git diff --cached --word-diff=color --word-diff-regex=.
24
+  df = diff --word-diff=color
25
+  dfp = diff --word-diff=porcelain
26
+  dfc = diff --word-diff=color --word-diff-regex=.
23 27
   gr = log --graph --full-history --color\
24 28
        --pretty=tformat:"%x1b[31m%h%x20%x1b[32m%d%x1b[0m%x20%s%x1b[0m"
25 29
   gra = log --all --graph --full-history --color\
@@ -34,18 +38,19 @@
34 38
   rb = rebase
35 39
   rbc = rebase --continue
36 40
   rbi = rebase --interactive
37
-  rme = ! ~/.gittum/bin/remote-edit
41
+  rme = ! ~/.config/gittum/bin/remote-edit
38 42
   rmv = remote --verbose
39
-  sibling = ! ~/.gittum/bin/sibling
40
-  slurp = ! ~/.gittum/bin/slurp
43
+  sibling = ! ~/.config/gittum/bin/sibling
44
+  slurp = ! ~/.config/gittum/bin/slurp
41 45
   st = status
42 46
   sh = show
43 47
   sw = show --word-diff=color
44 48
   swp = show --word-diff=porcelain
45 49
   swc = show --word-diff=color --word-diff-regex=.
46
-  who = ! ~/.gittum/bin/who
47
-  whoo = ! ~/.gittum/bin/whoo
48
-  xtragc = ! ~/.gittum/bin/xtragc
50
+  swm = show --format="format:%B" --no-patch
51
+  who = ! ~/.config/gittum/bin/who
52
+  whoo = ! ~/.config/gittum/bin/whoo
53
+  xtragc = ! ~/.config/gittum/bin/xtragc
49 54
 
50 55
 [diff]
51 56
     guitool = kdiff3

dotfiles/gittum/template/msg_bumpv → dotfiles/config/gittum/template/msg_bumpv View File


dotfiles/gittum/template/msg_wip → dotfiles/config/gittum/template/msg_wip View File


dotfiles/i3/bin/cstatus → dotfiles/config/i3/bin/cstatus View File


dotfiles/i3/bin/i3-focuswin → dotfiles/config/i3/bin/i3-focuswin View File


dotfiles/i3/bin/i3-lswin → dotfiles/config/i3/bin/i3-lswin View File


dotfiles/i3/bin/i3staplus → dotfiles/config/i3/bin/i3staplus View File


dotfiles/i3/config → dotfiles/config/i3/config View File

@@ -319,22 +319,11 @@ mode "resize" {
319 319
         bindsym Escape      mode "default"
320 320
 }
321 321
 
322
-bar {
323
-    id clementine
324
-    status_command "~/.i3/bin/cstatus"
325
-    workspace_buttons no
326
-    tray_output none
327
-    mode hide
328
-    hidden_state hide
329
-    modifier none
330
-    output eDP-1
331
-}
332
-
333 322
 bindsym --release button3 kill
334 323
 
335 324
 bar {
336 325
         id main
337
-        status_command "~/.i3/bin/i3staplus"
326
+        status_command "~/.config/i3/bin/i3staplus"
338 327
         bindsym button2 exec thunar
339 328
         bindsym button3 exec "$spn xclose"
340 329
         separator_symbol "•"
@@ -431,16 +420,16 @@ bindsym XF86AudioMute           exec "$spn bmo au flip"
431 420
 ## Typing macros wow                                                    ##
432 421
 #------------------------------------------------------------------------#
433 422
 
434
-bindsym --release $mod+Ctrl+apostrophe      exec "xdotool .i3/macros/apostrophe.xdotool"
435
-bindsym --release $mod+Ctrl+asterisk        exec "xdotool .i3/macros/asterisk.xdotool"
436
-bindsym --release $mod+Ctrl+slash           exec "xdotool .i3/macros/slash.xdotool"
437
-bindsym --release $mod+Ctrl+comma           exec "xdotool .i3/macros/comma.xdotool"
438
-bindsym --release $mod+Ctrl+semicolon       exec "xdotool .i3/macros/semicolon.xdotool"
439
-bindsym --release $mod+Ctrl+period          exec "xdotool .i3/macros/period.xdotool"
440
-bindsym --release $mod+Ctrl+9               exec "xdotool .i3/macros/9.xdotool"
441
-bindsym --release $mod+Ctrl+grave           exec "xdotool .i3/macros/grave.xdotool"
442
-bindsym --release $mod+Ctrl+bracketleft     exec "xdotool .i3/macros/bracketleft.xdotool"
443
-bindsym --release $mod+Ctrl+bracketright    exec "xdotool .i3/macros/bracketright.xdotool"
423
+bindsym --release $mod+Ctrl+apostrophe      exec "xdotool .config/i3/macros/apostrophe.xdotool"
424
+bindsym --release $mod+Ctrl+asterisk        exec "xdotool .config/i3/macros/asterisk.xdotool"
425
+bindsym --release $mod+Ctrl+slash           exec "xdotool .config/i3/macros/slash.xdotool"
426
+bindsym --release $mod+Ctrl+comma           exec "xdotool .config/i3/macros/comma.xdotool"
427
+bindsym --release $mod+Ctrl+semicolon       exec "xdotool .config/i3/macros/semicolon.xdotool"
428
+bindsym --release $mod+Ctrl+period          exec "xdotool .config/i3/macros/period.xdotool"
429
+bindsym --release $mod+Ctrl+9               exec "xdotool .config/i3/macros/9.xdotool"
430
+bindsym --release $mod+Ctrl+grave           exec "xdotool .config/i3/macros/grave.xdotool"
431
+bindsym --release $mod+Ctrl+bracketleft     exec "xdotool .config/i3/macros/bracketleft.xdotool"
432
+bindsym --release $mod+Ctrl+bracketright    exec "xdotool .config/i3/macros/bracketright.xdotool"
444 433
 
445 434
 
446 435
 

dotfiles/i3/macros/9.xdotool → dotfiles/config/i3/macros/9.xdotool View File


dotfiles/i3/macros/apostrophe.xdotool → dotfiles/config/i3/macros/apostrophe.xdotool View File


dotfiles/i3/macros/asterisk.xdotool → dotfiles/config/i3/macros/asterisk.xdotool View File


dotfiles/i3/macros/bracketleft.xdotool → dotfiles/config/i3/macros/bracketleft.xdotool View File


dotfiles/i3/macros/bracketright.xdotool → dotfiles/config/i3/macros/bracketright.xdotool View File


dotfiles/i3/macros/comma.xdotool → dotfiles/config/i3/macros/comma.xdotool View File


dotfiles/i3/macros/grave.xdotool → dotfiles/config/i3/macros/grave.xdotool View File


dotfiles/i3/macros/period.xdotool → dotfiles/config/i3/macros/period.xdotool View File


dotfiles/i3/macros/semicolon.xdotool → dotfiles/config/i3/macros/semicolon.xdotool View File


dotfiles/i3/macros/slash.xdotool → dotfiles/config/i3/macros/slash.xdotool View File


+ 49
- 0
dotfiles/config/i3/macros/xt.dash View File

@@ -0,0 +1,49 @@
1
+#!/bin/bash
2
+
3
+
4
+fixnl () {
5
+    local arg=$1;
6
+    local cache;
7
+    local nlcount;
8
+    local lastchr;
9
+    local single=keep;
10
+    case $arg in 
11
+        -c | --chop-single)
12
+            single=chop
13
+        ;;
14
+    esac;
15
+    cache="$(mktemp -t fixnl.XXXXXXXX)";
16
+    cat > "$cache";
17
+    nlcount=$(<"$cache" wc -l);
18
+    lastchr=$(<"$cache" tail -c1 | hexdump -e '"%02x"');
19
+    case $nlcount:$lastchr:$single in 
20
+        0:??:*)
21
+            cat "$cache"
22
+        ;;
23
+        1:0a:chop)
24
+            head -c -1 "$cache"
25
+        ;;
26
+        1:0a:keep)
27
+            cat "$cache"
28
+        ;;
29
+        *:0a:*)
30
+            cat "$cache"
31
+        ;;
32
+        *:??:*)
33
+            cat "$cache";
34
+            echo
35
+        ;;
36
+    esac;
37
+    rm "$cache"
38
+}
39
+
40
+main () { 
41
+    local body;
42
+    body="$(xclip -o)"
43
+    declare -p body >~/body.declare
44
+    echo -n "$body" | hexdump -C >~/body.hexdump
45
+    sleep 0.5s
46
+    xdotool type "$body"
47
+}
48
+
49
+main "$@"

+ 1
- 0
dotfiles/config/mutt/muttrc View File

@@ -0,0 +1 @@
1
+set folder = "~/.local/share/mutt/Mail"

+ 0
- 21
dotfiles/gittum/bin/setup View File

@@ -1,21 +0,0 @@
1
-#!/bin/bash
2
-
3
-gitver=$(git --version | cut -d ' ' -f 3)
4
-if [[ "x$gitver" > "x1.8" ]]; then
5
-    tilde='~'
6
-else
7
-    tilde=$HOME
8
-fi
9
-
10
-host=$(hostname -s)
11
-user=$(whoami)
12
-
13
-mkconfig() {
14
-    echo "[include]"
15
-    echo "    path = $tilde/.gittum/main.gitconfig"
16
-    echo "    path = $tilde/.gittum/host/$host.gitconfig"
17
-    echo "    path = $tilde/.gittum/user/$user.gitconfig"
18
-    echo "    path = $tilde/.gittum/private.gitconfig"
19
-}
20
-
21
-mkconfig >>"$HOME/.gitconfig"

+ 0
- 2
dotfiles/gittum/template/msg_flake8 View File

@@ -1,2 +0,0 @@
1
-#!/bin/bash
2
-echo Flake8

+ 0
- 3
dotfiles/gittum/template/msg_tmp View File

@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-echo ""
3
-echo "# use this file to define temporary template"

+ 0
- 2
dotfiles/gittum/template/msg_typo View File

@@ -1,2 +0,0 @@
1
-#!/bin/bash
2
-echo "Fix typo"

+ 2
- 1
dotfiles/signature View File

@@ -1,2 +1,3 @@
1 1
 Alois Mahdal <netvor@vornet.cz>
2
-#shellfu, #starapekarna, https://netvor.info/
2
+IRC (netvor at Libera): #shellfu, #vpsfree, #fedora-devel
3
+WWW: https://netvor.info/