Skip to content

Instantly share code, notes, and snippets.

View kujiy's full-sized avatar

Kujiy kujiy

View GitHub Profile
@kujiy
kujiy / php-cs-fixer-and-esformatter-pre-commit.php
Last active September 15, 2015 10:12 — forked from mardix/php-cs-fixer-pre-commit.php
A pre-commit hook to make PHP code PSR-2 compliant, check for syntax error and make Javascript code beautify with Esformatter
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
* original -> https://gist.github.com/mardix/3623562
*/
/**
* collect all files which have been added, copied or
* modified and store them in an array called output
@kujiy
kujiy / git-hook-add-branch-name-to-commit-msg
Created September 15, 2015 10:15
Git hook / A commit-msg for add branch name to commit message
#!/bin/sh
#ブランチ名を取得
Branch="$(git rev-parse --abbrev-ref HEAD)"
#コミットメッセージの最初にブランチ名を追加
mv $1 $1.tmpbycommit-msg
echo -n "[$Branch] " > $1
cat $1.tmpbycommit-msg >> $1
#!/bin/bash
echo "---------------------start post-receive : `date`" >> ~/kuji.log
while read oldrev newrev ref
do
branch=`echo $ref | sed 's/refs\/heads\///'`
echo $ref >> ~/kuji.log
done
echo $branch >> ~/kuji.log
@kujiy
kujiy / grunt-exec-php.js
Last active November 16, 2015 02:59
Run your shell command whenever any file is updated.
'use strict';
/**
*
* Make sure you must install modules below before use.
*
* > $ npm i grunt-contrib-watch --save-dev
* > $ npm i grunt-exec --save-dev
*
*
@kujiy
kujiy / sample.diff
Last active December 9, 2015 05:41 — forked from dasl-/sample.diff
Change to Xoops Smarty Delimiter
diff --git a/Smarty.tmPreferences b/Smarty.tmPreferences
index bf6a0ea..f4117e0 100644
--- a/Smarty.tmPreferences
+++ b/Smarty.tmPreferences
@@ -14,13 +14,13 @@
<key>name</key>
<string>SMARTY_LDELIM</string>
<key>value</key>
- <string><![CDATA[{]]></string>
+ <string><![CDATA[<{ ]]></string>
@kujiy
kujiy / php-cs-fixer-ruleset.xml
Created February 22, 2016 00:40
php-cs-fixer-ruleset.xml
<ruleset name="Custom Standard">
<description>My custom coding standard</description>
<rule ref="PSR2">
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/>
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/>
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
@kujiy
kujiy / github_post_recieve.php
Last active May 19, 2016 10:11 — forked from cowboy/github_post_recieve.php
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
$path = "/var/www/html/abc";
if ( $_POST['payload'] ) {
shell_exec( 'cd '.$path.' && git reset --hard HEAD && git pull 2>&1' );
}
<?php
// Use in the "Post-Receive URLs" section of your Bitbucket repo.
if ( $_POST['payload'] ) {
$data = json_decode($_POST['payload']);
$commits = $data->{"commits"};
@kujiy
kujiy / gitlab-ci-multi-runner-docker-excutor-1.3.2.sh
Created July 14, 2016 01:06
gitlab-runner docker excutor all enves for gitlab-ci-multi-runner 1.3.2
$ root@docker02:~# docker exec -it gitlab-runner gitlab-runner exec -h
NAME:
gitlab-runner exec - execute a build locally
USAGE:
gitlab-runner exec command [command options] [arguments...]
COMMANDS:
docker use docker executor
docker-ssh use docker-ssh executor
@kujiy
kujiy / install_latest_zabbix.sh
Created August 12, 2016 05:53
How to install the latest stable version of zabbix_agentd automatically. How to get the latest version of zabbix-agentd
#!/bin/bash
# get latest stable version
VER=$(curl -s http://heanet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/ | grep -P "alt=\"\[DIR\]\" /> <a href=" | grep -v alpha | grep -v beta | awk -F'[\"]' '{print $6}' | sed -e "s/\///" | tail -1 )
eyel "---------------------------------------------------"
eblu Install zabbix-agent version
egre $VER
eyel "---------------------------------------------------"