Skip to content

Instantly share code, notes, and snippets.

@masaki
masaki / webapp.psgi
Created Jan 28, 2012
Jenkins WebHook Receiver (w/ Jenkins Notification Plugin's JSON)
View webapp.psgi
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Request;
use HTTP::Status qw(:constants status_message);
use JSON qw(from_json);
use LWP::UserAgent;
sub to_psgi_res {
@masaki
masaki / python-urllib-noproxy.patch
Created May 21, 2009
yum enable NO_PROXY (proxy=_none_)
View python-urllib-noproxy.patch
diff --git a/urllib.py b/urllib.py
index 802d9b7..d13ddb7 100644
--- a/urllib.py
+++ b/urllib.py
@@ -35,7 +35,7 @@ __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve",
"localhost", "thishost", "ftperrors", "basejoin", "unwrap",
"splittype", "splithost", "splituser", "splitpasswd", "splitport",
"splitnport", "splitquery", "splitattr", "splitvalue",
- "splitgophertype", "getproxies"]
+ "splitgophertype", "getproxies", "getnoproxies"]
View ios_ranking_to_slack.pl
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use LWP::UserAgent;
use JSON;
use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
use Pod::Usage qw(pod2usage);
@masaki
masaki / 1min_radar.patch
Created Jun 28, 2016
CloudForecast 1min graph and configurable radar interval
View 1min_radar.patch
diff --git a/lib/CloudForecast/Data.pm b/lib/CloudForecast/Data.pm
index 78c9f73..9c2983a 100644
--- a/lib/CloudForecast/Data.pm
+++ b/lib/CloudForecast/Data.pm
@@ -647,6 +647,8 @@ sub init_rrd {
}
}
+ my $interval = $self->global_config->{interval} || 300;
+
@masaki
masaki / setup_perl.sh
Last active Jan 4, 2016
setup languages
View setup_perl.sh
#!/bin/bash
[ -e "$HOME/.plenv" ] && rm -rf $HOME/.plenv
git clone git@github.com:tokuhirom/plenv.git $HOME/.plenv
echo '[ -d "$HOME/.plenv/bin" ] && [ `echo $PATH | grep "$HOME/.plenv/bin"` ] || export PATH="$HOME/.plenv/bin:$PATH"' >> $HOME/.zshrc
echo 'if which plenv > /dev/null; then eval "$(plenv init -)"; fi' >>$HOME/.zshrc
mkdir -p $HOME/.plenv/plugins
git clone git@github.com:tokuhirom/Perl-Build.git $HOME/.plenv/plugins/perl-build
View gist:5395424
Can't convert 'Module::CPANfile::Requirement=HASH(0x96855c8)': Invalid version format (non-numeric data)
! Couldn't find module or a distribution Amon2::Lite~Module::CPANfile::Requirement=HASH(0x8f3a910) ()
View perlqahack2013.md
  • carton install -f /path/to/cpanfile
  • enable to specify "carton bundle" cache path
  • move 02packages from .cpan/ to cache path
  • enable "via" in cpanfile
requires 'carton',
    via => 'git://github.com/masaki/carton.git',
    commitish => 'devel';
View 01_simple.pl
use OAuth::Lite::Consumer;
use Furl 2.08;
my $oauth = OAuth::Lite::Consumer->new(
ua => Furl->new(keep_request => 1),
);
my %args = (
method => 'POST',
url => 'http://example.com/oauth',
View gist:5071145
$ find local/lib/perl5 -name "README.pod"
local/lib/perl5/App/README.pod
local/lib/perl5/LWP/UserAgent/DNS/README.pod
local/lib/perl5/Test/Deep/README.pod
local/lib/perl5/Test/Fake/README.pod
View gist:4128761

TODO

  • (/) suite hooks
    • before(:suite)
    • after(:suite)
  • (/) skip some conditions
    • xit
    • it 'SPECIFICATION ONLY'
  • tagged example
  • it 'SPEC' => { ENV_FOO => 1 } => sub { ... };