Skip to content

Instantly share code, notes, and snippets.

View typhonius's full-sized avatar

Adam Malone typhonius

View GitHub Profile

Keybase proof

I hereby claim:

  • I am typhonius on github.
  • I am typhonius (https://keybase.io/typhonius) on keybase.
  • I have a public key whose fingerprint is 81AC 744D AEA4 BB5F 6971 D78E 8521 A8CC D186 9962

To claim this, I am signing this object:

@typhonius
typhonius / cidr2varnish.pl
Last active August 29, 2015 14:10
Changes IP address CIDRs to varnish vcl regex.
#!/usr/env/perl
use strict;
use warnings;
use Net::Netmask;
use Regexp::Assemble::Compressed;
print "Enter the filename to varnishize: ";
my $filename = <STDIN>;
@typhonius
typhonius / generic_puppet_install.sh
Last active September 10, 2015 03:50
Generic way to install puppet across whichever platform
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
function get_hostname() {
read -p "Enter hostname: " hostname
if [ -z "$hostname" ]; then
@typhonius
typhonius / more_ape_tests.patch
Last active August 29, 2015 14:08
further tests for ape
diff --git a/ape.test b/ape.test
index 756cfeb..f34a7fe 100644
--- a/ape.test
+++ b/ape.test
@@ -31,6 +31,7 @@ class ApeTestHelper extends DrupalWebTestCase {
$modules[] = 'path';
$modules[] = 'user';
$modules[] = 'common_test';
+ $modules[] = 'ape_redirect_test';
parent::setUp($modules);
@typhonius
typhonius / ghetto_load_detector.sh
Created August 8, 2014 07:49
Ultra dirty, super basic, nagios replacement.
#!/bin/bash
STLOAD=$(cat /proc/loadavg | awk '{print $1}')
while true; do
FINLOAD=$(cat /proc/loadavg | awk '{print $1}')
if (( $(echo "$STLOAD $FINLOAD" | awk '{ if ($1 >= 8 && $2 >= 8) print 1}') )); then
if [[ -z $TIME ]]; then
TIME=$(date +"%s")
fi
@typhonius
typhonius / what_should_i_port.pl
Last active March 22, 2016 03:56
Super delicious perl script to get a list of modules from d.o and select one at random for the user to port to Drupal 8. Also it's perlcritic brutal approved!
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Simple;
use Scalar::Util qw(looks_like_number);
our $VERSION = 1.337;
@typhonius
typhonius / cacheplotter.drush.inc
Created April 30, 2014 09:51
I feel dirty putting the Drupal 6.x integration in there but it's still a supported API version so w/e. This checks your db cache tables for sizes of values. Useful if you're using memcache and are worried about exceeding the max page size.
<?php
/**
* @file
* Drush command to check for overly large items in DB cache tables that will
* not work with memcache.
*/
/**
* Implements hook_drush_command().
user_restrictions_create_form:
route_name: user_restrictions.create_form
title: 'Add rule'
appears_on:
- user_restrictions.list_form
@typhonius
typhonius / pound.cfg
Created February 23, 2014 07:52
pound configuration file
User "apache"
Group "apache"
#RootJail "/var/pound/jail"
#Alive 60
ListenHTTPS
HeadRemove "X-Forwarded-Proto"
AddHeader "X-Forwarded-Proto: https"
Address 0.0.0.0
Port 443
@typhonius
typhonius / newmac
Created February 22, 2014 23:02
Sets a new mac address
newmac() {
MAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
echo "Setting MAC address to $MAC"
sudo ifconfig en0 ether $MAC
}