This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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) |