Skip to content

Instantly share code, notes, and snippets.

@adamtaylor
adamtaylor / delete-rebased-branches.pl
Created June 18, 2019 17:21
Script to delete branches that have been rebased before merging and therefore can't be easily identified as merged.
#!perl
use strict;
use warnings;
use feature 'say';
# Very crude argument handling/safety check
say "Usage: $0 for_real # really perform actions";
my $for_real = $ARGV[0];
# Find the unmerged branches
@adamtaylor
adamtaylor / archive-old-branches.pl
Last active October 4, 2019 23:36
Script to archive branches older than two years
#!perl
use strict;
use warnings;
use feature 'say';
use DateTime;
use DateTime::Format::ISO8601;
# Very crude argument handling/safety check
say "Usage: $0 for_real # really perform actions";
@adamtaylor
adamtaylor / Jenkinsfile
Created April 4, 2019 22:05
Jenkinsfile with nested states
pipeline {
agent any
stages {
stage('Tests') {
stages {
stage('Compilation') {
steps {
sh 'make test > test_results.xml || true'
junit 'test_results.xml'
}

Keybase proof

I hereby claim:

  • I am adamtaylor on github.
  • I am adamtaylor (https://keybase.io/adamtaylor) on keybase.
  • I have a public key ASCuw0Xx39H58AP3eSaufBHXKcIPcQ_09I7B3vbW6c53-Ao

To claim this, I am signing this object:

@adamtaylor
adamtaylor / gist:07259709e9d6fb8fee1bc71180cf4fa8
Created August 3, 2017 11:13
outgoing gearman connections from worker6
adam@worker6:~$ sudo netstat -anp | grep 4730
[sudo] password for adam:
tcp 0 0 205.186.144.90:53712 205.186.144.57:4730 TIME_WAIT -
tcp 0 0 205.186.144.90:52206 205.186.144.57:4730 TIME_WAIT -
tcp 0 0 205.186.144.90:52130 205.186.144.57:4730 TIME_WAIT -
tcp 0 0 205.186.144.90:50858 64.207.149.92:4730 TIME_WAIT -
tcp 0 0 205.186.144.90:51666 64.207.149.92:4730 TIME_WAIT -
tcp 0 0 205.186.144.90:55050 64.207.149.92:4730 TIME_WAIT -
tcp 0 0 205.186.144.90:33538 205.186.144.57:4730 ESTABLISHED 16672/perl
tcp 0 0 205.186.144.90:54780 64.207.149.92:4730 TIME_WAIT -
# dancer code
package ip_address_test;
use Dancer2;
our $VERSION = '0.1';
get '/' => sub {
template 'index';
};
@adamtaylor
adamtaylor / User.pm
Last active August 29, 2015 14:27
Catalyst authentication auto_update and auto_create result/resultset methods
package MyApp::Schema::Result::User;
...
# Called everytime a user logs in
sub auto_update {
my ( $self, $auth_args ) = @_;
$self->update( $auth_args );
@adamtaylor
adamtaylor / MyApp-Contoller-Root.pm
Last active August 29, 2015 14:27
Catalyst OAuth Controller Actions
package MyApp::Controller::Root;
sub facebook_signup :Path('facebook_signup') :Args(0) {
my ($self, $c) = @_;
# Authenticate the user using the facebook realm
# Also ask for some extra permissions
if ( my $user = $c->authenticate(
{ scope => ['email','user_location'] },
'facebook'
@adamtaylor
adamtaylor / MyApp.pm
Created August 17, 2015 22:15
Catalyst OAuth Configuration
package MyApp;
...
__PACKAGE__->config(
# Catalyst::Plugin::Authentication configuration
'Plugin::Authentication' => {
# If $c->authenticate() is called in the app without a
# realm argument, Strava will be checked.
default_realm => 'strava',
@adamtaylor
adamtaylor / scrape.pl
Created October 14, 2013 07:23
gumtree bike scraper
#!perl
use warnings;
use strict;
use DDP;
use Web::Scraper;
use URI;
use Email::Sender;