Skip to content

Instantly share code, notes, and snippets.

@miyagawa
miyagawa / README.md
Last active March 2, 2020 21:03
Gumroad Sales widget for dashing.

Displays last 30 day sales for Gumroad on Dashing. Doesn't use API since the data doesn't appear to be provided.

Screenshot

Configuration

Set GUMROAD_USERNAME qnd GUMROAD_PASSWORD enviroment variable.

#!/usr/bin/perl
# Usage: upgrade-cpan.pl 5.14.0 | sort -u > /tmp/modules.txt
use strict;
use File::Find::Rule;
use JSON;
my $old = shift;
my @files = File::Find::Rule->file->name('install.json')->in("$ENV{HOME}/perl5/perlbrew/perls/perl-$old/lib/site_perl/$old");
for my $file (@files) {
@miyagawa
miyagawa / so-net-xmltv.rb
Created October 29, 2019 06:41
so-net XMLTV exporter
#!/usr/bin/env ruby
# coding: utf-8
require 'date'
require 'open-uri'
require 'nokogiri'
class Station
attr_accessor :id, :name, :channel
def xmltv_id
#!/usr/bin/perl
use strict;
use warnings;
use DirHandle;
use JSON::XS;
use LWP::UserAgent;
use Carp;
use CPAN::Inject;
use CPAN ();
use URI;
#!/usr/bin/env ruby
file = File.open("index.html", "r:iso-2022-jp:UTF-8")
content = file.read
all_html = <<HTML
<html>
<head>
<meta http-requiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Author" content="Aoki Minero">
cpanm (App::cpanminus) 1.0012 on perl 5.013004 built for darwin-2level
Work directory is /Users/miyagawa/.cpanm/work/1283042554.55029
You have make /usr/bin/make
You have LWP 5.836
You have /usr/bin/tar: bsdtar 2.6.2 - libarchive 2.6.2
You have /usr/bin/unzip
Searching DBI on cpanmetadb ...
Fetching http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.613.tar.gz
-> OK
Unpacking DBI-1.613.tar.gz
cpanm (App::cpanminus) 0.9922 on perl 5.010001 built for darwin-2level
Work directory is /Users/miyagawa/.cpanm/work/1269147257.56149
! Found plugin /Users/miyagawa/.cpanm/plugins/bundle but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/changes but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/cpanfresh but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/dzil but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/fast_syncing_mirrors but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/github but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/gitpan but PERL_CPANM_DEV is not set. Skipping.
! Found plugin /Users/miyagawa/.cpanm/plugins/growl but PERL_CPANM_DEV is not set. Skipping.
@miyagawa
miyagawa / gist:2657512
Created May 11, 2012 04:22
untar perl 5.16.0-RC0
> ls -l perl-5.16.0-RC0.tar.bz2
-rw-r--r-- 1 miyagawa staff 9756346 May 11 05:41 perl-5.16.0-RC0.tar.bz2
> shasum perl-5.16.0-RC0.tar.bz2
5cb530735dca0d180e5ea9fbbee99197bd7cccb0 perl-5.16.0-RC0.tar.bz2
> tar --version
bsdtar 2.8.3 - libarchive 2.8.3
> tar xjvf perl-5.16.0-RC0.tar.bz2
x perl-5.16.0-RC0/
x perl-5.16.0-RC0/Artistic
x perl-5.16.0-RC0/AUTHORS
@miyagawa
miyagawa / gist:349583
Created March 30, 2010 20:53
OS X Snow Leopard vendor modules
/System/Library/Perl/Extras/5.10.0/Algorithm/Annotate.pm
/System/Library/Perl/Extras/5.10.0/Algorithm/Diff.pm
/System/Library/Perl/Extras/5.10.0/Algorithm/DiffOld.pm
/System/Library/Perl/Extras/5.10.0/App/CLI/Command/Help.pm
/System/Library/Perl/Extras/5.10.0/App/CLI/Command.pm
/System/Library/Perl/Extras/5.10.0/App/CLI.pm
/System/Library/Perl/Extras/5.10.0/Archive/Zip/Archive.pm
/System/Library/Perl/Extras/5.10.0/Archive/Zip/BufferedFileHandle.pm
/System/Library/Perl/Extras/5.10.0/Archive/Zip/DirectoryMember.pm
/System/Library/Perl/Extras/5.10.0/Archive/Zip/FileMember.pm
@miyagawa
miyagawa / buildable-git-repo.md
Last active April 17, 2019 14:48
Buildable git repo for CPAN

Buildable, Testable, Installable Git repo for Perl modules

tl;dr We might need a standard build file to build a module from Git repository, especially for the ones using Module::Install or dzil.

The problem

When an author of CPAN module uses an authoring tool that generates build files when shipping them to CPAN, the git repository usually doesn't have enough files to build, test and install the module.

For example, if dzil (Dist::Zilla) is used, the repository only conatains dist.ini and there's no Makefile.PL or Build.PL so standard CPAN installers or Continuous Integration tools don't know how to run tests on it.