Skip to content

Instantly share code, notes, and snippets.

Brad Lhotsky reyjrar

Block or report user

Report or block reyjrar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@reyjrar
reyjrar / git-log-code-review.log
Created Apr 10, 2014
Sample output of a 'git log --reverse' when using Git::Code::Review
View git-log-code-review.log
commit 32e77a880484a60431b7e2d841549e0b6a96057f
Author: Brad Lhotsky <brad.lhotsky@booking.com>
Date: Wed Apr 2 22:11:05 2014 +0200
Initializing source repository.
---
audit_repo: /Users/blhotsky/tmp/repo
branch: master
reviewer: brad.lhotsky@booking.com
source_repo: git@github.com:reyjrar/Parse-Syslog-Line.git
@reyjrar
reyjrar / mbsyncrc
Created Jan 12, 2015
New old mail setup
View mbsyncrc
Expunge Slave
Create Both
CopyArrivalDate yes
Sync All
SyncState *
IMAPAccount company
Host imap.company.com
CertificateFile ~/Certificates/godaddy.pem
UseIMAPS yes
View gist:54c69ed1c7817368fa46
#!/usr/bin/env perl
#
use strict;
use warnings;
use Benchmark qw(cmpthese timethese);
my @tests = (
q{testing 12345 some more stuff},
q{123 testing some stuff},
@reyjrar
reyjrar / del-aggregated.sql
Created May 30, 2015
Deletion with Aggregated Data
View del-aggregated.sql
WITH dups AS(
select response_id, answer_id, section
from meta_answer
group by response_id, answer_id, section
having count(1) > 1
)
DELETE FROM meta_answer ma
WHERE EXISTS (
SELECT 1
FROM dups
@reyjrar
reyjrar / gist:628553
Created Oct 15, 2010
Mech/TreeBuilder Example
View gist:628553
#!/usr/bin/perl
#
# Code to turn the security report into
# a tab delimited text file.
#
# Code By Brad Lhotsky <lhotskyb@mail.nih.gov>
#
# use at your own risk, no guarantees or warranties associated.
# distributed under the same license as perl itself
@reyjrar
reyjrar / kerberos.pm
Created Mar 23, 2011
PacketFence authentication::kerberos
View kerberos.pm
package authentication::kerberos;
=head1 NAME
authentication::kerberos - kerberos authentication
=head1 SYNOPSYS
use authentication::kerberos;
my ( $authReturn, $err ) = authenticate (
@reyjrar
reyjrar / pf-add-primary-keys.sql
Created Apr 27, 2011
add primary keys to tables lacking them
View pf-add-primary-keys.sql
alter table configfile add PRIMARY KEY ( filename );
@reyjrar
reyjrar / eris_import_users_devices.pl
Created May 17, 2011
Sample working with DBIx::Class and PacketFence
View eris_import_users_devices.pl
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw{ say };
use lib qw{
/usr/local/pf/lib
/opt/local/eris/lib};
use pf::schema;
@reyjrar
reyjrar / orm_from_database.pl
Created May 17, 2011
Create the PacketFence ORM Classes from the Database
View orm_from_database.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Config::IniFiles;
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
if( !-d './lib') {
die "must be run in the root dir of PacketFence!\n";
}
@reyjrar
reyjrar / chi-squared-dist-df5.r
Created May 17, 2011
Graph a Chi-Squared Distribution with 5 Degrees of Freedom
View chi-squared-dist-df5.r
# Generic Chi-Squared Graph at 5 D of F.
x <- seq(0, 20, length=100)
hx <- dchisq(x, 5)
plot(x, hx, type="l", col="red", xlab="test statistics",
ylab="Density", main="Chi-Squared Distribution")
segments( x0=9.26, y0=0, x1=9.236, y1=max(hx), lty=2 )
text( 12, 0.12, "cv=9.236" )
legend( "topright", inset=0.05, c("df = 5"), lty=c(1), col=c("red") )
You can’t perform that action at this time.