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 / parse-secure.pl
Created November 17, 2011 05:24
Parse /var/log/secure for hacking attempts and insert into a SQL DB
#!/usr/bin/perl
#########################################################################
# Parse /var/log/secure for attacks and log the attacks to a database.
# 11/16/2011
# evandhoffman@gmail.com
#########################################################################
use strict;
use warnings;
@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 / reverseproxy.conf
Created February 15, 2012 21:29
nginx reverse proxy config
proxy_cache_path /var/lib/nginx/cache/staticfiles levels=1:2 keys_zone=staticfilecache:120m inactive=180m max_size=50m;
proxy_cache_path /var/lib/nginx/cache/php levels=2:2 keys_zone=php:10m inactive=180m max_size=50m;
proxy_temp_path /var/lib/nginx/proxy;
proxy_connect_timeout 30;
proxy_read_timeout 120;
proxy_send_timeout 120;
#IMPORTANT - this sets the basic cache key that's used in the static file cache.
proxy_cache_key "$scheme://$host$request_uri";
# http://wp-performance.com/2010/10/nginx-reverse-proxy-cache-wordpress-apache/
@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.