Skip to content

Instantly share code, notes, and snippets.

@evandhoffman
evandhoffman / fetch-phpbb.pl
Created March 13, 2012 18:23
Perl script to fetch all topics in a phpBB forum and save them to disk
#!/usr/bin/perl
use strict;
use warnings;
require LWP::UserAgent;
use POSIX qw/ceil/;
my $ua = LWP::UserAgent->new(agent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20100101 Firefox/10.0.2');
$ua->timeout(10);
@evandhoffman
evandhoffman / phpbb_postcount_editor.php
Created April 12, 2012 03:34
phpbb_postcount_editor.php
<?php
define('IN_PHPBB', true);
define('ADMIN_START', true);
define('NEED_SID', true);
// Include files
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
@evandhoffman
evandhoffman / getHosts.py
Created April 27, 2012 16:14
Zenoss - print out hostnames & IP addresses
def getDeviceProps(device, propNames):
res = ''
for i in propNames:
res += str(getattr(device, i)) + "\t"
return res
res = ''
#propNames = ('id', 'snmpindex', 'monitor', 'manageIp', 'productionState','preMWProductionState','snmpAgent','snmpDescr','snmpOid','snmpContact','snmpSysName','snmpLocation','snmpLastCollection','snmpAgent','rackSlot','comments','sysedgeLicenseMode','priority','zDeviceTemplates')
propNames = ('id','manageIp')
@evandhoffman
evandhoffman / copy-mp3.pl
Created June 16, 2012 18:45
Reorganize MP3s according to id3 tag info
#!/usr/bin/perl
#
use strict;
use warnings;
#use MP3::M3U::Parser;
use MP3::Tag;
use Data::Dumper;
use File::Copy;
evan@evan-desktop: ~ $ git clone evan@10.3.0.77:/home/evan/gitrepo clonedrepo2
Cloning into clonedrepo2...
evan@10.3.0.77's password:
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
evan@evan-desktop: ~ $ cd clonedrepo2/
evan@evan-desktop: ~/clonedrepo2 $ ls
poop
evan@evan-desktop: ~/clonedrepo2 $ echo poop2 > poop2
@evandhoffman
evandhoffman / fizzbuzz.pl
Created January 10, 2013 16:22
This is a challenge?
#!/usr/bin/perl
for (my $i = 1; $i <= 100 ; $i++) {
my $out = '';
if (($i % 3) == 0) {
$out .= 'Fizz';
}
if (($i % 5) == 0) {
$out .= 'Buzz';
}
@evandhoffman
evandhoffman / gist:4757843
Created February 11, 2013 21:37
Packages installed during ubuntu 12.10 Quetzal net install (from squid log).
http://changelogs.ubuntu.com/meta-release
httplib2_0.7.4-2_all.deb
https_0.9.7.5ubuntu5.2_amd64.deb
http://security.ubuntu.com/ubuntu/dists/quantal-security/InRelease
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/binary-amd64/Packages.bz2
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/binary-i386/Packages.bz2
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/debian-installer/binary-amd64/Packages.gz
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/i18n/Translation-en.bz2
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/i18n/Translation-en_US
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/i18n/Translation-en_US.bz2
@evandhoffman
evandhoffman / gist:5223860
Created March 22, 2013 19:04
xlog min recovery request is past current point
2013-03-22 14:56:52 EDT 17889 0 1/1 WARNING: xlog min recovery request D6D/2A61C1B0 is past current point D63/2BF6C10
2013-03-22 14:56:52 EDT 17889 0 1/1 CONTEXT: writing block 6 of relation base/16898/5389031_vm
xlog redo vacuum: rel 1663/16898/7237776; blk 103357, lastBlockVacuumed 30068
2013-03-22 14:56:52 EDT 17889 0 1/1 WARNING: xlog min recovery request D68/248B82D8 is past current point D63/2BF6C10
2013-03-22 14:56:52 EDT 17889 0 1/1 CONTEXT: writing block 0 of relation base/16898/4876829_vm
xlog redo vacuum: rel 1663/16898/7237776; blk 103357, lastBlockVacuumed 30068
2013-03-22 14:56:53 EDT 17895 0 WARNING: xlog min recovery request D67/2AAE9D40 is past current point D63/2BF6C10
2013-03-22 14:56:53 EDT 17895 0 CONTEXT: writing block 0 of relation base/16898/5484157_vm
2013-03-22 14:56:55 EDT 17895 0 WARNING: xlog min recovery request D6D/33FC44E0 is past current point D63/2BF6C10
2013-03-22 14:56:55 EDT 17895 0 CONTEXT: writing block 5 of relation base/16898
@evandhoffman
evandhoffman / zabbix_io_template.xml
Created May 16, 2013 13:48
Zabbix template for getting disk IO from SNMP via low-level discovery.
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-05-16T13:46:38Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
@evandhoffman
evandhoffman / clone-vms.ps1
Created November 15, 2013 18:40
Powershell script to clone VMs
$template = "qa3-template"
$datastore = "NAS1"
$vmNamePrefix = "qa3-filler"
$vmhost = Get-VMHost -Name "prod-vm202.prod.host.com"
$vmpool = "QA3 RP"
$location = "Junk Boxes"
$taskTab = @{}
# Create all the VMs specified in $newVmList
for ($i = 2; $i -lt 10; $i++) {
$vmname = $($vmNamePrefix + $i);