Skip to content

Instantly share code, notes, and snippets.

@evandhoffman
evandhoffman / Results.rdf
Created October 27, 2011 19:30
Results.rdf for RT 3.8 that includes Ticket # in the <item> title
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
%# <jesse@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
@evandhoffman
evandhoffman / ls.txt
Created October 28, 2011 02:42
Chmod question
[evan@evan-fedora Windows7]$ ls -Flrt
total 18784080
drwxr-xr-x. 3 evan evan 4096 Feb 5 2011 caches/
-rw-------. 1 evan evan 9769058304 Feb 14 2011 Windows 7.vmdk
-rw-r-----. 1 evan evan 28011 Feb 14 2011 Windows 7-Snapshot1.vmsn
-rw-r--r--. 1 evan evan 1641 Feb 14 2011 Windows 7.vmxf
-rw-r--r--. 1 evan evan 303512 Jul 8 15:57 vmware-2.log
-rw-r--r--. 1 evan evan 706853 Jul 8 19:07 vmware-1.log
-rw-r--r--. 1 evan evan 313609 Sep 9 17:28 vmware-0.log
-rw-r-----. 1 evan evan 9464053760 Sep 9 17:41 Windows 7-000001.vmdk
@evandhoffman
evandhoffman / redirect-counter.pl
Created January 10, 2012 18:41
Redirect counter. Follows a URL n times and reports on the landing URL and how many times it hit each one (if > 1)
#!/usr/bin/perl
use strict;
use warnings;
require LWP::UserAgent;
#require HTTP::Request;
require HTTP::Response;
#use Data::Dumper::Perltidy;
@evandhoffman
evandhoffman / flac2mp3.pl
Created January 19, 2012 21:12
flac2mp3
#!/usr/local/bin/perl
# Converts flac files en masse to MP3, setting ID3v2 tags pulled from the flac files
# (c) November 7, 2005 Evan D. Hoffman <evandhoffman@gmail.com>
# Licensed under the BSD license, use it as your own risk
#
# http://www.freebsd.org/copyright/freebsd-license.html
# flac: http://flac.sourceforge.net/download.html
# lame: http://lame.sourceforge.net/download/download.html
@evandhoffman
evandhoffman / resize-for-photoframe.pl
Created February 27, 2012 03:25
2 different ways to resize a ton of pics for a digital photo frame.
find /src/ -iname \*jpg -execdir convert -scale 800x533 -quality 80 {} /target/{} \;
@evandhoffman
evandhoffman / resize.pl
Created February 28, 2012 18:01
Resize jpegs and rename them into date-based folders.
#!/usr/bin/perl
# Resize all images in a directory for the Insignia 7" Digital photo
# frame (Model: NS-DPF0712G), 800x480 resolution.
use strict;
use warnings;
use File::Find;
use Image::Magick;
use Image::ExifTool;
@evandhoffman
evandhoffman / nginx.conf
Created March 8, 2012 22:55
spidercounter.pl
# Logformat fed into the script is this:
log_format cachemiss '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$upstream_cache_status"';
@evandhoffman
evandhoffman / gist:2029124
Created March 13, 2012 14:29
Career advice from Jean-Luc Picard
PICARD: Will, what the hell are you still doing here?
RIKER: Sir?
PICARD: You've been offered the Melbourne.
RIKER: I've decided not to pursue that commission at this time.
PICARD: She's a fine ship, Will.
RIKER: Yes, but she's not the Enterprise. With all due respect, sir, you need me. Particularly now.
PICARD: Indeed? Starfleet needs good captains, particularly now. Reconsider your decision.
RIKER: Are you telling me to leave, Captain?
PICARD: I'm asking you to look at your career objectively. Will, you're ready to work without a net. You're ready to take command. And, you know, the Enterprise will go along just fine without you.
@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')