Log into MySQL databases via preconfigured aliases. Note that the alias name 'foo' is to be identified in the config file as 'clientfoo'.
$ cat ~/.bashrc
my() {
/usr/bin/mysql --defaults-group-suffix="$@"
}
" Change an HTML select format line to a PHP assosiative-array style line | |
0/value<CR>f"l"ayi"f>l"zyitS'<C-r>a<C-o>A => '<C-r>z<C-o>A,<ESC>0<ESC> |
for i in $(git status -s | grep '^\s*A\|^\s*M' | sed -e 's/^.* //'); do php -l $i; done |
whois $(dig stackoverflow.com | grep -P "IN\s*A(AAA)?\s*\d" | awk '{print $5}' | head -n1) | grep -i country |
Log into MySQL databases via preconfigured aliases. Note that the alias name 'foo' is to be identified in the config file as 'clientfoo'.
$ cat ~/.bashrc
my() {
/usr/bin/mysql --defaults-group-suffix="$@"
}
grep -roE "do_action\s*\(\s*['\"](\w+)" . | awk -F"'|\"" '{print $2}' | sort -u |
#!/usr/bin/env bash | |
get_hosts="cat ~/.ssh/config | grep Host\\\\s | awk '{ print \$2 }' | sort -u" | |
if [[ $# -eq 0 ]] ; then | |
eval "$get_hosts | nl -ba" | |
exit; | |
fi | |
host_num=$1 |
# Output URLs of the website whose DOCUMENT_ROOT is the current directory. | |
# Reads from hosts file and Apache config | |
alias localurl='grep "$(grep -r -C3 $(pwd) /etc/httpd/vhost.d/ | grep -ioP "servername(.*)|serveralias(.*)" | awk '\''{print $2}'\'')" /etc/hosts | awk '\''{print $2}'\'' ' |
<?php | |
/** | |
* Properly format a user-entered URL for use in an href or src attribute. | |
* | |
* @param string $url User-entered URL | |
* @return string Formatted URL | |
*/ | |
function url_esc(string $url) : string | |
{ |
<?php | |
// Put this in wp-config.php and replace https://example.com/ with the URL of the production site. | |
define( 'RH_USE_REMOTE_MEDIA_URL', 'https://example.com/' ); | |
// Put the rest of this in functions.php or a custom plugin or somewhere else. | |
if ( defined( 'RH_USE_REMOTE_MEDIA_URL' ) && ! empty( RH_USE_REMOTE_MEDIA_URL ) ) { | |
add_filter( 'wp_get_attachment_image_src', array( $this, 'filter_wp_get_attachment_image_src' ) ); | |
add_filter( 'wp_calculate_image_srcset', array( $this, 'filter_wp_calculate_image_srcset' ) ); | |
add_filter( 'wp_get_attachment_url', array( $this, 'filter_wp_get_attachment_url' ) ); | |
} |