Skip to content

Instantly share code, notes, and snippets.

@masaki
masaki / webapp.psgi
Created January 28, 2012 16:59
Jenkins WebHook Receiver (w/ Jenkins Notification Plugin's JSON)
#!/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 12:31
yum enable NO_PROXY (proxy=_none_)
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"]
#!/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 June 28, 2016 09:20
CloudForecast 1min graph and configurable radar interval
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 January 4, 2016 18:59
setup languages
#!/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
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) ()
  • 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';
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',
$ 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
@masaki
masaki / gist:4128761
Created November 22, 2012 00:51
Test::Ika

TODO

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