Skip to content

Instantly share code, notes, and snippets.

Avatar

Artem Kuznetsov artemsky

View GitHub Profile
View Homestead.sh
sudo apt-get -y install apparmor-utils;
sudo aa-complain /usr/sbin/mysqld
sudo service apparmor reload;
sudo aa-status
View maptojson.js
const mapToObject = (map) => {
const out = Object.create(null);
map.forEach((value, key) => {
if (value instanceof Map) {
out[key] = mapToObject(value);
}
else {
out[key] = value
}
});
View gitlog.sh
branch=`git rev-parse --abbrev-ref HEAD`
git show-branch -a 2>/dev/null | grep '\*' | grep -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
@artemsky
artemsky / .gitconfig
Last active Jun 22, 2017
Phpstrom mergetool with git cli
View .gitconfig
[merge]
tool = phpstorm
[mergetool "phpstorm"]
cmd = 'C:/Program Files/JetBrains/PhpStorm 2017.1.4/bin/phpstorm64.exe' merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
@artemsky
artemsky / prepare-commit-msg
Last active Sep 27, 2017
pre-commit hook: prepend JIRA Task Name
View prepare-commit-msg
#!/bin/sh
# Automatically adds branch name to the end of every commit message.
NAME=$(git branch | grep '*' | sed 's/* //')
echo "$NAME" "$(cat "$1")" > "$1"
@artemsky
artemsky / headless-libs.sh
Created Jan 23, 2018
Chrome headless linux
View headless-libs.sh
sudo apt-get install libpangocairo-1.0-0 libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libnss3 libcups2 libxss1 libxrandr2 libgconf2-4 libasound2 libatk1.0-0 libgtk-3-0
@artemsky
artemsky / post-checkout
Last active Apr 15, 2018
Post merge git hook to check Laravel 5+ typical resources were updated
View post-checkout
#!/bin/bash
# Looks for changes and automates running bundle and other tasks.
# Does not run if your local branch is behind the remote.
# https://gist.github.com/stefansundin/82051ad2c8565999b914
# post-checkout hook - looks for changes,
# when you change branches, and if found, reinstalls the given packages every
# Exit early if this was only a file checkout, not a branch change ($3 == 1)
[[ $3 == 0 ]] && exit 0
@artemsky
artemsky / bash
Created Mar 29, 2017
GIT - Get parent branch
View bash
git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
@artemsky
artemsky / upgrade.sh
Last active Nov 6, 2020
PHP 7.2 Cloud9
View upgrade.sh
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.2 php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
sudo apt-get install libapache2-mod-php7.2 -y
sudo a2dismod php5
sudo a2enmod php7.2
sudo service apache2 restart