Skip to content

Instantly share code, notes, and snippets.

@zyphlar
zyphlar / ads.html
Created September 17, 2011 07:28
HeatSync Digital Signage
<html>
<head>
<style type="text/css">
body { background-color: #000; margin: 0;}
.adblock { display: block;
float: left;
width: 46%;
text-align: center;
height: 190px;
margin: 5px;
@zyphlar
zyphlar / nag.php
Created January 26, 2012 02:59
Nagios PHP querier
<?php
// nag.php by Will Bradley, www.zyphon.com/arduino-nagios
// Script to parse Nagios status.dat and present it in simplified HTML.
// Also grabs graph images from /pnp4nagios if you edit pnp4nagios' apache.conf to not require authentication.
//
// Based on statusXML.php by Jason Antman
//
// +----------------------------------------------------------------------+
// | PHP EMS Tools http://www.php-ems-tools.com |
// +----------------------------------------------------------------------+
@zyphlar
zyphlar / logging.vbs
Created February 10, 2012 22:49
Login Logging Script
On Error Resume Next
'''Variables
Dim wsNetwork
Dim outUser
Dim outComputer
Dim outIP
Dim logPath
Dim septxt
@zyphlar
zyphlar / asterisk-status.php
Created February 29, 2012 19:18
Asterisk log monitoring
<?php
$output = array();
// This command finds the last 100 mentions of "Peer" in the log. Modify using your own keywords!
exec("grep Peer /var/log/asterisk/full | tail --lines=100", $output);
$output = array_reverse($output);
$today = date("M d");
$yesterday = date("M d",time()-86400);
@zyphlar
zyphlar / nagios-newmonitor.sh
Created March 16, 2012 17:51
Script to add new monitors in Nagios
#!/bin/bash
# newpingmonitor.sh
# Sets up monitoring for new basic ping monitors in nagios
# Ths script may be called remotely
E_BADARGS=65
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` <servername> <ip address>"
@zyphlar
zyphlar / index.php
Created May 6, 2012 01:08
Basic Apache/PHP Start Page
<html>
<head>
<style type="text/css">
body {
background-color: #000;
color: #fff;
font-family: Arial,Helvetica,sans-serif;
}
</style>
</head>
@zyphlar
zyphlar / img2mpg.sh
Last active December 17, 2015 06:48
Batch convert JPEG sequences into MPEG movies
# img2mpg - Will Bradley 2012-2015
# Licensed under Creative Commons Attribution-ShareAlike (CC BY-SA 2.0)
# http://creativecommons.org/licenses/by-sa/2.0/
#
# https://gist.github.com/zyphlar/2629626/
#
# Requirements: imagemagick and ffmpeg (the convert and ffmpeg commands)
#
# This is not a very 'safe' script because it moves and deletes files. You should run it with junk data at first, maybe copying each section into a separate script for testing before trying to run the whole thing.
@zyphlar
zyphlar / minimal-xml-value.php
Created May 26, 2012 06:38
finding minimal value of a simplexml object in php
function find_min_rent($xml, $floorplanid) {
$min_rent = 999999; // a ridiculously high number
foreach($xml->xpath("/PhysicalProperty/Property/Unit[@FloorplanID='$floorplanid']") as $unit) {
if($unit->EffectiveRent['min'] < $min_rent) { // save this rent amount if it's the lowest so far
$min_rent = $unit->EffectiveRent['min'];
}
}
return $min_rent;
}
@zyphlar
zyphlar / fatsecret.rb
Created May 31, 2012 10:01
FatSecret API in Ruby on Rails example
require "openssl"
require "base64"
require "digest/md5"
require "net/http"
class String
def esc
CGI.escape(self).gsub("%7E", "~").gsub("+", "%20")
end
end
@zyphlar
zyphlar / asterisk-logfile-analyzer.php
Created June 26, 2012 10:19
Cheap and Dirty Asterisk Logfile Analysis
<?php
/* Cheap and Dirty Asterisk Logfile Analysis
* by Will Bradley, http://willbradley.name
* Released to the public domain, 6-26-2012
*
* To install, modify the $dbname and other variables,
* create the MySQL database, user, and permissions,
* and double-check the asterisk logfile paths/formats below.
* This is a very cheap script, use at your own risk!
*