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 | |
| # Common functions | |
| function log_prefix { date +%Y-%m-%d\ %H:%M:%S; } | |
| function info { echo "[$(log_prefix)] Info: ${1}"; } | |
| function error { >&2 echo "[$(log_prefix)] Error: ${1}"; } | |
| function fatal { >&2 echo "[$(log_prefix)] Fatal: ${1}"; exit ${2:1}; } | |
| # Detect if we're on OS-X | |
| if [[ "${OSTYPE}" != darwin* ]]; then |
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 | |
| # Common functions | |
| function log_prefix { date +%Y-%m-%d\ %H:%M:%S; } | |
| function info { echo "[$(log_prefix)] Info: ${1}"; } | |
| function error { >&2 echo "[$(log_prefix)] Error: ${1}"; } | |
| function fatal { >&2 echo "[$(log_prefix)] Fatal: ${1}"; exit ${2:1}; } | |
| # Detect if we're on OS-X | |
| if [[ "${OSTYPE}" != darwin* ]]; then |
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 | |
| find /var/www/* -type f -name class-freemius.php | while read -r file; do | |
| after=0 | |
| while true; do | |
| ((after++)) | |
| line=$(grep -A${after} "function _set_db_option" "${file}" | tail -n 1) | |
| if [[ "${line}" =~ fs_request_get ]]; then | |
| sed --in-place -E "s/^(.*)(static function _set_db_option.*)$/\1\2\n\1 check_admin_referer( 'fs_set_db_option' );/" "${file}" |
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
| # Host completion | |
| _complete_hosts () { | |
| COMPREPLY=() | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| host_list=`{ | |
| for c in /etc/ssh_config /etc/ssh/ssh_config ~/.ssh/config | |
| do [ -r $c ] && sed -n -e 's/^Host[[:space:]]//p' -e 's/^[[:space:]]*HostName[[:space:]]//p' $c | |
| done | |
| for k in /etc/ssh_known_hosts /etc/ssh/ssh_known_hosts ~/.ssh/known_hosts | |
| do [ -r $k ] && egrep -v '^[#\[]' $k|cut -f 1 -d ' '|sed -e 's/[,:].*//g' |