Skip to content

Instantly share code, notes, and snippets.

View manovotny's full-sized avatar

Michael Novotny manovotny

View GitHub Profile
@manovotny
manovotny / example.js
Created April 3, 2017 02:00
Dedupe Array of Objects
var items = [
{
someProp: '0',
otherProp: 'a'
},
{
someProp: '1',
otherProp: 'c'
},
{
@manovotny
manovotny / script-already-running-check.sh
Last active September 22, 2023 07:15
Bash script to check if a script is already running.
#!/bin/bash
dupe_script=$(ps -ef | grep "SCRIPT_NAME.sh" | grep -v grep | wc -l | xargs)
if [ ${dupe_script} -gt 2 ]; then
echo -e "The SCRIPT_NAME.sh script was already running!"
exit 0
fi
@manovotny
manovotny / delete-spam-and-orphaned-comments.sql
Last active September 18, 2015 14:50
MySQL Query to Mass Delete Spam and Orphaned Comments from WordPress
DELETE FROM
wp_comments
WHERE
comment_approved = 'trash'
OR comment_approved = 'spam';
DELETE FROM
wp_commentmeta
WHERE
comment_id NOT IN (SELECT comment_ID FROM wp_comments);