Skip to content

gryzus24/dotfiles

Repository files navigation

My dotfiles and scripts
=======================

The dotfiles are not particularly exotic.
What you might find partly useful are the scripts.

Some scripts may be tagged:

  `see source`  these scripts may contain hard-coded values or exhibit
                undesirable behavior; you should certainly read and understand
                their source code before executing them.

  `specific`    these scripts may require some specific hardware configuration
                in order to work correctly or to be by any means useful.

Scripts in ~/bin listed alphabetically
======================================

- _installgofonts (see source)
    Install the best fonts to the ~/.local/share/fonts/Go
    directory and refresh the font cache.
  Dependencies
    * dash (shell)
    * git, fc-cache

- brightness (see source, specific)
    Set backlight brightness to <n> * STEP or query the current
    backlight brightness value if <n> is unspecified.
  Usage
    $ brightness <n>
  Dependencies
    * dash (shell)
    * python (3.7+)

- buddyinfo-mon
    Interactive /proc/buddyinfo monitoring tool.
    Update every <n> seconds or 1s if unspecified.
  Usage
    $ buddyinfo-mon <n>
    --
    j k    line down/up
    space  page down
    g G    top/bottom
    q      quit
  Dependencies
    * python (3.7+)

- cgb
    Print the name of the current git branch in the format: "($branch) "
    or nothing if not inside a git repository. It is meant to be used
    inside of PROMPT_COMMAND or PS1. Compared to other solutions it is
    FAST - ~650 bytes of machine code that glues together a few system
    calls packed into an <4K executable for any x86-64 Linux - your shell
    prompt will never feel sluggish again.
  Usage
    In ~/.bashrc PROMPT_COMMAND:
      PROMPT_COMMAND+=(cgb)
    In ~/.bashrc PS1:
      PS1="\$(cgb)[\u \w]\n$ "
  Crude perf benchmarks
    Context: In the root of a git repository.
    Setup: # perf stat -e cycles,instructions -r 100 "$@"
      __git_ps1                 (~ 11 000 000 instructions)
      git branch --show-current (~  2 780 000 instructions)
      cgb                       (~     85 000 instructions)
  Build dependencies
    * gcc/clang
  Installation
    $ PROGS=cgb ~/bin/src/install.sh

- deduplicate-bash-history
    Remove duplicates from the ~/.bash_history file.
    Only the most recently used commands are kept.
  Dependencies
    * python (3.8+)

- dirg
    Group file paths by the directories they belong to.  File paths
    should be newline delimited and provided as standard input.
  Options
    a  sort alphabetically
    c  show file count per directory
    h  display help and exit
  Usage
    $ <cmd> | dirg [a] [c] [h]
    $ locate path | dirg c
    $ find . -type f | dirg ac
  Alternatives
    If a more readable tree output is preferred
    the tree(1) utility should be used.
    $ <cmd> | tree --fromfile -d
  Dependencies
    * python (3.7+)
  Binary version
    Build dependencies
      * zig (0.12.0)
    Installation
      $ PROGS=dirg ~/bin/src/install.sh

- grepalign
    Align every line of grep output to the first colored match.
  Options
    mask  output mask in a form XXX where X is either a '0' or a '1',
          text before a match _///  mask is equal to 111 if left unspecified.
          match itself ________//
          text after a match __/
  Usage
    Generic:
      $ grep --color=always [...] | grepalign [mask]
    Or with the helpers from ~/.bash_aliases:
      $ faketty grep --color=auto [...] | grepalign [mask]
      $ agrep [...]
  Dependencies
    * python (3.7+)

- hf
    Fuzzy search ~/.bash_history and copy the selection to clipboard.
  Dependencies
    * dash (shell)
    * fzf, python
    * xclip (on Xorg), wl-copy (on Wayland)

- pacilog
    List all explicitly installed pacman packages.
    Shows
      * time of installation
      * package name
      * version at the time of installation
      * version installed now
  Dependencies
    * python (3.7+)
    * pacman

- pacsize
    List all installed pacman packages sorted by size.
  Dependencies
    * python (3.7+)

- pactl-next-sink
    Switch to the next available pipewire/pulseaudio sink.
  Dependencies
    * python (3.7+)
    * pactl

- rename-tool
    Run <command> (e.g. an image viewer) on every <file> and ask for a new
    name for that <file>.  Does not allow overwriting a file that already
    exists on the filesystem.
  Limitations
    * does not support two-cell wide character input (i.e. Kanji, emoji)
    * does not allow coming back to an already renamed file
  Usage
    $ rename-tool -e <command> [files...]
    $ rename-tool -e sxiv img0.jpg img1.jpg
  Dependencies
    * python (3.7+)

- scrot-clip (see source)
    Run scrot in "--select" mode and copy the selected image to clipboard.
  Dependencies
    * dash (shell)
    * scrot, xclip
    * xdotool (required when using unclutter)

- scrot-sxiv (see source)
    Run scrot in "--select --freeze" mode, save the selected image to
    $XDG_PICTURES/Scrots and open it in sxiv.
  Dependencies
    * dash (shell)
    * scrot, sxiv
    * xdotool (required when using unclutter)

- touchpad-toggle (specific)
    Toggle (enable/disable) the Synaptics TouchPad.

- update-mirrorlist (see source)
    Update the /etc/pacman.d/mirrorlist file.
  Dependencies
    * dash (shell)
    * reflector, diff

- wsort
    Sort words on a line or multiple lines
    (preserves line order and whitespace).
  Usage
    Generic:
      $ echo 'Ala    ma wielkiego    kota' | wsort
    Or in Vim command-line mode afer visually selecting a line:
      :!wsort
  Dependencies
    * python (3.7+)

Bash functions in ~/.bash_aliases
=================================
- cdw
    cd into $(dirname $(which $1)).

- faketty
    Make <command> think its attached to a tty.
  Usage
    $ faketty <command>

- agrep
    Alias to grep piped into grepalign.

- wmem
    Watch (Buffers, Dirty and Writeback) entries from /proc/meminfo.
    Update every <n> seconds or 0.5s if unspecified.
  Usage
    $ wmem <n>
  Dependencies
    * luajit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks