Skip to content

Instantly share code, notes, and snippets.

View mrl22's full-sized avatar
💭
Always coding

Richard Leishman mrl22

💭
Always coding
View GitHub Profile
@mrl22
mrl22 / hpraidcheck.sh
Created January 6, 2017 15:04
If something went wrong with the HP SmartArray disks this script will send an error email
#!/bin/bash
###
#If something went wrong with the HP SmartArray disks this script will send an error email
###
if [ `/usr/sbin/hpacucli controller slot=2 physicaldrive all show | grep -E '(Failed|Rebuilding)'| wc -l` -gt 0 ]
then
msg="RAID Controller Errors"
#echo $msg
/usr/sbin/hpacucli controller slot=2 ld all show detail > /tmp/hpacucli.log
mail -s "$HOSTNAME [ERROR] - $msg" "some-email@addrss.com" < /tmp/hpacucli.log
@mrl22
mrl22 / slide-out-underline.markdown
Last active January 9, 2017 15:02
Slide out underline
@mrl22
mrl22 / hover-triangle-animation.html
Last active January 10, 2017 14:41
Scolmore Hover Animation
<div class="homepage-content-1 espHoverZoom ehzRight">
<div class="ehzSlant">
<div class="ehzContent">
HTML HERE
</div>
<div>
</div>
@mrl22
mrl22 / index.html
Created January 20, 2017 17:53
Specific info at specific times of day EST timezone
<div class="someclass"></div>
@mrl22
mrl22 / kappa-animation.markdown
Created January 20, 2017 17:56
Kappa animation
@mrl22
mrl22 / index.html
Created March 28, 2017 18:31
My Age
<div id="age"></div>
@mrl22
mrl22 / functions.php
Created April 6, 2017 11:15 — forked from brendonexus/Wordpress current template hook
Wordpress current template hook
add_action('get_footer', 'show_template');
function show_template()
{
global $template;
if ($_SERVER['REMOTE_ADDR'] == 'ip_address') echo basename($template);
}
function your_custom_pagination() {
global $wp_query;
$total = $wp_query->max_num_pages;
if ( $total > 1 ) {
if ( !$current_page = get_query_var('paged') ) {
$current_page = 1;
}
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '?paged=%#%',
@mrl22
mrl22 / letmc_properties.php
Created May 26, 2017 09:03
Get LetMC Properties
$clientid = '{0000-0000-0000-0000}';
function letmc_call($action, $xml) {
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
@mrl22
mrl22 / curl2json.php
Last active June 26, 2017 10:21
Cached cURL Request
function curl2json($url, $header_opts=array(), $cache_life=300) {
$cache_file = md5($url.json_encode($header_opts)).'.txt';
if (!file_exists($cache_file) || (time() - filemtime($cache_file)) >= $cache_life) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_FOLLOWLOCATION => FALSE,
CURLOPT_RETURNTRANSFER => 1,