Skip to content

Latest commit

 

History

History
434 lines (265 loc) · 7.94 KB

README.md

File metadata and controls

434 lines (265 loc) · 7.94 KB

cli-utils

Additional command to make a variety of my daily tasks easier.

The following readme is mainly automatically generated from the help menu of each command.

Installation

Use sudo make target1 target2 ... to install all the commands. "target" here are the title of the sections in "Commands".

If you want to install all the target you can run sudo make all, if you run sudo make, only the base target will be installed.

sudo make update will only update already installed package.

Commands

Base

cmdsup

Used to update this package.


Usage: "sudo cmdsup"
	-h help

install-cmd

installs all commands as exectuables to /bin/ and removes the extension.


Usage: "sudo install-cmd cmd1.sh cmd2.py ..."
	-h help

3dPrinting

3dfile-scale-setparam

Sets the scaling for "3dfile-scale".


Usage: "sudo 3dfile-scale-setparam axis (char, 'X', 'Y' or 'Z'), scaling_factor (float), base_height (float), offset (float)"
    -h help

3dfile-scale

Scales a Gcode file. use "param" to set the scaling.


Usage: "3dfile-scale-setparam file1 file2 ..."
    -h help

debian

initall

Installs all .deb or .AppImage the commands find.


Usage: "sudo initall directory1 directory2 ..."
	-h help

desktop

reformat-files-nerd

Reformats all file names to avoid uppercase, special character, and replaces any length of spaces to a single underscore.


Usage: "reformat-files-nerd"
	-h help

compress-all-pdfs

Compresses all pdfs.


Usage: "compress-all-pdfs"
	-h help

	-r recursive

pandoc-convert

Can convert .ipynb, .html, .md, and a lot of file type to some other file types.


Usage: "pandoc-convert -p -o file1 file2 ..."
	-h help

	-p convert to .pdf
	-o convert to .odt
	-d convert to .docx
	-H convert to .html
	-i convert to .ipynb
	-t convert to .txt
	-l convert to .tex

	-O any other type

git

gitcheat

Used to give a small git cheat-sheet.


Usage: "gitcheat -v/t"
    -h help

    -v visual cheat-sheet about branches
    -t textual cheat-sheet

git-delete-history

WARNING: Some part may only works with Github (for now) !

Delete all comit history from the main branch of a repo.


Usage: "git-delete-history"
	-h help
	-v verbose

	-m commit name, default is 'first_commit'
	-b set branch name, default is whatever beanch you are on
	-S hard delete (only for repository set up with "git-remote-gcrypt")
	-H use https (default is ssh) for cloning for hard delete (-S)
	-s (for "git-stage-commit") max added file size [Mb], default is -1 (not limit).
		If negative, will fallback to gitup.
	-p (for "git-stage-commit") push only at the end (default behaviour is to push at each commit)

git-fix-detached-head

Used to fix a "git detached HEAD" error without loosing changes.

Usage: "git-fix-detached-head"
	-h help

	-b set branch name, default is whatever beanch you are on

git-https-to-ssh

Code by Matt Farmer [https://gist.github.com/m14tode] found at [https://gist.github.com/m14t/3056747]

WARNING: Only works with Github (for now)

This command will set the git origin from https to ssh.


Usage: "git-https-to-shh":
	-h help

gitdown

Clones recursively all submodules.


Usage: "gitdown ..."
	-h help

gitup

Equivalent to "git add . ; git commit -am 'update' ; git push -f origin 'branch'"

If "stagecommit.maxfilesize" is set in git config, will fallback to
"git-stage-commit" to respect this set limit.


Usage: "gitup"
	-h help
	-v verbose

	-m commit name, default is 'update'
	-b set branch name, default is whatever beanch you are on
	-A remove the '-a' flag (don't add un-added files)

gogit

Gets the go version of a directory used as a go package.


Usage: "gogit"
	-h help

git-stage-commit

Stage commits so that not too many files are added at once.

It is usefull for "git-remote-gcrypt" so that the encrypted commit doesn't exceed the max commit size.


Usage: "git-stage-commit"
	-h help
	-v verbose

	-s max added file size [Mb], default is 25Mb (half of Github recommandation of 50Mb).
		If negative, will fallback to gitup.
	-m commit name, default is 'update'
	-b set branch name, default is whatever beanch you are on
	-p push only at the end (default behaviour is to push at each commit)

gpg-choose-key

Give choise to user of GPG key, and return (print to stdout) properly formated public key. Is usefull for other commands.


Usage: "choose-gpg-key"
	-h help

	-k key name to first try without user input
	-n number of try (default is 3)
	-y continue for the first try if a key is found.
		ATTENTION: is pretty unsafe because you may have found the wrong key.

gcrypt-set-repo

WARNING: Only works with Github (for now)

Delete all comit history from the main branch of a repo.


Usage: "gcrypt-set-repo"
	-h help

	-u this flag to change remote url
	-k this flag to set gpg key
	-v this flag to set git environment variables

git-redownload-submodules

TODO


Usage: "git-redownload-submodules"
	-h help

	-Y redownload all submodules without asking, !! DANGEROUS !!

git-list-submodules

List all submodules in the current repo.


Usage: "git-list-submodules"
	-h help

	-p print path
	-u print url

nas

smbadd

Used to add a samba share.


Usage: "sudo smbadd -n share_name -f share_path -u share_allowed_user"
	-h help

	-n share name (mendatory)
	-f share path (mendatory)
	-u allowed user (if not specified will be jo)

smbdel

Deletes a samba share.


Usage: "sudo smbdel share_name1 share_name2 ..."
	-h help

spindown

Adds a spindown timer to a hard drive.


Usage: "sudo spindown -d drive_device_name -t time"
	-h help

	-t spin down time (default is 25, see hdparm for more info)
	-d drive name (default is "sda")

photo

convert-all-raw

Converts all raw images to jpg.


Usage: "convert-all-raw"
	-h help

	-r recursive

iAT-clear-all

Automatically unlocks and clears a swissbit archive sd card.


Usage: "iAT-clear-all -m /dev/sdxx"
	-h help

	-m (required): device mount point (like /dev/sdxx)

iAT-download-merge-all

Automatically unlocks and copies all of the data of a swissbit archive sd card to a single forlder.


Usage: "iAT-download-merge-all -m /dev/sdxx -o ~/Download/sync"
	-h help

	-m (required): device mount point (like /dev/sdxx)
	-o (required): output folder for merged data

compress-all-jpg

Compress all jpg images here.


Usage: "compress-all-jpg"
	-h help

	-r recursive

convert-all-raw-video

Converts all raw videos to mp4.


Usage: "convert-all-raw"
	-h help

	-r recursive

deface-auto

Automatically blurs faces in all image files here.


Usage: "compress-all-jpg"
	-h help

License

MIT License

Copyright (c) 2020 joseph touzet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.