Skip to content

Instantly share code, notes, and snippets.

@jlav1n
jlav1n / pre-commit
Created November 30, 2017 22:20
pre-commit Git hook
#!/bin/sh
#
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
#!/usr/bin/perl
use File::Temp;
my $basedir = "/tmp/sendmail-$ENV{'USER'}";
my $sendmail = '/usr/sbin/sendmail';
my @opts;
for(@ARGV) {
push @opts, $_;
}
#!/bin/env perl
use strict;
use warnings;
use JSON::MaybeXS qw(decode_json);
chomp( my $input = <STDIN> );
my $ref = decode_json( $input );
diff --git a/lib/Shipment/FedEx.pm b/lib/Shipment/FedEx.pm
index 67ca542..b15897e 100644
--- a/lib/Shipment/FedEx.pm
+++ b/lib/Shipment/FedEx.pm
@@ -262,6 +262,7 @@ sub _build_services {
PackageCount => $self->count_packages || 1,
PackageDetail => 'INDIVIDUAL_PACKAGES',
RequestedPackageLineItems => \@pieces,
+ RateRequestTypes => 'LIST',
},
<?php
/*
Plugin Name: Disable Pingbacks
Description: This plugin disables pingbacks.
Version: 1.0
Author: Josh Lavin
Author URI: http://www.endpoint.com
*/
add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['pingback.ping'] ); return $methods; } );
@jlav1n
jlav1n / httpd.conf
Last active August 29, 2015 14:28
Interchange catalog at root URL. Prevents Interchange from having to handle all 404 requests, unless the request does not have an extension, or is a known file type that IC serves.
ScriptAlias /cgi-bin/ /home/mysite/cgi-bin/
RewriteEngine On
RewriteRule ^/index(\.html?)?$ / [R=301]
RewriteRule ^/?$ /cgi-bin/mysite/index [L,NS,PT]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
RewriteRule ^ - [L,NS]
RewriteCond %{REQUEST_FILENAME} \.
@jlav1n
jlav1n / fgciwrap
Last active November 14, 2015 21:43
# fcgiwrap launcher, /etc/init.d/fcgiwrap
# see: https://github.com/gnosek/fcgiwrap
# and https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/
# and: https://web.archive.org/web/20130324035657/http://nginx.localdomain.pl/wiki/FcgiWrap
# props: https://web.archive.org/web/20130322054803/http://www.tonimueller.org/blog/2012/09/hosting-interchange-on-nginx.html
#
#!/usr/bin/perl
use strict;
use warnings FATAL => qw( all );
@jlav1n
jlav1n / httpd
Created August 5, 2015 22:35
/etc/logrotate.d/httpd
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
/var/log/httpd/*/logs/*log {
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "#333",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 60%)",
"@gray-lighter": "#ccc",
"@brand-primary": "#ed9924",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
{
"vars": {},
"css": [
"buttons.less",
"close.less",
"modals.less"
],
"js": [
"modal.js"
]