Skip to content

Instantly share code, notes, and snippets.

View pixmin's full-sized avatar

Gaëtan PRIOUR pixmin

View GitHub Profile
@pixmin
pixmin / .bash_aliases
Created March 13, 2020 13:13
Patched homestead / vagrant xphp
alias ..="cd .."
alias ...="cd ../.."
alias h='cd ~'
alias c='clear'
alias art=artisan
alias codecept='vendor/bin/codecept'
alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
#!/bin/bash
HOSTS='/etc/apache2/sites-enabled/'
for file in `ls $HOSTS`
do
echo $file
cat $HOSTS$file | grep --color -E "ServerName|DocumentRoot"
done
@pixmin
pixmin / list_domains.sh
Last active January 30, 2020 11:33
Get a list of domains on a server
#!/bin/bash
# From all the Apache sites-enabled conf files,
# extract the ServerAlias and ServerName lines.
# And for nginx too.
find /etc/apache2/sites-enabled/ -name "*.conf" -exec grep -E "ServerName|ServerAlias" {} \; \
| grep -vE '^*\#' | sed -e 's/^[ \t]*//' | grep --color -E "^|ServerName|ServerAlias" \
| awk {'print $2'} | sort | uniq
@pixmin
pixmin / git.md
Last active October 31, 2019 16:29
GIT

Get big commits for someone

git log --author=guillaume --shortstat --oneline | egrep "^ ([0-9]{3,}) files changed" -B 1

Get commits containing psr

git log --grep psr

Get list of top commiters

git shortlog -ns

@pixmin
pixmin / filter_branch.sh
Created October 31, 2019 14:20
git filter-branch psr2
#!/bin/bash
# This script with loop through every commit in the current branch
# and run every php file through phpcbf (standard PSR2)
# -f to force if there is already a back up (previous filter-branch run)
# -d path to a tmpfs mount point
# PSR2 Coding Standard
# Only PHP files that have been added or modified
# Excluding root folders: vendor, libs and dist
@pixmin
pixmin / perf.sh
Created August 29, 2019 13:41
Time to load page
#!/bin/bash
# To decide how many times the test should be run:
# perf <n> <url>
#
# Otherwise simply use
# perf <url>
DEFAULT_RUN=10
@pixmin
pixmin / is_there_a_diff.sh
Created June 24, 2019 13:58
BMS - Check if a file exists and show OSD if so
#!/bin/bash
if [ -f /volumes/users/gaetan.priour/Documents/CheckPHPRFC/diff.txt ]; then
echo "PHP RFC has been updated!" | osd_cat -i 1200 -o 3 -d 300 &
fi
@pixmin
pixmin / check_php_rcf.sh
Created June 24, 2019 13:57
BMS - Check if the PHP RFC page changed
#!/bin/bash
cd /volumes/users/gaetan.priour/Documents/CheckPHPRFC
DATE=`date +"%Y%m%d %H%M"`
# Remove all but the last two
/bin/ls -1tr rfc* | /usr/bin/head -n -2 | /usr/bin/xargs -d '\n' rm -f --
# Get the page
@pixmin
pixmin / Sublime.tmTheme.md
Last active March 14, 2019 15:23
Sublime 3200 Git gutter integration colors