Skip to content

Instantly share code, notes, and snippets.

View kevinchappell's full-sized avatar
🌠

Kevin Chappell kevinchappell

🌠
View GitHub Profile
@kevinchappell
kevinchappell / get_user_data.php
Last active June 14, 2021 04:07
Get all User data in WordPress
<?php
/**
* Get an array of all user data
* @param string|int $user_id
* @return array merged array of user meta and data
*/
function get_user_data( $user_id ){
$user_data = (array) get_userdata( $user_id )->data;
$user_meta = array_map( function( $item ){ return $item[0]; }, (array) get_user_meta( $user_id ) );
return array_merge( $user_data, $user_meta );
<?php
/**
* Super simple class for logging. Generates regular logs and csv files
* @package lightLogger
* @author Kevin Chappell <kevin.b.chappell@gmail.com>
* @license http://opensource.org/licenses/MIT The MIT License (MIT)
* @since lightLogger .5
*/
/**
@kevinchappell
kevinchappell / .bash_profile
Created July 2, 2015 21:40
parse_git_branch() in terminal
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[1;31m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[1;36m\]\w \[\033[1;35m\]$(parse_git_branch) \[\033[1;33m\]\$ \[\033[0m\]'
@kevinchappell
kevinchappell / clamav.cron
Created December 6, 2015 15:21
cPanel ClamAV Cron Job
#!/bin/sh
for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do
SUBJECT="VIRUS SCAN ${i}"
EMAIL="youremail@yourdomain.com"
# Log location
LOG="/var/log/clamav/${i}-scan.log"
# Quarantine location
@kevinchappell
kevinchappell / purge-quarantined.sh
Created December 6, 2015 15:25
Purge Quarantined Viruses
#!/bin/sh
for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do
QUARANTINE="/home/${i}/quarantine/"
rm -rf $QUARANTINE &>/dev/null
done
@kevinchappell
kevinchappell / nginx-vagrant-template
Created December 9, 2015 15:42
Template to be read into vvv-pull
server {
listen 80;
listen 443 ssl;
server_name ##DEV_DOMAIN##;
root /srv/www/##V_USERNAME##/htdocs;
include /etc/nginx/nginx-wp-common.conf;
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
@kevinchappell
kevinchappell / wp-pull
Last active December 15, 2015 20:41
Import a remote site to your local vagrant
#!/bin/bash
# Author: Kevin Chappell http://kevin-chappell.com
# Description: Pull a production site into your local vagrant
# Version: 0.1.2
echo -e '\e[32m
_ ______ ____ ____
| | / / __ \ / __ \__ __/ / /
| | /| / / /_/ / / /_/ / / / / / /
| |/ |/ / ____/ / ____/ /_/ / / /
@kevinchappell
kevinchappell / wp-push
Last active April 21, 2016 13:24
Push a WordPress site from vagrant to remote server
#!/bin/bash
# Author: Kevin Chappell http://kevin-chappell.com
# Description: Push a local vagrant dev site to production
# Version 0.1.2
echo -e '\e[32m
_ ______ ____ __
| | / / __ \ / __ \__ _______/ /_
| | /| / / /_/ / / /_/ / / / / ___/ __ \
| |/ |/ / ____/ / ____/ /_/ (__ ) / / /
@kevinchappell
kevinchappell / Convert to Animated GIF
Last active December 26, 2015 23:40
Convert video to gif
[Desktop Entry]
Type=Action
TargetLocation=true
ToolbarLabel[en_US]=Convert to Animated GIF
ToolbarLabel[en]=Convert to Animated GIF
ToolbarLabel[C]=Convert to Animated GIF
Name[en_US]=Convert to Animated GIF
Name[en]=Convert to Animated GIF
Name[C]=Convert to Animated GIF
Profiles=profile-zero;