This file contains hidden or 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 5.024; | |
| use strict; | |
| use warnings; | |
| use Pod::Usage qw(pod2usage); | |
| if ("@ARGV" =~ /--help/) { | |
| pod2usage(-exitstatus => 0, -verbose => 1); | |
| } |
This file contains hidden or 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
| FROM perl:5.32-slim-buster | |
| RUN cpanm -nq Mojolicious | |
| COPY app.pl / | |
| CMD ["/usr/local/bin/perl", "/app.pl", "daemon", "-l", "http://*:8080"] |
This file contains hidden or 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 Mojolicious::Lite; | |
| package Model::FileWatch { | |
| use Mojo::Base 'Mojo::EventEmitter'; | |
| use Mojo::Promise; | |
| use IO::File; | |
| has 'file'; |
This file contains hidden or 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 | |
| # Perl 5 version of https://gist.github.com/benjchristensen/4671081 | |
| # Using IO::Async and Future | |
| use strict; | |
| use warnings; | |
| use feature 'say'; | |
| use curry; | |
| use Future; | |
| use IO::Async::Function; |
This file contains hidden or 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 Mojo::Base -strict; | |
| use Mojo::JSON qw(encode_json); | |
| use Mojo::UserAgent; | |
| use Mojo::Util qw(md5_sum steady_time); | |
| my $ua = Mojo::UserAgent->new->tap( sub { | |
| shift->transactor->add_generator( | |
| jsonrpc => sub { | |
| my ( $t, $tx, $method, $params ) = @_; |
This file contains hidden or 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
| [zakame@yorozuya:~] 130 % reply -Mversion | |
| 0> version->parse('0.2')->normal | |
| $res[0] = 'v0.200.0' | |
| 1> version->parse('0.2.1')->normal | |
| $res[1] = 'v0.2.1' | |
| 2> version->parse('v0.2')->normal | |
| $res[2] = 'v0.2.0' |
This file contains hidden or 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 warnings; | |
| use strict; | |
| use Benchmark qw(:all); | |
| use Text::CSV_XS; | |
| # file with 1_000_000 entries of 'test|N,xxxN|noob' where N = number | |
| my $file = '/tmp/test.txt'; |
This file contains hidden or 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
| .carton | |
| local |
This file contains hidden or 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
| ;; If perlbrew is used, get PERLBREW_PATH to be used in exec-path and PATH | |
| ;; Adapted from https://gist.github.com/960214 | |
| (require 'cl) | |
| (let ((perlbrew-init "~/.perlbrew/init")) | |
| (if (file-readable-p perlbrew-init) | |
| (dolist (line (with-temp-buffer | |
| (insert-file-contents perlbrew-init) | |
| (split-string (buffer-string) "\n" t))) | |
| (with-temp-buffer | |
| (insert line) |
This file contains hidden or 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 Mojolicious::Lite; | |
| plugin 'OAuth2', | |
| google => { | |
| key => $ENV{GOOGLE_OAUTH2_CLIENT_ID}, | |
| secret => $ENV{GOOGLE_OAUTH2_CLIENT_SECRET}, | |
| }; | |
| my $service = 'https://www.googleapis.com'; |
NewerOlder