Skip to content

Instantly share code, notes, and snippets.

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 / 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;
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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;