This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# TO BE PLACED IN .git/hooks/prepare-commit-msg | |
# The first comments out the "Conflicts:" part of a merge commit. | |
# The second creates a template for a commit message | |
# The third example adds a Signed-off-by line to the message, that can | |
# still be edited. This is rarely a good idea. | |
# This hook is invoked by git commit right after preparing the default log | |
# message, and before the editor is started. | |
# It takes one to three parameters. The first is the name of the file that |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Text::Xslate qw<mark_raw>; | |
use 5.010_000; | |
my $x = Text::Xslate->new( | |
function => { | |
p => sub { | |
return mark_raw( "L(@_)" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use common::sense; | |
use PPI; | |
my $file = shift; | |
die "Need a file to operate on\n" | |
if !$file | |
|| !-f $file; | |
my $doc = PPI::Document->new($file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use File::Basename qw<basename>; | |
my $file = shift | |
or die basename($0), ": need a file\n"; | |
my @branches = map { | |
chomp;substr($_,2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: | |
# Once you started git rebase --interactive master, and you are presented | |
# with the list of commit SHAs and commit messages, from Vim: | |
# - visually select all SHAs via "V}k" | |
# - launch git-rr: !git-rr | |
# - ... | |
# - profit! you now have the same info as before, just with the list of | |
# filenames which changed with each commit, and can now move around |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010_001; | |
use strict; | |
use warnings; | |
use Digest::SHA; | |
use JSON::XS; | |
use WWW::Mechanize; | |
use Time::HiRes qw<time gettimeofday tv_interval>; | |
use Getopt::Long; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://blogs.perl.org/users/randy_stauner/2011/06/exploratory-one-liners-with-less-typing.html | |
# and a couple more things which are *really* handy | |
function raptor { | |
case "$1" in | |
-*) break ;; | |
'') | |
echo "Syntax: raptor [-lneEp etc] 'code' | |
The code can make use of: | |
DD() to Data::Dumper::Dumper() a thing, D() to say() it | |
YY() to YAML::Dump() a thing, Y() to say() it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" split edit the source file for the Perl module under the current WORD | |
nnoremap ,m :execute 'spl `perldoc -l ' . expand("<cWORD>") . '`'<CR> | |
nnoremap ,M :execute 'vspl `perldoc -l ' . expand("<cWORD>") . '`'<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dancing on the cloud | |
okram@BLUEDESK ~> sudo aptitude install python-setuptools | |
[...] | |
okram@BLUEDESK ~> sudo easy_install dotcloud | |
[...] | |
okram@BLUEDESK ~> dotcloud | |
Warning: /home/okram/.dotcloud/dotcloud.conf does not exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scripts/capsule.sh | |
if [ -f 'dist.ini' ]; then | |
echo "Found dist.ini, using Dist::Zilla" | |
#dzil authordeps | cpanm | |
#cpanm --installdeps . | |
echo "Installing author deps" >> $logfile | |
dzil authordeps | cpanm >> $logfile 2>&1 | |
echo "Installing dist deps" >> $logfile | |
dzil listdeps | cpanm >> $logfile 2>&1 |