Skip to content

Instantly share code, notes, and snippets.

@zyphlar
zyphlar / ads.html
Created Sep 17, 2011
HeatSync Digital Signage
View ads.html
<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 Jan 26, 2012
Nagios PHP querier
View nag.php
<?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 Feb 10, 2012
Login Logging Script
View logging.vbs
On Error Resume Next
'''Variables
Dim wsNetwork
Dim outUser
Dim outComputer
Dim outIP
Dim logPath
Dim septxt
@zyphlar
zyphlar / asterisk-status.php
Created Feb 29, 2012
Asterisk log monitoring
View asterisk-status.php
<?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 Mar 16, 2012
Script to add new monitors in Nagios
View nagios-newmonitor.sh
#!/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
Basic Apache/PHP Start Page
View index.php
<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 Dec 17, 2015
Batch convert JPEG sequences into MPEG movies
View img2mpg.sh
# 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
finding minimal value of a simplexml object in php
View minimal-xml-value.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
FatSecret API in Ruby on Rails example
View fatsecret.rb
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 Jun 26, 2012
Cheap and Dirty Asterisk Logfile Analysis
View asterisk-logfile-analyzer.php
<?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!
*