Skip to content

Instantly share code, notes, and snippets.

View pstuifzand's full-sized avatar

Peter Stuifzand pstuifzand

View GitHub Profile
@pstuifzand
pstuifzand / MarpaX-JSON.pm
Last active December 10, 2015 14:28
A JSON parser in Marpa.
package MarpaX::JSON;
use strict;
use Marpa::R2 2.039_000;
sub new {
my ($class) = @_;
my $self = bless {}, $class;
$self->{grammar} = Marpa::R2::Scanless::G->new(
@bradfitz
bradfitz / diskchecker.pl
Created July 24, 2012 21:05
diskchecker.pl
#!/usr/bin/perl
#
# Brad's el-ghetto do-our-storage-stacks-lie?-script
#
sub usage {
die <<'END';
Usage: diskchecker.pl -s <server[:port]> verify <file>
diskchecker.pl -s <server[:port]> create <file> <size_in_MB>
diskchecker.pl -l [port]
@Ignition
Ignition / did-it-work.sh
Created April 13, 2011 10:31
Blog-p1-i3
#!/bin/sh
zcat -f /var/log/auth.log* | grep -f bad-phrases | awk '{print $1,$2}' | sort -k 1,1M -k 2n | grep -vf white-list | uniq -c
## Output
#
# 953 Mar 13
# 1420 Mar 14
# 1783 Mar 15
# 1366 Mar 16
# 4572 Mar 17
@Ignition
Ignition / tofirewall.sh
Created April 12, 2011 16:55
Blog-p1-i2
#!/bin/sh
./badlist.sh | while read ipaddr
do
iptables -I INPUT -s ${ipaddr} -j DROP
done
iptables-save > /etc/iptables.rules