Skip to content

Instantly share code, notes, and snippets.

@sironekotoro
sironekotoro / gist:4f3194d6a983f1840e2f263c5a5c8cc8
Last active Oct 15, 2020
Net::Google::Spreadsheets::V4 からGoogle Sheet 更新
View gist:4f3194d6a983f1840e2f263c5a5c8cc8
#!/usr/bin/env perl
use strict;
use warnings;
# https://twitter.com/sironekotoro/status/1316671830745214978?s=20
use utf8;
use Net::Google::Spreadsheets::V4;
my $CLIENT_ID = "";
View lastBusinessDay.gas.js
// https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html
const holidays = [
"2020/8/10",
"2020/9/21",
"2020/9/22",
"2020/11/3",
"2020/11/23",
"2020/12/29", // 従業員就業規則 第二十条 (4) 年末年始(12月29日〜1月3日)
"2020/12/30", // 同上
"2020/12/31", // 同上
View rectangle-ball.pl
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw/say/;
use Data::Dumper;
# @xtetsujiさんからの出題
# https://twitter.com/xtetsuji/status/1287259431822962689?s=20
# usege
@sironekotoro
sironekotoro / perl_entrance_rpg.pl
Created May 31, 2020
RPGの戦闘的な何か
View perl_entrance_rpg.pl
#!/usr/bin/env perl
use strict;
use warnings;
# TODO: 素早さでターンを決められるようにする
# TODO: どっちかのHPがなくなるまでやる
my $fighter = {HP => 10, ATK => 2};
my $ork = {HP => 15, ATK => 1};
View permutations.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Algorithm::Combinatorics qw/permutations/;
# これは順列を使った「数え上げ」の問題だ!
# https://twitter.com/keisei_otsuka/status/1223841916405440512
my $iter = permutations( [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] );
@sironekotoro
sironekotoro / Standard_2018_3column.html
Last active Jan 13, 2020
Seesaaブログの記事ページに、その記事自身のリンクを追加する
View Standard_2018_3column.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><% if:page_name eq 'search' -%><% keyword -%>: <% /if -%><% if:page_name eq 'archives' -%><% extra_title_datetime | date_format("%Y年%m月") -%>: <% else -%><% if:extra_title -%><% extra_title | remove_emoji -%>: <% /if -%><% /if -%><% if:current_page > 1 -%>(<% current_page -%>) <% /if -%><% blog.title -%></title>
<meta name="description" content="<% if:extra_title -%><% extra_title | nl2br | tag_strip | remove_emoji -%>,<% /if -%><% blog.description | nl2br | tag_strip | remove_emoji -%>" />
<meta name="keywords" content="<% blog.keywords | oneline | tag_strip -%><% if:extra_keywords %>,<% extra_keywords | oneline | tag_strip -%><% /if %>" />
<link rel="stylesheet" href="<% site_view.page_url_css -%>" />
<link rel="stylesheet" href="<% site_info.blog_url -%>/css/user-common.css" />
<link rel="alternate" href="<% blog.page_url -%>index.rdf" type="application/rss+xml" title="RSS" />
View triple_match.pl
use strict;
use warnings;
my $charA = 'A';
my $charB = 'B';
my $charC = 'C';
if ( $charA =~ 'A' && $charB =~ 'B' && $charC =~ 'C' ) {
print "match\n";
}
@sironekotoro
sironekotoro / nk225_list.pl
Created Dec 18, 2019
日経225構成銘柄の証券コードを取得する
View nk225_list.pl
use strict;
use warnings;
use HTTP::Tiny;
my $URL = 'https://indexes.nikkei.co.jp/nkave/index/component?idx=nk225';
my $response = HTTP::Tiny->new->get($URL);
die "Failed!\n" unless $response->{success};
@sironekotoro
sironekotoro / connpass_vue_simple3.pl
Created Dec 18, 2019
connpassのAPIをVueで叩いてmojoliciousで表示させる
View connpass_vue_simple3.pl
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $c = shift;
$c->render(template => 'index');
};
app->start;
__DATA__
@sironekotoro
sironekotoro / build.log
Created Dec 15, 2019
Installing App::revealup failed.
View build.log
cpanm (App::cpanminus) 1.7044 on perl 5.030001 built for darwin-2level
Work directory is /Users/sironekotoro/.cpanm/work/1576382898.42012
You have make /usr/bin/make
You have /usr/bin/curl
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
Searching App::revealup () on cpanmetadb ...
--> Working on App::revealup
Fetching http://www.cpan.org/authors/id/Y/YU/YUSUKEBE/App-revealup-0.21.tar.gz
-> OK
You can’t perform that action at this time.