README.md (4259B)
1 # g6scripts 2 3 A collection of personal scripts I use. 4 5 6 ## contents 7 8 1. [overview](#overview) 9 2. [installing](#installing) 10 3. [uninstall](#uninstall) 11 4. [notes](#notes) 12 5. [scripts](#scripts) 13 14 15 ## overview 16 17 I use most of these scripts for convenience and to save on typing. 18 19 More recently I've been making an effort to learn PowerShell as I tend to use windows a fair bit too, so there are a few one-off scripts used for that too. 20 21 - **nix/** - Scripts for POSIX (Unix, MacOS, Linux, etc) machines. Mostly written in `sh` and `bash`. 22 - **win/** - Scripts for Windows. Using `PowerShell` 23 - **any/** - Scripts for multiple environments (mostly `Python`). 24 25 ## ./install.sh (posix only) 26 27 I've created an install script (bash) to help with selecting the scripts you want to install. 28 29 usage: ./install [ARGUMENTS] [SCRIPT] 30 31 SCRIPTS 32 Optionally, you can specify a script to install. 33 Any specified scripts must be the filepath to the 34 script (not just the filename). 35 36 ARGUMENTS 37 -f, --force overwrites files when installing 38 -r, --reinstall re-install scripts already existing in 39 destination directory 40 -d, --dest [DEST] set the install destination 41 -a, --all install ALL the scripts ('y' to all prompts) 42 -l, --link 'ln' the script (not cp). 43 -h, --help print this dialog 44 45 46 ## notes 47 48 I've added `-h` options to all the scripts. 49 50 Personally find `grepf` and `while-true` to by the most frequently used. 51 52 53 ## windows (powershell) scripts 54 55 - *random* - a script I use to select a random item in a directory. 56 - *zipto7z* - converts all .zip files in current directory to .7z. 57 - *flac2mp3* - convert flac files to mp3 files using ffmpeg. 58 59 ## any 60 61 - *d2h* - convert decimal numbers to hexadecimal. 62 - *h2d* - convert hexadecimal numbers to decimal. 63 - *jiggle* - move the mouse 1px every minute - keep the screen awake. 64 65 66 ## posix scripts 67 68 I make an effort to keep to **sh** when I can - for compatibility-sake. 69 70 **strings & numbers** 71 72 Scripts related to string parsing/manipulation 73 74 - *strindex* - print the index (from 0..n) of the first character in substring $1 found in string $2. 75 - *grepf* - find all files in dir $1, that conatin string $2. I use this one a lot. 76 - *randstr* - generate a random string. 77 78 **file management** 79 80 - *backup* - cp input files $@ from `filename` to `filename.bak` (mv with `-m`). 81 - *catrm* - `rm -i` but with the option to cat the file. 82 - *flac2mp3* - converts .flac files $@ to .mp3. Requires ffmpeg. 83 - *openurl* - xdg-open all links found in files $@. 84 - *mkdcp* - make directory $1 and copy files into it ($2..$n). 85 - *mkdmv* - make directory $1 and move files into it ($2..$n) 86 - *mkdnvim* - make directory $1, touch file $2 and open file $2 in $EDITOR. 87 - *mkdtouch* - make a directory $1, touch files in it ($2..$n). 88 89 **tooling** 90 91 - *pyserve* - shorthand for `python3 -m http.server --directory $1`. 92 - *git-cfg* - shorthand for calling `git config --local user.name $1 && git config --local user.email $2`. 93 - You can also use it for setting global config using `-g` 94 - *git-clone-bulk* - clone a list of git repositories. 95 - *git-pull-all* - pull all remote git branches from the current upstream. 96 - *git-pradd* - git diff $@, for each prompt y/n whether to git add it 97 - *gobuild* - build a go module in all available output formats, useful for releases. 98 - *preview-md* - convert a markdown file $1 to html, open if $2 == "-o" or "--open". 99 - Uses cmark by default, set conversion tool and default output destination in src. 100 - *compress-pdf* - compress a .pdf file ($1), requires *ghostscript* (*gs*). 101 - *rled* - invoke ed with a readline wrapper (for input history) 102 - *gnome-shell-cycle-wallpaper* - One I used to cycle the wallpaper on a GNOME desktop infrequently 103 104 **misc** 105 106 - *shush* - run $@ in the background and hide output. 107 - *pomodoro* - a [pomodoro](https://en.wikipedia.org/wiki/Pomodoro_Technique) timer. 108 - *while-true* - clear the terminal, run $1 sleep ($2 || 1 sec), repeat forever (Ctrl+C to cancel). 109 - *onfilech* - stat a file ($1) every 10 seconds, if the output changes, run a command ($2...$n). 110 111 **depreciated** 112 113 This contains scripts that I once used but aren't required anymore (or I eventually realised were useless). 114 115 116 ## authors 117 118 - gearsix 119