Skip to content

Instantly share code, notes, and snippets.

@andkirby
andkirby / node-npm-git-bash-win.sh
Last active April 29, 2022 14:07
Download and install node latest NodeJS and Npm on Windows (shell: Git Bash or similar).
#!/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
@andkirby
andkirby / vbox_direct_ports.rb
Last active October 18, 2016 13:15
This file can help to set forwarded ports in VirtualBox VM. It solves the problem described in the issue https://github.com/mitchellh/vagrant/issues/7905
require 'yaml'
require 'digest/md5'
##
# Module VBoxDirectPorts
# It add ports forwarding in VirtualBox VM
# It can generate ports based upon hostname
#
# Configuration files.
# (.dist) means there is should be distributive file by default with default configuration
@andkirby
andkirby / sscp
Last active October 23, 2016 15:33
Download/uplod script for remote environments.
#!/usr/bin/env bash
# Download this file in Windows GitBash
# curl -Ls https://gist.github.com/andkirby/cbeaad9fbedcbce6cf20bf5ba5467e59/raw/sscp -o /usr/bin/sscp
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
readonly SCRIPT_DIR
show_help () {
echo -e "
@andkirby
andkirby / shell_color.sh
Created October 22, 2016 11:57
colored text in bash
# t_color COLOR_NO MESSAGE [STYLE_NO]
t_color () {
local style
style=$([ -n "$3" ] && echo 0 || echo $3)
echo -e '\e['$3';'$1'm'$2'\e[0m'
}
t_warning () {
echo -e '\e[0;33m'$1'\e[0m'
}
t_ok () {
@andkirby
andkirby / bashrc_ps1_install.sh
Last active December 10, 2024 19:26
Install colorization for PS1 in bash.
#!/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
@andkirby
andkirby / bashrc_init_install.sh
Last active August 17, 2020 12:17
Install .bashrc init code
#!/usr/bin/env bash
###################################
# Init content for .bashrc file
#
# curl -Ls https://gist.github.com/andkirby/0e2982bee321aa611bc66385dee5f399/raw/bashrc_init_install.sh | bash
# curl -Ls https://bit.ly/bash-init | bash
###################################
touch ~/.bashrc
if cat ~/.bashrc | grep '# Init .bashrc content' > /dev/null; then
echo "notice: You have updated .bashrc file." > /dev/stderr
@andkirby
andkirby / semversort.sh
Last active November 4, 2024 18:35
Semantic versions sorting in bash.
#!/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
#
@andkirby
andkirby / Config.php
Created December 30, 2016 16:13
Mage_Core_Model_Config Magento 1.14.2.2 Fix for Redis.
<?php
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition End User License Agreement
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magento.com/license/enterprise-edition
@andkirby
andkirby / mageshell-params.sh
Created January 4, 2017 08:52
mageshell-params for Docker.
#!/usr/bin/env bash
DB_HOST="${MYSQL_HOSTNAME}"
DB_NAME="${MYSQL_DATABASE}"
DB_USER="${MYSQL_USER}"
DB_PASSWORD="${MYSQL_PASSWORD}"
PROJECT_DOMAIN_MASK="$(hostname)"
ADMIN_PASSWORD="${ADMIN_PASSWORD}"
ADMIN_EMAIL="${ADMIN_EMAIL}"
MEDIA_DIR_OWNER="${DOCROOT_OWNER_USER}"
PROJECT_DIR_OWNER="${DOCROOT_OWNER_USER}"
#!/usr/bin/env bash
# Find possible writable binary directory
set -o pipefail
set -o errexit
set -o nounset
#set -o xtrace
# Set magic variables for current file & dir