Skip to content

Instantly share code, notes, and snippets.

@krogsgard
krogsgard / wp-cli-delete-comments-from-specific-post.sh
Created April 12, 2017 17:01
This WP CLI command deletes all comments on a post with ID of "123". You can do other things, like add a "status=spam" or whatever to the comment list command as well.
wp comment delete $(wp comment list --post_id=123 --format=ids)
function decodeHeidisql($hex) {
$string = '';
$shift = substr($hex, -1, 1);
$hex = substr($hex, 0, -1);
for($i=0;$i<strlen($hex); $i += 2) {
$string .= chr(intval(substr($hex, $i, 2), 16)-$shift);
}
return $string;
}
@jtdp
jtdp / gist:5443498
Last active May 23, 2024 16:23
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share. Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply