Skip to content

Instantly share code, notes, and snippets.

View grok's full-sized avatar
🚀
Open to work!

Sterling Hamilton grok

🚀
Open to work!
View GitHub Profile
@grok
grok / script.sh
Created April 28, 2014 15:07
Old legacy script I wrote for maintaining servers.
#!/bin/bash
# In an effort to automate some of my daily tasks I decided to write this mail quota monitoring script. It gets all quota information, processes it, then Twitters the information AND sends an e-mail. The Twitter information is vague so security isn’t compromised, but the e-mail has the details. This way I can get a heads up of impending doom on certain mail accounts!
# Get the e-mail ready.
Email="esupport@exyst.com";
Subject="Xync: Account(s) Exceeding Quota(s)."
Message="/tmp/message.txt"
# This starts the message fresh.
echo "Summary:" > $Message
@grok
grok / script.php
Created April 28, 2014 15:06
Another server scanner I wrote back in the day.
Example Output:
Retrieving Joomla Site List…
Detecting Joomla Versions…
[http://www.angelkissfoundation.org] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
[http://www.florinanalytical.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.kcareno.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.itosbolivia.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.successdna.com] -> [Joomla!] [1.0.13] -> [VirtueMart] [1.0.13a.]
[http://www.computercorps.org] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
@grok
grok / output
Created April 28, 2014 15:03
This was another script I wrote to maintain servers long ago. Once again, this is for historical sake.
Example Output:
This is an automated message.
Below is a list of all PHPList e-mails that went out for September
[5040] E-mails for Database: [ahhhmassage_db]
[24103] E-mails for Database: [clarkcountybar_newsletter]
[7978] E-mails for Database: [commacoffee_news]
[11665] E-mails for Database: [mckernan_newsletter]
@grok
grok / script.php
Created April 28, 2014 15:01
Little server scanner to help maintain a server I used to work on years ago. This is purely for historical sake.
Example Output:
Retrieving Site List…
[http://www.breweryarts.org] [Mambo] [4.5.4]
[http://www.artbyblair.com] [Mambo] [4.5.4]
[http://www.budgaugh.com] [Joomla!] [1.0.13]
[http://www.ecomadness.com] [Joomla!] [1.0.15]
[http://www.janusstudio.com] [Joomla!] [1.0.11]
[http://www.sharonchandler.com] [Mambo] [4.5.4]
@grok
grok / server-scanner.sh
Created April 28, 2014 15:00
This script found all sites using certain CMS platforms on a server I used to manage. This is for historical purposes. Really old code I wrote. I don't want to get rid of it because it reminds me of a time long long ago when I broke more then I fixed without realizing it :)
#!/bin/bash
Colors() {
Escape="\033";
BlackF="${Escape}[30m"; RedF="${Escape}[31m"; GreenF="${Escape}[32m";
YellowF="${Escape}[33m"; BlueF="${Escape}[34m"; PurpleF="${Escape}[35m";
CyanF="${Escape}[36m"; WhiteF="${Escape}[37m";
BlackB="${Escape}[40m"; RedB="${Escape}[41m"; GreenB="${Escape}[42m";
@grok
grok / nest.php
Last active August 29, 2015 14:00
This is an example of properly using nested functions within PHP, as well as the improper way. It outlines that improper use throws the function into the global scope. In general I would recommend not using nested functions. It dirties things up.
<?php
class Example {
// This is not intended to be accessible outside this class.
private function _hidden() {
// This is not acceptable. This becomes global.
// also unable to declare this as private vs. public - it generates a parse error.
function _shouldbehidden() {
Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in /wp-includes/plugin.php on line 429
@grok
grok / functions.php
Last active August 29, 2015 13:59
Encountering what appears to be a core bug with the core WordPress Walker_Nav_Menu being extended within PHP 5.4.24 WordPress V3.8.2
<?php
class My_Walker extends Walker_Nav_Menu {
}
?>
jQuery(function() {
var bootstrap = [
'affix',
'alert',
'button',
'carousel',
'collapse',
'dropdown',
'modal',
'popover',
@grok
grok / device.js
Created January 9, 2014 22:05
Requires: //cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js
var device = {
touch: false,
mobile: false,
over: '',
out: '',
retina: false,
transitions: false,
android: false
};