This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#################################################################################### | |
# Slack Bash console script for sending messages. | |
#################################################################################### | |
# Installation | |
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack | |
# $ chmod +x /usr/bin/slack | |
#################################################################################### | |
# USAGE | |
# Send message to slack channel/user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Download this gist | |
# curl -Ls https://gist.github.com/andkirby/54204328823febad9d34422427b1937b/raw/semversort.sh | bash | |
# And run: | |
# $ semversort 1.0 1.0-rc 1.0-patch 1.0-alpha | |
# or in GIT | |
# $ semversort $(git tag) | |
# Using pipeline: | |
# $ echo 1.0 1.0-rc 1.0-patch 1.0-alpha | semversort | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################################################################################ | |
# This script can install PHP binaries on Windows in Bash. | |
# | |
# Link to this file: | |
# https://gist.github.com/andkirby/67e87e319c376b8676d559edb759e3fe/raw/php-git-bash-win.sh | |
# | |
# Download latest version by command in GitBash Windows console: | |
# $ curl -Ls bit.ly/php-bash-win | bash | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################################### | |
# PS1 color for .bashrc file | |
# | |
# curl -Ls https://gist.github.com/andkirby/389f18642fc08d1b0711d17978445f2b/raw/bashrc_ps1_install.sh | bash | |
# curl -Ls https://bit.ly/bash-ps1 | bash | |
################################### | |
touch ~/.bashrc | |
if ! cat ~/.bashrc | grep '# Colorize PS1 console' > /dev/null; then | |
echo >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sort versions list | |
* | |
* Add an alias in GIT | |
* $ git config --global alias.tags "!git tag | xargs -i -0 php "$(where version_sort)" {}" | |
* @link https://gist.github.com/andkirby/0046df5cad44f86b670a102b7c8b7ba7 | |
*/ | |
try { | |
if (php_sapi_name() != 'cli') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script can install NodeJS and NPM on Windows | |
# Run this command in GitBash Windows console to get latest version: | |
# | |
# $ curl -Ls https://gist.github.com/andkirby/raw/node-npm-git-bash-win.sh | bash | |
# | |
# Last update: 2022-04-29 | |
set -o errexit | |
set -o pipefail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php -r '$config = require "app/etc/config.php"; \ | |
$config = ["modules" => $config["modules"]]; \ | |
echo "<?php\nreturn "; var_export($config); \ | |
echo ";";' \ | |
> app/etc/config.php.cleaned && mv app/etc/config.php.cleaned app/etc/config.php | |
php -r '$config = require "app/etc/env.php"; \ | |
unset($config["system"]); \ | |
echo "<?php\nreturn "; \ | |
var_export($config); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# This script can merge all split SSH configuration into `~/.ssh/config` file. | |
# | |
# HOW IT WORKS | |
# It will merge all files by mask config.*.merge, i.e.: | |
# ~/.ssh/config.MY_PROJECT.merge | |
# Initial exists `~/.ssh/config` file will be copied to `~/.ssh/config.orig`. | |
# Use this `config.orig` for further changes. | |
# | |
# Anyway, you may not use this script and just run: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################## | |
# Reset time on login # | |
######################################## | |
# you may try to use system last logged time: `last ${USER} -n1 | head -1 | awk '{print $4" "$5" "$6" "$7}'` | |
time_sync_command='sudo ntpdate -s time.nist.gov' | |
# max time not logged value | |
not_logged_max_time_h=6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################################################################## | |
# Synchronize .ssh files from Windows file system to Ubuntu WSL # | |
################################################################## | |
set -o pipefail | |
set -o errexit | |
set -o nounset | |
#set -o xtrace | |
# Set magic variables for current file & dir |
NewerOlder