Skip to content

Instantly share code, notes, and snippets.

View ap's full-sized avatar

Aristotle Pagaltzis ap

View GitHub Profile
@ap
ap / gitize.pl
Last active December 28, 2015 21:19
ribasushi’s gitize
#!/usr/bin/env perl
use warnings;
use strict;
use Git::Raw ();
use Archive::Peek::Libarchive ();
use Getopt::Std 'getopts';
getopts 'd:', \my %opt;
my $git = Git::Raw::Repository->open( $opt{'d'} // die 'need git directory, specify using -d' );
@ap
ap / 13230445-rejection.pdf
Last active December 20, 2015 03:59
US 20130063492 A1 — non-final rejection — 4-11-2013
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ap
ap / gist:5695633
Last active December 18, 2015 00:19

Now posted: http://blogs.perl.org/users/aristotle/2013/06/toolchain-decade.html

IRC conversation about the original draft:

[03:22:37] <aristotle> I just wrote https://gist.github.com/ap/5695633 and I’d be grateful for any corrections and critique before I post it
[03:22:39] <+dipsy> [ gist:5695633 ] 
[03:23:20] <aristotle> (a brief summary of the last decade in CPAN installers and authoring tools)
[03:28:09] <aristotle> in particular I don’t want to post nonsense if my outside-looking-in perspective on M::B’s architecture is grossly wrong
[04:45:06] <jberger> aristotle, seems about right
[04:45:51]  I can say, I have used the extensibility to build Alien::Base but its certainly the exception rather than the rule in the M::B world
@ap
ap / gist:2919035
Created June 12, 2012 17:58
List CPAN distributions of an author that have Debian packages
#!/usr/bin/env perl
use 5.014;
use strict;
use warnings;
use HTTP::Tiny ();
use JSON 'decode_json';
sub get_dists_for_author {
my ( $author ) = @_;
my $url = sprintf 'http://api.metacpan.org/v0/release/_search?q=author:%s+AND+status:latest;fields=name;size=200', $author;
@ap
ap / app.psgi
Created July 4, 2011 19:34
Missing Plack body filter feature?
#!perl
use Plack::Builder;
builder {
enable sub {
my $app = shift;
sub {
my $env = shift;
Plack::Util::response_cb( $app->( $env ), sub {
my @out = ( 'a' .. 'z' );
sub { shift @out }
@ap
ap / I18N_STEFFENW.en.pod
Last active January 13, 2023 11:35
Selecting an Internationalization Framework (GPW10)

Selecting an Internationalization Framework

Author

Steffen Winkler perl-ws@steffen-winkler.de

Bio

@ap
ap / README.md
Last active September 24, 2015 08:27
By request: my current .bashrc
@ap
ap / gist:624446
Created October 13, 2010 17:00
Git goodies: a grab bag
# you need this
alias gg='git grep -E'
# highlighted diff goodness is not just for git repos any more
alias diff='git diff --no-index'
# qf=quickfix
git config --global alias.qf 'commit --amend -C HEAD'
# Git Is My Refactoring IDE: edit all files that contain a particular pattern
@ap
ap / sudowrite.vim
Created October 12, 2010 20:58
:Sudo command that saves files using sudo(1)
" defines a :Sudo command that works largely like :w
" but uses `sudo` to the file using root permissions
function! SudoWrite(file,line1,line2)
" intercept the external file change reload prompt event
autocmd FileChangedShell <buffer> :
" shazzam
exe 'silent' a:line1 . ',' . a:line2 . 'write !sudo tee 1>/dev/null' strlen(a:file) ? a:file : '%'
" force-trigger vim's file modification check, then undo the intercept
checktime | autocmd! FileChangedShell <buffer>
use List::Util 'reduce';
sub pascal {
my ( $x, @p, @q ) = shift;
push @p, reduce { push @p, $a + $b; $b } 1, @q = @p, @p = () for 1 .. $x - 1;
1, @p;
}