Skip to content

Instantly share code, notes, and snippets.

View brianjking's full-sized avatar
💭
Doin' cool stuff at BrandMuscle AI

Brian J King brianjking

💭
Doin' cool stuff at BrandMuscle AI
View GitHub Profile
@brianjking
brianjking / Bash
Created October 27, 2015 20:36 — forked from Mello21century/Bash
Install PageSpeed cPanel
cd /usr/local/cpanel/3rdparty/bin/git clone https://github.com/pagespeed/cpanel.git /root/pagespeed/
/usr/local/cpanel/3rdparty/bin/git clone https://github.com/pagespeed/cpanel.git /root/pagespeed/
cd /root/pagespeed
cd Easy
tar -zcvf Speed.pm.tar.gz pagespeed
mkdir -p /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy
mv Speed.pm Speed.pm.tar.gz -t /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/
rm -rf /root/pagespeed/
screen -S ea
/scripts/easyapache
@brianjking
brianjking / common-cPanel-WHM-paths.md
Created October 27, 2015 20:36 — forked from irazasyed/common-cPanel-WHM-paths.md
Common paths in cPanel and WHM, Useful for regular use. Source: http://www.webhostingbuzz.com/wiki/common-paths-cpanel-and-whm/ Note: I don't take any credits for this article (All credits go to the author who published it), I've just converted into markdown format for regular reference (Personal preference).

Common paths in cPanel and WHM


For those users who use cPanel/WHM on their virtual or dedicated servers the following article describes common system paths and utilities.

Paths of Base Modules


PHP /usr/bin/php

@brianjking
brianjking / anmol-terminal.sh
Created October 27, 2015 18:12 — forked from anmoljagetia/anmol-terminal.sh
This is a script that adds a profile similar to the screenshot shown with Flatabulous in Gnome-Terminal.
#!/usr/bin/env bash
# Base16 - Gnome Terminal color scheme install script
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="flatabulous-terminal"
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="flatabulous-terminal"
[[ -z "$DCONF" ]] && DCONF=dconf
[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
dset() {
local key="$1"; shift
@brianjking
brianjking / Wordpress Cleanups for JS and CSS
Created September 30, 2015 23:46 — forked from stephenscaff/Wordpress Cleanups for JS and CSS
Wordpress can get pretty grimey in the head, droppin in all kinds of nasty bits. So, I always include a cleanup.php deal (included within functions.php), with a bunch of functions to tidy up the nav, body class, lang, js and css outputs, et cetera, et cetera. Here's the Mr. Clean treatment for js and css output. Of course, remember to prefix boss.
<?php
/*-----------------------------------------------------------------------------------*/
/* Clean them stylesheet <link> tags
/*-----------------------------------------------------------------------------------*/
function clean_style_tag($input) {
preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!", $input, $matches);
// Display media if it's print
$media = $matches[3][0] === 'print' ? ' media="print"' : '';
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
@brianjking
brianjking / wordpress-sql-url-search-replace
Created September 30, 2015 23:46 — forked from stephenscaff/wordpress-sql-url-search-replace
Search and replace SQL query for Wordpress migration. In phpMyAdmin, select database, go to SQL tab... click, click boom.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@brianjking
brianjking / mqs.scss
Created September 30, 2015 23:43 — forked from stephenscaff/mqs.scss
Media Queries - from common ems to iphones, to ie targeting.
/*----------------------------------------------
--Common MQs Min-Width
----------------------------------------------- */
$mq-xsmall: 22em;
//after iphone
$mq-small: 32em;
//Tablet ish (main break)
$mq-med: 54em;
@brianjking
brianjking / async-and-conditional-css-loading.html
Created September 28, 2015 22:00 — forked from matt-bailey/async-and-conditional-css-loading.html
A simple script (based on one by Google) for loading CSS files asynchronously and conditionally based on body tag classes
<html>
<head>
<!-- Inlined critical styles -->
<style>.blue{color:blue;}</style>
<!-- CSS loader -->
<script>
/* ==========================================================================
Load CSS asynchronously and conditionally after initial painting
@brianjking
brianjking / osx-10.10-setup.md
Last active September 13, 2015 02:15 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@brianjking
brianjking / events-conditional-wrappers.php
Last active September 1, 2015 03:14 — forked from jo-snips/events-conditional-wrappers.php
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@brianjking
brianjking / add_ftp_users.sh
Last active August 29, 2015 14:27 — forked from janxb/ajenti_additional_ftp_users.sh
A Shell Script for adding additional FTP-Users to Ajenti
#!/bin/bash
SET_USERS="usernameone:password:/path/to/web/folder usernametwo:password:/path/to/second/folder"
IFS=' ' read -a USERS <<< "${SET_USERS}"
for SET_USER in ${USERS[@]}; do
IFS=':' read -a USER <<< "${SET_USER}"
NAME=${USER[0]};
PASS=${USER[1]};
DIR=${USER[2]};
(echo $PASS; echo $PASS) | pure-pw useradd $NAME -u www-data -g www-data -d $DIR