Skip to content

Instantly share code, notes, and snippets.

View forkbombe's full-sized avatar
🎯
Focusing

Joe Buckle forkbombe

🎯
Focusing
View GitHub Profile
@forkbombe
forkbombe / monit.py
Created July 21, 2016 15:43
Python Consol Args Example using psutil
#!/usr/bin/env python
import sys
import getopt
import psutil
def main(argv):
# Define variables
cpuout = False
@forkbombe
forkbombe / post-type.php
Created June 16, 2016 10:04
An example of how to create a WordPress Custom Post type using an Object Oriented approach
<?php
/**
* Use namespace to avoid conflict
*/
namespace PostType;
/**
* Class Event
* @package PostType
*
@forkbombe
forkbombe / backupdb.sh
Created September 1, 2015 07:54
Automated backup of MySQL database via cron
#!/bin/sh
USER=$1
PASS=$2
DB=$3
HOST=''
DATE=`date +"%Y%m%d"`
cd ~/db-daily
mysqldump -u $USER -p$PASS -h $HOST $DB | gzip > $DB.sql.gz
@forkbombe
forkbombe / sorting-example.js
Last active August 29, 2015 14:16
Example of sorting numbers in a weight-based order
var items = function(num) {
var arr = [1,3,3,5,2,7,4,10,6,4];
/*
* Sort array low-high first
*/
arr.sort(function(a,b) {
return a - b;
});
@forkbombe
forkbombe / twitterWidget.class.php
Created August 9, 2014 10:36
A WordPress Twitter Widget Class
<?php
class twitterWidget extends WP_Widget {
public function config() {
return 'twitterWidget'; // Obj
}
function __construct() {
parent::__construct(
'twitter_widget', // Base ID