Extended implementation of world known common shell function, fully POSIX compliant
The project has been significantly improved and moved to the new permanent location github.com/juliyvchirkov/sh.yesnoprompt
Extended implementation of world known common shell function, fully POSIX compliant
The project has been significantly improved and moved to the new permanent location github.com/juliyvchirkov/sh.yesnoprompt
| ## | |
| # long option format: --option=value | |
| # | |
| # usage: value="$(getOptionValue option "${@}")" | |
| # script.sh --pidfile=/run/pidfile.pid ➙ pidfile="$(getOptionValue pidfile "${@}")" | |
| ## | |
| getOptionValue() { | |
| local option |
| #!/usr/bin/env bash | |
| # Copyright Atomicorp 2020 | |
| # AGPL 3.0 | |
| # Modified by Juliy V. Chirkov [email protected] https://juliyvchirkov.github.io/ 12/07/2021 | |
| # Globals | |
| VERSION=0.2 | |
| OSSEC_HOME=/var/ossec | |
| SERVER=updates.atomicorp.com |
Note
Work on routine update and annotation in progress
| <?php declare(strict_types = 1); | |
| /** | |
| * Provides polyfills of string functions str_starts_with, str_contains and str_ends_with, | |
| * core functions since PHP 8, along with their multibyte implementations mb_str_starts_with, | |
| * mb_str_contains and mb_str_ends_with | |
| * | |
| * Covers PHP 4 - PHP 7, safe to utilize with PHP 8 | |
| */ | |
| /** |
| import { realpathSync, existsSync } from 'node:fs' | |
| import { basename, dirname } from 'node:path' | |
| export default (() => { | |
| let mageRoot = dirname(realpathSync(import.meta.url.slice(7))) | |
| while (!(existsSync(`${ mageRoot }/app/Mage.php`) || existsSync(`${ mageRoot }/bin/magento`))) { | |
| if (mageRoot === '/') { | |
| throw new Error(`${ basename(import.meta.url.slice(7)) } should be placed inside Magento project tree`) | |
| } |
| #!/bin/sh | |
| ############ *posix* ############# | |
| # shellcheck shell=sh enable=all # | |
| ################################## | |
| # | |
| # If one is missing the original *__git_ps1* function from @git/git package, this wrapper can be utilized as | |
| # temporary solution | |
| # | |
| # @see https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh | |
| # |
| #!/usr/bin/env bash | |
| # | |
| # Provides shortcuts for apt options | |
| # | |
| # @see https://gist.github.com/juliyvchirkov/7ee6591b9744c36fa9ab73a1ca2ef544#file-quickinstall-rst | |
| case ${1} in | |
| i) | |
| arg1st="install" ;; | |
| ri) |
| #!/bin/bash | |
| # | |
| # Enable nopasswd mode for sudo on macOS from the userspace in fast and totally non-interactive way | |
| # | |
| # Type the password last time to apply the new mode and forget it for any console task for ages | |
| # Use the rollback to restore password protection | |
| # | |
| # Developed and tested by https://juliyvchirkov.github.io/ under the MIT license on macOS Big Sur 11.2.0 | |
| # | |
| # Get latest version at https://gist.github.com/juliyvchirkov/3ca76582ed6b6a8366c9e7d60644960d |
| /** | |
| * Returns a string indicating the type of an object or a primitive | |
| * Throws if invoked w/o arguments | |
| * | |
| * @param any An object or a primitive whose type is to be determined | |
| * @return string The type of probed item | |
| * | |
| * Unlike native typeof operator identifies Null as is (not as Object) | |
| * Delivers the exact type of an item not limited to 9 basic types Undefined, | |
| * Null, Boolean, Number, BigInt, String, Function, Symbol and Object |