Skip to content

redpeacock78/exutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ex-utils_logo

A collection of commands to make the troublesome one-liner a little easier

GitHub License Document ja_JP Document en_US GitHub code size in bytes
Docker Cloud Build Status Docker Pulls
GitHub forks GitHub stars
Twitter URL Twitter Follow

Click here for Japanese → README(JAPANESE)

See the EXAMPLE for detailed usage.

TOC

  • About the concept
  • Installation
    • Dependencies
    • MacOS users
    • Linux users
    • Docker users
  • I want to use it easily without installing :-)
    • Dependencies
    • Method

About the concept

  • Commands that were not likely.
  • A command written in a Bash script.
  • Specializing in command line operation.
  • Complex processing can be expressed with just a few characters.

Installation

Dependencies

  • bash>=5.0
  • awk
  • sed(GNU)
  • grep(GNU)
  • coreutils(GNU)
  • findutils(GNU)
Tips: Install the above and install it with the command corresponding to each of the following after passing through PATH.

MacOS users

# Install
$ brew tap redpeacock78/tools
$ brew install exutils

# Update
$ brew update && brew reinstall exutils
(In the future, we plan to migrate from "brew reinstall" to "brew upgrade" command.)

# Uninstall
$ brew uninstall exutils

Linux users

# Install
$ git clone https://github.com/redpeacock78/exutils.git
$ cd exutils
$ ./install.sh

# For zsh, yash, fish, etc., change the .bashrc part accordingly.
$ echo export PATH='$HOME/.exutils/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc

# Update
$ cd exutils
$ git pull
$ ./install.sh --update

# Uninstall
$ cd exutils
$ ./install.sh --uninstall

### It is possible to install as above, but if you use Linuxbrew you can install it in the same way as MacOS. ###

Docker users

When installing using Docker, there is no need to install Dependencies.

# Install
$ docker pull redpeacock78/exutils

# Write the following function in .bashrc etc.
exutils(){
  [ -t 0 ] && T="t" || T=""
  docker run -i$T --rm docker.io/redpeacock78/exutils "$@"
}
export -f exutils

# Run!
$ source ~/.bashrc
$ exutils prim -v
prim 0.0.1
Copyright (C) 2019 redpeacock78
License GPLv3+: GNU GPL version3 or later.

THIS IS FREE SOFTWARE.
YOU ARE FREE TO CHANGE AND REDISTRIBUTE IT.
THERE IS NO WARRANTY, TO THE EXTENT PERMITTED BY LAW.

Written by redpeacock78 <https://github.com/redpeacock78>.

# Update
$ docker pull redpeacock78/exutils && docker rmi -f $(docker images | grep docker.io/redpeacock78/exutils | grep none | awk '{print $3}')

# Uninstall
$ docker rmi -f $(docker images | grep docker.io/redpeacock78/exutils | grep latest | awk '{print $3}')

I want to use it easily without installing :-)

When using without installation, the following items are required in addition to Dependencies at installation.

Dependencies

  • Internet connection
  • curl

Method

# For temporary use.
$ bash <(curl -s https://raw.githubusercontent.com/redpeacock78/exutils/master/bin/ngram) 御旗のもとに
御旗のもとに御
旗のもとに御旗
のもとに御旗の
もとに御旗のも
とに御旗のもと
に御旗のもとに

# If you want to use it permanently.
# Write the following in .bashrc etc.
exutils(){
  if [[ "${1}" == help ]] || \
     [[ "${@}" == version ]]; then
    bash <(curl -s "https://raw.githubusercontent.com/redpeacock78/exutils/master/docker/bin/${1}") "${2}"
  else
    bash <(curl -s "https://raw.githubusercontent.com/redpeacock78/exutils/master/bin/${1}") "${@:2}"
  fi
}
export -f exutils

# Reload settings.
$ source ~/.bashrc

# Run!
$ exutils help
Commands:
  exutils prim [OPTION] [NUMBER]         # Print prime numbers of given NUMBER.
  exutils camb [OPTION] [NUMBER]         # Displays standard input while convolving.
  exutils divi [OPTION] [NUMBER]         # Display divisor of given NUMBER.
  exutils inv  [OPTION] [ARRAYS]         # Inverts the permutation of the array.
  exutils rpt [OPTION] [STRING] [NUMBER] # Generates the given STRING a specified NUMBER of times.
  exutils ngram [OPTION] [STRING]        # Displays the N-gram of the passed string.
  exutils stalin [OPTION] [ELEMENTS]     # Excutes the Stalin sort algorithm with the calculation 
                                           amount O(n) for the passed elements.
  exutils help [COMMAND]                 # Describe available commands or one specific command.
  exutils version                        # Show version and info

$ exutils prim -w 100 | exutils camb 13
02 03 05 07 11 13 17 19 23 29 31 37 41
03 05 07 11 13 17 19 23 29 31 37 41 43
05 07 11 13 17 19 23 29 31 37 41 43 47
07 11 13 17 19 23 29 31 37 41 43 47 53
11 13 17 19 23 29 31 37 41 43 47 53 59
13 17 19 23 29 31 37 41 43 47 53 59 61
17 19 23 29 31 37 41 43 47 53 59 61 67
19 23 29 31 37 41 43 47 53 59 61 67 71
23 29 31 37 41 43 47 53 59 61 67 71 73
29 31 37 41 43 47 53 59 61 67 71 73 79
31 37 41 43 47 53 59 61 67 71 73 79 83
37 41 43 47 53 59 61 67 71 73 79 83 89
41 43 47 53 59 61 67 71 73 79 83 89 97