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 | |
# ./curl-urls.sh numprocessses http://urltograp urlpattern | |
# ./curl-urls.sh 3 http://www.domain.com domain.com | |
numprocessses=$1 | |
baseurl=$2 | |
urlpattern=$3 | |
function forky() { | |
local num_par_procs | |
if [[ -z $1 ]] ; then |
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
add_filter( 'robots_txt', 'sav_add_sitemap_to_robots' ); | |
function sav_add_sitemap_to_robots( $robots ) { | |
$robots .= 'Sitemap: ' . site_url( 'sitemap_index.xml' ); | |
return $robots; | |
} |
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
add_action( 'admin_init', 'deregister_autosuggest' ); | |
function deregister_autosuggest() { | |
if ( is_admin() ) { | |
wp_deregister_script( 'suggest' ); | |
} | |
} |
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
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement, fromIndex) { | |
if ( this === undefined || this === null ) { | |
throw new TypeError( '"this" is null or not defined' ); | |
} | |
var length = this.length >>> 0; // Hack to convert object.length to a UInt32 | |
fromIndex = +fromIndex || 0; |
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 | |
grep -E "Server(Name|Alias)" httpd.conf | sort | uniq | cut -d " " -f 6 | tr "\n" " " |
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 | |
ip1='FILL-SOURCE-IP'; ip2='FILL-DEST-IP'; host='FILL-HOSTNAME'; curl http://$host | grep -o '<a.*href=.*>' | grep "http://$host" | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d' > links.txt; for link in `cat links.txt`; do path=`echo -n $link | cut -d "/" -f 4-`; curl --header "Host: $host" "http://$ip1/$path" > ip1.html; curl --header "Host: $host" "http://$ip2/$path" > ip2.html; echo; echo "Diff http://$ip1/$path"; echo; diff ip1.html ip2.html; done |
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
/** | |
* Validate that a given path is a child of the WP_CONTENT_DIR | |
* @param string $path path to check | |
* @return boolean true/false | |
*/ | |
function sav_path_is_valid( $path ) { | |
if ( !defined( WP_CONTENT_DIR ) ) | |
return false; | |
$start = 0; |
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
add_filter( 'clean_url', 'sav_force_mapped_url' ); | |
function sav_force_mapped_url( $url ) { | |
if ( ! is_admin() ) { | |
if ( function_exists( 'get_original_url' ) && strpos( '/wp-admin', $url ) === false ) { | |
$original = preg_replace( '#^https?://#', '', get_original_url('') ); | |
$new = preg_replace( '#^https?://#', '', site_url() ); | |
$url = str_ireplace( $original, $new, $url ); | |
} | |
} | |
return $url; |
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
add_filter( 'http_request_args', 'force_referer_for_import' ); | |
function force_referer_for_import( $r ) { | |
if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { | |
$r['headers']['Referer'] = 'http://<referer>/'; | |
} | |
return $r; | |
} |
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
<?php | |
function tott_enable_menu_export() { | |
global $wp_post_types; | |
$wp_post_types['nav_menu_item']->_builtin = false; | |
} | |
add_action( 'load-export.php', 'tott_enable_menu_export' ); |