Skip to content

Instantly share code, notes, and snippets.

View greglamb's full-sized avatar

Greg Lamb greglamb

View GitHub Profile
@greglamb
greglamb / TiVo-ToDo-iCal.php
Created January 21, 2011 21:02
Web scrape your TiVo recording schedule into iCal format for use with Google Calendar
<?
/*
TiVo To-Do List to iCal
Requires iCalcreator (http://www.kigkonsult.se/iCalcreator/)
See your recording schedule in Google Calendar!
*/
ini_set('display_errors','Off');
@greglamb
greglamb / fips.sh
Created December 14, 2012 21:48 — forked from forkandwait/fips.sh
declare -A FIPS
declare -A STNAME
FIPS[AK]=02; STNAME[AK]=Alaska
FIPS[AL]=01; STNAME[AL]=Alabama
FIPS[AR]=05; STNAME[AR]=Arkansas
FIPS[AS]=60; STNAME[AS]=American Samoa
FIPS[AZ]=04; STNAME[AZ]=Arizona
FIPS[CA]=06; STNAME[CA]=California
FIPS[CO]=08; STNAME[CO]=Colorado
FIPS[CT]=09; STNAME[CT]=Connecticut
@greglamb
greglamb / update_phabricator.sh
Created May 6, 2013 17:37
Phabricator update script
#!/bin/sh
set -e
set -x
# This is an example script for updating Phabricator, similar to the one used to
# update <https://secure.phabricator.com/>. It might not work perfectly on your
# system, but hopefully it should be easy to adapt. This script is not intended
# to work without modifications.
@greglamb
greglamb / hack.sh
Created May 12, 2013 08:19 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@greglamb
greglamb / ticktock.php
Created October 7, 2013 20:28
When core dumps got you down: The Worst Case Scenario Debugger
<?php
declare(ticks=1);
function formatBytes($size, $precision = 2)
{
$base = log($size) / log(1024);
$suffixes = array('', 'k', 'M', 'G', 'T');
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
function &array_merge_recursive_distinct(array &$array1, &$array2 = null)
{
$merged = $array1;
if (is_array($array2))
foreach ($array2 as $key => $val)
if (is_array($array2[$key]))
$merged[$key] = is_array($merged[$key]) ? array_merge_recursive_distinct($merged[$key], $array2[$key]) : $array2[$key];
else
$merged[$key] = $val;
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
@greglamb
greglamb / gist:7902093
Last active December 30, 2015 23:39
Brute Force MIB Resolver
#!/usr/bin/perl
$childpid = open(NETSNMP_F, "snmptranslate -L o -M . cdrqCmtsCmStatusTable |");
while (<NETSNMP_F>) {
if ($_ =~ /^Cannot find module/) {
@mib = split(/[\(\)]/, $_);
if (!$z{$mib[1]}) {
print $mib[1]."\n";
system("curl -O -f http://www.circitor.fr/Mibs/Files/".$mib[1].".mib");
system("curl -O -f http://download.intermapper.com/thirdparty/libsmi-0.4.8/mibs/iana/".$mib[1].".txt");
@greglamb
greglamb / gist:8275292
Created January 5, 2014 23:04
brew node
brew install node --without-npm
curl https://npmjs.org/install.sh | sh