Skip to content

Instantly share code, notes, and snippets.

@waffle2k
waffle2k / heartbleed-check.sh
Created April 8, 2014 13:45
Check a supplied host for the heartbleed extension
#!/bin/sh
echo -e '\n' | openssl s_client -connect $1:443 -crlf -tlsextdebug 2>&1| grep 'server extension "heartbeat" (id=15)' || echo safe
@waffle2k
waffle2k / debian-rules.openssl-1.0.1g.patch
Created April 8, 2014 07:09
This is the patch file to make the latest version of openssl compile against ubuntu
--- debian/rules.old 2013-07-15 08:16:12.000000000 -0400
+++ debian/rules 2014-04-08 03:06:31.584582710 -0400
@@ -53,7 +53,7 @@
dh_testdir
# perl util/ssldir.pl /usr/lib/ssl
# chmod +x debian/libtool
- ./Configure no-shared $(CONFARGS) debian-$(DEB_HOST_ARCH)
+ ./Configure no-shared $(CONFARGS) linux-elf
$(if $(filter enable-ec_nistp_64_gcc_128, $(CONFARGS)), make $(CROSS) -f Makefile depend)
make $(CROSS) -f Makefile all
@waffle2k
waffle2k / spam-redirect-check-and-report.pl
Last active August 29, 2015 13:58
Given a list of URLs, check if they redirect elsewhere, and provide the abuse contact for the IP network on which the domain resides.
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use LWP::Simple;
sub contact_lookup_ip {
my $ip = shift;
my $q = join( ".", reverse( split( /\./, $ip ) ) ) . ".abuse-contacts.abusix.org";
@waffle2k
waffle2k / weather
Created April 2, 2014 15:53
Toronto weather
#!/bin/sh
curl -s weather.opensrs.com | perl -E 'print grep { /Currently/ .. /-?\d+\.\d+/ } <>' | perl -lane 'print $1 if /(-?\d+\.\d+)/'
@waffle2k
waffle2k / cpplog.cpp
Created March 26, 2014 19:54
Example of using the c++ logging
std::clog.rdbuf(new log::FileLog("/dev/stderr"));
if (char *l = getenv("DEBUGLOG")){
if (0==strcmp("syslog",l)){
std::clog.rdbuf(new log::SysLog(argv[0], LOG_LOCAL0));
}
else {
// Assign it to the supplied file
std::clog.rdbuf(new log::FileLog(l));
}
@waffle2k
waffle2k / git-sub
Created March 26, 2014 13:31
Fetch all submodules
#!/bin/sh
# git-sub
git submodule foreach git pull origin master
@waffle2k
waffle2k / dkim-gmail-fail.flingo
Created March 25, 2014 15:40
Flingo file for detecting gmail emails without a valid DKIM signature
METARULE "dkim-test-fail" (
"dkim-gmail-not-verified",
"from-gmail",
"grab-from",
"grab-subject" )
{
log "Failed-to-pass-DKIM-signature-verification";
iter "dkim:d";
iter "log:recipient";
iter "log:sender";
@waffle2k
waffle2k / import_public_keys.sh
Created March 18, 2014 18:07
Import public keys from a webpage.
#!/bin/bash
#
# Import public keys from a wiki page, etc.
# Poor man's keyserver.
SOURCE=$1
if [ -z $SOURCE ]; then
echo "Please supply a URL"
exit 1
@waffle2k
waffle2k / git-workdone
Created March 18, 2014 15:08
This little script will tell you how much work a person has been doing over a certain time period.
#!/usr/bin/perl
use strict;
my $author = `git config user.email`;
if ($ARGV[0] =~ /^\S+?\@\S+$/){
$author = shift;
}
my $since = join( " ", @ARGV );
@waffle2k
waffle2k / mean-deviation.py
Created February 12, 2014 14:01
Calculate the mean deviation
#!/usr/bin/python
import sys
numerator_set = []
for input in sys.stdin.readlines():
numerator_set.append( float(input) )
numerator = sum( numerator_set ) * 1.0