Skip to content

Instantly share code, notes, and snippets.

@andkirby
andkirby / php-git-bash-win.sh
Last active December 31, 2023 12:21
Download PHP binaries archive on Windows from GitBash console or similar
#!/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
#
@andkirby
andkirby / docker-uninstall.sh
Created July 24, 2017 13:49
Uninstall script for opal-satis containers.
#!/usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
#set -o xtrace
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
@andkirby
andkirby / .bashrc_git.sh
Last active July 17, 2017 16:24
Short aliases for GOT
# ---- GIT ----
#alias git="/d/prog/git/bin/git.exe"
# Git status
alias gg="git status -uno"
# Re-add files (refresh cache)
#alias gau='git status -s | cut -c4- | xargs git add'
alias gau="git diff --name-only --cached | xargs -I '{}' realpath --relative-to=. $(git rev-parse --show-toplevel)/'{}'"
# Re-add files (refresh cache) and commit
alias gc="gau && git commit -m"
alias gl='git log -3'
@andkirby
andkirby / .gitconfig
Last active June 29, 2017 12:40
Sample of global .gitconfig.
[user]
name =
email =
[push]
default = current
[core]
excludesfile = ~/.gitignore
editor = vim
autocrlf = input
eol = lf
@andkirby
andkirby / slack.sh
Last active April 4, 2024 17:51
Shell/Bash script for sending slack messages.
#!/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
#!/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
@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}"
@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 / semversort.sh
Last active January 12, 2024 15:28
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 / 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