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 | |
package No::Headers; | |
use Mojo::Base "Mojo::Headers"; | |
sub to_string { "" }; | |
package main; | |
use Mojolicious::Lite; | |
get "/" => sub { | |
my $c = shift; |
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
git remote update | |
git rebase origin/master | |
# no diff | |
git tag v5.17 | |
perl Makefile.PL; make manifest; make dist | |
1) make sure master is in a good state | |
2) tag release | |
3) perl Makefile.PL; make manifest; make dist | |
4) upload release, ...optional... |
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
plugin 'OAuth2', { | |
google => { | |
key => 'public app id from google', | |
secret => 'private secret from google', | |
}, | |
}; |
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
# See also | |
# http://www.perlmonks.org/bare/?node_id=881003 | |
# http://www.freebsd.org/cgi/man.cgi?query=getpeereid | |
use strict; | |
use warnings; | |
use IO::Socket::UNIX; | |
use Socket qw( SO_PEERCRED SOL_SOCKET ); | |
if (@ARGV) { | |
IO::Socket::UNIX->new(Peer => $ARGV[0], Type => SOCK_STREAM, Timeout => 10) or die $@; |
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
package Mojo::IOLoop::Tail; | |
use Mojo::Base "Mojo::IOLoop::Stream"; | |
has check_timeout => 0.01; | |
sub close { | |
my $self = shift; | |
return unless my $handle = $self->{handle}; | |
seek $handle, 0, 1; |
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 | |
# Usage: echo -en "1.1.0.1\n127.0.0.1\n" | sudo /usr/bin/perl stdinping | |
# A lot of this code is mostly copy/paste/modify from Net::Ping | |
BEGIN { | |
# Make sure we don't load code that is not owned by root | |
$^X eq "/usr/bin/perl" or die "Invalid perl: $^X\n"; | |
my @perl_stat = stat $^X; | |
unshift @INC, sub { | |
my ($code, $module) = @_; |
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
package SugarTree; | |
=head1 NAME | |
SugarTree - Create datastructures with sugar | |
=head1 SYNOPSIS | |
use SugarTree; |
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; | |
sub foo { | |
my $res = ''; | |
warn "foo(): @_"; | |
(sub { |
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
use IO::Socket::INET; use File::Basename; use File::Path; BEGIN { | |
our $SOURCE = $ENV{'AUTO_INSTALL_DEPS_SOURCE'} || 'http://api.metacpan.org:80/source/%s'; | |
our $LIB = "$ENV{'HOME'}/.perl5"; | |
push @INC, $LIB, sub { | |
my($module) = $_[1] =~ /(.*)\.pm$/; $module =~ s!/!::!g; | |
my($hostname) = $SOURCE =~ m!//([^/]+)!; | |
my $s = IO::Socket::INET->new(PeerAddr => $hostname) or die "Cannot download required library from $hostname: $@"; | |
File::Path::make_path(dirname "$LIB/$_[1]"); | |
open my $FH, '+>', "$LIB/$_[1]" or die "Write $LIB/$_[1]: $!"; | |
printf STDERR "GET $SOURCE HTTP/1.1\n", $module if $ENV{'AUTO_INSTALL_DEPS_DEBUG'}; |
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 | |
BACKUP=$GIT_DIR; # need to be first? | |
GIT_DIR="path/to/my/repo/.git"; | |
while read oldrev newrev refname; do | |
BRANCH=$(echo $refname | cut -f3 -d/); | |
echo branch $BRANCH | |
if [ "x$BRANCH" = "xalien" ]; then | |
cd $GIT_DIR; |
OlderNewer