Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start the sshd service
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
curl https://raw.githubusercontent.com/oalders/presentations/main/slides/6-perlimports/remark.html -o perlimports.html && open perlimports.html
「Where Did That Symbol Come From?」とトークタイトルが示す通り、Perlのシンボルがどこからimportされたかを明確にしたいというのが実装の動機になっているようです。合わせて動き自体はgolangでimportしているモジュールをいい感じに管理してくれるgoimportsを参考にしているようです。
#!/usr/bin/env perluse strict;
use warnings;
print"hello";
use Hoge;
❯ perl hoge.pl
Can't locate Hoge.pm in @INC (you may need to install the Hoge module) (@INC contains: /Users/anatofuz/.plenv/versions/5.32.0/lib/perl5/site_perl/5.32.0/darwin-2level /Users/anatofuz/.plenv/versions/5.32.0/lib/perl5/site_perl/5.32.0 /Users/anatofuz/.plenv/versions/5.32.0/lib/perl5/5.32.0/darwin-2level /Users/anatofuz/.plenv/versions/5.32.0/lib/perl5/5.32.0) at hoge.pl line 2.BEGIN failed--compilation aborted at hoge.pl line 2.
package Hoge::First;
use strict;
use warnings;
use featureqw/say/;
use Exporter 'import';
our@EXPORT = (qw/hoge/); #サブルーチンの名前を文字列で配列の中にいれるとEXPORTされるsub hoge {
say'this is first!';
}
1;
package Hoge::First;
use strict;
use warnings;
use featureqw/say/;
use Exporter 'import';
our@EXPORT = (qw/hoge/);
sub hoge {
say'this is first!';
}
1;
package Hoge::Second;
use strict;
use warnings;
use featureqw/say/;
use Exporter 'import';
our@EXPORT = (qw/hoge/);
sub hoge {
say'this is second!';
}
1;
#!/usr/bin/env perl# main.pluse strict;
use warnings;
use Hoge::First;
use Hoge::Second;
hoge();
❯ perl -Ilib hoge.pl
f1
Undefined subroutine &main::f2 called at hoge.pl line 10.
これをApp::perlimportsに通すと、以下のようにコードが書き換わります。
❯ perlimports --libs lib hoge.pl
use strict;
use warnings;
use MyPkg::One qw( f1 );
use MyPkg::Two qw( f2 );
use MyPkg::Three ();
use MyPkg::Four ();
f1();
f2();
MyPkg::Three->f3();
❯ perlimports --libs lib --no-preserve-unused hoge.pl
use strict;
use warnings;
use MyPkg::One qw( f1 );
use MyPkg::Two qw( f2 );
use MyPkg::Three ();
f1();
f2();
MyPkg::Three->f3();
❯ cat hoge.pl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
use DDP {deparse =>1, hash_max =>0};
f1();
~/workspace/test3 via 🐪 v5.34.0
❯ perlimports --libs lib -f hoge.pl
use strict;
use warnings;
use FindBin ();
use lib "$FindBin::Bin/lib";
use DDP {deparse =>1, hash_max =>0};
f1();
❯ cat hoge.pl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
use DDP {deparse =>1, hash_max =>0};
use Class::Accessor::Lite (
rw => [qw/ hoge/],
);
f1();
~/workspace/test3 via 🐪 v5.34.0
❯ perlimports --libs lib,local/lib/perl5 -f hoge.pl
use strict;
use warnings;
use FindBin ();
use lib "$FindBin::Bin/lib";
use DDP {deparse =>1, hash_max =>0};
use Class::Accessor::Lite ();
f1();
~/workspace/test3 via 🐪 v5.34.0
❯ cat hoge.pl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
use DDP {deparse =>1, hash_max =>0};
use Class::Accessor::Lite (
rw => [qw/ hoge/],
);
f1();
~/workspace/test3 via 🐪 v5.34.0
❯ perlimports --libs lib,local/lib/perl5 --ignore-modules-pattern '^Class::' -f hoge.pl
use strict;
use warnings;
use FindBin ();
use lib "$FindBin::Bin/lib";
use DDP {deparse =>1, hash_max =>0};
use Class::Accessor::Lite (
rw => [qw/ hoge/],
);
f1();
$ docker compose
Usage: docker compose [OPTIONS] COMMAND
Docker Compose
Options:
--ansi string Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
--compatibility Run compose in backward compatibility mode
--env-file string Specify an alternate environment file.
-f, --file stringArray Compose configuration files
--profile stringArray Specify a profile to enable
--project-directory string Specify an alternate working directory
(default: the path of the Compose file)
-p, --project-name string Project name
Commands:
build Build or rebuild services
convert Converts the compose file to platform's canonical format cp Copy files/folders between a service container and the local filesystem
❯ gnuplot
G N U P L O T
Version 5.4 patchlevel 2 last modified 2021-06-01
Copyright (C) 1986-1993, 1998, 2004, 2007-2021
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type"help FAQ"
immediate help: type"help" (plot window: hit 'h')
Terminal type is now 'qt'
gnuplot>set term svg
Terminal type is now 'svg'
Options are 'size 600,480 fixed enhanced font 'Arial,12' butt dashlength 1.0 '
gnuplot>set output 'out.svg'
gnuplot>set xdata time
gnuplot>set timefmt '%Y/%m/%d'
gnuplot> plot '<perl note.pl' using 1:2 with line
gnuplot>exit