Skip to content

Instantly share code, notes, and snippets.

View paunin's full-sized avatar
🦄
Unicorns engineering!

Dmitriy Paunin paunin

🦄
Unicorns engineering!
View GitHub Profile
@paunin
paunin / update.secondary
Created August 11, 2014 11:47
Gitolite update.secondary
#!/bin/sh
# driver script to run multiple update "hooklets". Each "hooklet" performs a
# specific (possibly site-local) check, and they *all* have to succeed for the
# push to succeed.
# HOW TO USE:
# (1) rename this file to remove the .sample extension
# (2) make the renamed file executable (chmod +x)
#!/bin/bash
#Simple playlist generator m3u
#@author paunin
OLDIFS=$IFS
IFS=$'\n'
rm -rf playlists
mkdir playlists
find $1 -maxdepth 1 -type d | while read dir
do
@paunin
paunin / hook-chain.sh
Last active April 29, 2016 18:31
git hook-chain
#!/bin/bash
# http://stackoverflow.com/questions/8730514/chaining-git-hooks
# author: orefalo
hookname=`basename $0`
FILE=`mktemp`
trap 'rm -f $FILE' EXIT
cat - > $FILE
@paunin
paunin / pre-recieve.sh
Last active August 5, 2017 11:07
pre-receive Code Sniffer
#!/bin/sh
# PHP CodeSniffer pre-receive hook for git
#exit 0 #if you want to skip all validation
PHPCS_BIN="phpcs"
PHPCS_CODING_STANDARD="PSR2"
TMP_DIR=$(mktemp -d phpcs-pre-receive-hook.XXXXXXXX)
mkdir "$TMP_DIR/source"
@paunin
paunin / pre-commit.php
Last active August 29, 2015 14:05
pre-commit Code Sniffer
#!/usr/bin/php
<?php
$cs = 'phpcs';
$md = 'phpmd';
$output = [];
$return = 0;
$defaultCsStandard = 'PSR2';
$defaultMdRules = 'codesize,cleancode,controversial,unusedcode,naming,design';
$gitRoot = exec('git rev-parse --show-toplevel', $output);