Skip to content

Instantly share code, notes, and snippets.

View artemsky's full-sized avatar

Artem Kuznetsov artemsky

View GitHub Profile
@artemsky
artemsky / headless-libs.sh
Created January 23, 2018 13:07
Chrome headless linux
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 / upgrade.sh
Last active November 6, 2020 16:48
PHP 7.2 Cloud9
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
@artemsky
artemsky / post-checkout
Last active September 2, 2022 13:36
Post merge git hook to check Laravel 5+ typical resources were updated
#!/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 / .gitconfig
Last active June 22, 2017 11:23
Phpstrom mergetool with git cli
[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 September 27, 2017 10:51
pre-commit hook: prepend JIRA Task Name
#!/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 / maptojson.js
Created April 6, 2017 15:26
es6 Map to Json
const mapToObject = (map) => {
const out = Object.create(null);
map.forEach((value, key) => {
if (value instanceof Map) {
out[key] = mapToObject(value);
}
else {
out[key] = value
}
});
@artemsky
artemsky / gitlog.sh
Last active April 13, 2017 07:22
git log
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 / Homestead.sh
Created April 3, 2017 17:17
Homestead db fix
sudo apt-get -y install apparmor-utils;
sudo aa-complain /usr/sbin/mysqld
sudo service apparmor reload;
sudo aa-status
@artemsky
artemsky / bash
Created March 29, 2017 15:03
GIT - Get parent branch
git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'