Skip to content

Instantly share code, notes, and snippets.

View Drarok's full-sized avatar

Mat Gadd Drarok

View GitHub Profile
<?php
function csv_to_array($filename='/root/samhodson/nagios-dev.csv', $delimiter=',', $enclosure = '"')
{
if(!file_exists($filename) || !is_readable($filename)) echo "neg";
return FALSE;
$header = NULL;
$data = array();
if (($handle = fopen($filename, 'r')) !== FALSE)
<?php
$username = 'trololololol';
$password = 'trololololol';
$url = 'http://some-project.localdev/';
// Set some curl options.
$ch = curl_init();
curl_setopt_array($ch, array(
SELECT
ServerObject.Name,
storageYesterday.Committed AS committedYesterday,
storageToday.Committed AS committedToday,
ROUND((storageToday.Committed - storageYesterday.Committed) / 1073741824) AS DifferenceGB
FROM
ServerObject
LEFT OUTER JOIN
StorageUsedByVm AS storageYesterday ON
storageYesterday.VcenterId = ServerObject.VcenterId
@Drarok
Drarok / pr-merged.sh
Last active January 4, 2016 09:29 — forked from sampart/pr-merged.sh
#!/bin/bash
# PR been merged on github? This will checkout $1 || develop, git pull, and then delete the branch you were on.
# Thanks http://stackoverflow.com/a/1593487/328817
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || branch_name="(unnamed branch)"; # detached HEAD
branch_name=${branch_name##refs/heads/};
if [ "$branch_name" = "develop" ] || [ "$branch_name" = "master" ]
then
@Drarok
Drarok / gist.php
Last active January 2, 2016 01:28 — forked from anonymous/gist:8218272
Converted example to use PDO.
<?php
$dsn = 'mysql:host=trolololol;dbname=WOOT!';
$username = 'yeah';
$password = 'MMMMM hmm';
$pdo = new PDO($dsn, $username, $password);
$sql = 'SELECT `date`, SUM(`Commited`) AS committedSum FROM StorageUsedByVm GROUP BY `date`';
$stmt = $pdo->query($sql);
/usr/share/saffire/modules
/usr/share/saffire/modules/sfl
/usr/share/saffire/modules/sfl/io.sf
/usr/share/saffire/modules/sfl/saffire.sf
/usr/share/saffire/modules/Framework.sf
/usr/share/saffire/modules/Framework
/usr/share/saffire/modules/Framework/View.sf
/usr/share/saffire/modules/Framework/Http.sf
@Drarok
Drarok / TS3Radio.php
Last active December 18, 2015 00:48 — forked from JMatthewman/TS3Radio.php
<?php
// Require authentication password
require_once("auth.php");
class TS3Radio
{
protected $_clientHost;
protected $_clientPort;
@Drarok
Drarok / EventManagerAwareTrait.php
Created October 18, 2012 15:50 — forked from Mezzle/EventManagerAwareTrait.php
ServiceLocator/EventManager Traits
<?php
namespace Protec\Stdlib;
use \Zend\EventManager\EventManagerInterface;
use \Zend\ServiceManager\ServiceLocatorAwareInterface;
trait EventManagerAwareTrait
{
protected $event_manager;