This file contains 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
--- | |
deployment: | |
tasks: | |
- DEPLOYPATH="/home/$USER/public_html" | |
- TEMPDIR="/home/$USER/tmp/public_html" | |
- REPOPATH="/home/${USER}/repositories" | |
- rm -r $TEMPDIR; mkdir $TEMPDIR | |
- cp -Tar ${DEPLOYPATH}/.well-known ${TEMPDIR}/.well-known | |
- cp -Tar ${DEPLOYPATH}/cgi-bin ${TEMPDIR}/cgi-bin | |
- cp -Tar ${DEPLOYPATH}/index.phtml ${TEMPDIR}/index.phtml |
This file contains 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
# https://stackoverflow.com/questions/23011370/how-to-recognize-whether-bash-or-dash-is-being-used-within-a-script | |
getTrueShellExeName() { | |
local trueExe nextTarget 2>/dev/null # ignore error in shells without `local` | |
# Determine the shell executable filename. | |
trueExe=$(ps -o comm= $$) || return 1 | |
# Strip a leading "-", as added e.g. by OSX for login shells. | |
[ "${trueExe#-}" = "$trueExe" ] || trueExe=${trueExe#-} | |
# Determine full executable path. | |
[ "${trueExe#/}" != "$trueExe" ] || trueExe=$([ -n "$ZSH_VERSION" ] && which -p "$trueExe" || which "$trueExe") |
This file contains 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/sh | |
# | |
# a simple way to parse shell script arguments | |
# | |
# please edit and use to your hearts content | |
# | |
ENVIRONMENT="dev" |
This file contains 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 | |
usage() { | |
cat << EOT | |
usage $0 [-hgw] | |
$0 -m MESSAGE | |
OPTIONS |
This file contains 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 | |
text=$(curl -s 'https://baconipsum.com/api/?type=meat-and-filler') | |
pager() { | |
# if stdout is not to a TTY, copy directly w/o paging | |
[ -t 1 ] || { cat; return; } | |
if [ -n "$PAGER" ]; then | |
"$PAGER" |
This file contains 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 | |
# WordPress install script | |
# This is a snippet from USet. It is not functional on its own. | |
# Project URL: https://github.com/sitemapxml/USet | |
# config.txt | |
# Wordpress settings | |
conf_wp_wget_locale='https://wordpress.org/latest.tar.gz' | |
conf_wp_aditional_php_extensions='php-xmlrpc php-exif' |
This file contains 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 | |
# NOTE: route command is part of dnsutils package on Debian, and net-tools on Ubuntu | |
# Based on following Stack Overflow answer: | |
# https://stackoverflow.com/questions/14594151/methods-to-detect-public-ip-address-in-bash/22209864#22209864 | |
MAINIF=$( route -n | grep '^0\.0\.0\.0' | head -n 1 | awk '{print $NF}' ) | |
IP=$( ifconfig $MAINIF | awk -v row=2 'FNR == 'row' {print $2}' ) | |
echo $IP |
This file contains 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 | |
# https://checkmk.com/download | |
if [ -n `command -v ufw` ]; then | |
ufw allow 22/tcp | |
ufw allow 80/tcp | |
ufw allow 443/tcp | |
ufw reload | |
fi |
This file contains 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
$ wp post list --format=ids | xargs wp post update --comment_status=closed | |
# Output: | |
# Success: Updated post 2514. | |
# Success: Updated post 2511. | |
# Success: Updated post 2504. | |
# Success: Updated post 2499. | |
# Success: Updated post 2441. | |
# etc... |
This file contains 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
declare -a DIRS | |
savedir() { | |
local i | |
for ((i=1;i<=9;i++)); do | |
test "$1" = "${DIRS[$i]}" && return | |
done | |
for ((i=9;i>1;i--)); do | |
DIRS[$i]="${DIRS[((i-1))]}" | |
done |
OlderNewer