Skip to content

Instantly share code, notes, and snippets.

@itime
itime / laravel_post_receive hook
Created March 12, 2020 06:52 — forked from vool/laravel_post_receive hook
Post receive hook for Laravel website deploy
#!/bin/bash
echo "********************"
echo "Post receive hook: Updating website"
echo "********************"
#set the git repo dir
GIT_REPO_DIR=~/git/<repo>.git
echo "The git repo dir is $GIT_REPO_DIR"
#!/bin/bash
LAST_STAT=/tmp/last_cpu_stat
CURRENT_STAT=/proc/stat
[[ ! -f "${LAST_STAT}" ]] && cat ${CURRENT_STAT} > ${LAST_STAT}
{ cat ${LAST_STAT} && < ${CURRENT_STAT} tee $LAST_STAT; } |
\ awk '/^cpu / {usr=$2-usr; sys=$4-sys; idle=$5-idle; iow=$6-iow} END {total=usr+sys+idle+iow; printf "%.1f%", (total-idle)*100/total}'
# With sleep
<?php
/**
* Interprets an INI file with heritage section
*
* @param string $filename Filename
* @return array
* @link https://gist.github.com/4217717
*
*/
function parse_ini_file_advanced($filename)