This file contains 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
#!/bin/bash | |
set -eu | |
browser=open | |
default_gw=$( route -n get 0.0.0.0 | grep gateway | sed -e 's/.*: //' ) | |
if [ "_${1:-}" = "_-w" ] ; then | |
"$browser" "http://$default_gw/" | |
fi |
This file contains 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
2^2 + 10^2 + 32^2 = 1128 | |
2^2 + 32^2 + 10^2 = 1128 | |
10^2 + 2^2 + 32^2 = 1128 | |
10^2 + 32^2 + 2^2 = 1128 | |
14^2 + 16^2 + 26^2 = 1128 | |
14^2 + 26^2 + 16^2 = 1128 | |
16^2 + 14^2 + 26^2 = 1128 | |
16^2 + 26^2 + 14^2 = 1128 | |
26^2 + 14^2 + 16^2 = 1128 | |
26^2 + 16^2 + 14^2 = 1128 |
This file contains 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 strict; | |
use warnings; | |
my $check_mail_domain = shift; | |
if ( !$check_mail_domain || $check_mail_domain =~ / / ) { | |
die "1st argument is required as mail domain\n"; | |
} |
This file contains 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/osascript -l JavaScript | |
function run(argv) { | |
const music = Application("Music"); | |
for ( const file of argv ) { | |
console.log(`add: "${file}"`); | |
music.add(file); | |
} | |
} |
This file contains 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
function ordinally_replace_sample() { | |
const content = getContent(); | |
let replaced = content; | |
replaced = replaced.replace(/&/g, "&"); | |
replaced = replaced.replace(/</g, "<"); | |
replaced = replaced.replace(/>/g, ">"); | |
replaced = replaced.replace(/"/g, """); | |
replaced = replaced.replace(/'/g, "'"); | |
console.log("ordinally: " + replaced); | |
} |
This file contains 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 | |
# urlopen - open (macOS) URL from STDIN | |
# SYNOPSIS: | |
# tail url_include_log | urlopen | |
# stdout-url-command | urlopen | |
# OPTIONS: | |
# urlopen [--pass-through|-p] : pass through STDOUT (default off) | |
# urlopen [--verbose|-v] : outout opend URL (default off) | |
use v5.12; | |
use Getopt::Long qw(:config posix_default no_ignore_case bundling auto_help); |
This file contains 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 v5.14; | |
use constant MAX_NEWTON_ITERATION_COUNT => 8; | |
print "平方根をニュートン法で求めます\n"; | |
print "1より大きい自然数を入れて下さい: "; | |
my $input = <STDIN>; | |
chomp $input; | |
if ( !$input || $input <= 1 ) { | |
die "1より大きい自然数ではありませんでした\n"; |
This file contains 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 strict; | |
use warnings; | |
use Data::Dumper; | |
my $header_string = <<'END_HEADER'; | |
Delivered-To: [email protected] | |
Received: by 2002:ff68:12bc:0:0:0:0:0 with SMTP id 2f8a1000492ce44c1b7c; | |
Fri, 8 Nov 2019 15:07:34 -0800 (PST) | |
X-Received: by 2002:a63:6581:: with SMTP id c451320e8476820844296b80587f9f3a; |
This file contains 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
$ perl -e 'for my $digit (0x00..0xff) { my $byte = chr $digit; my $match = $byte =~ /^\s$/; printf "0x%x\t%s\n", $digit, $match ? "match" : "-"; }' | |
0x00 - | |
0x01 - | |
0x02 - | |
0x03 - | |
0x04 - | |
0x05 - | |
0x06 - | |
0x07 - | |
0x08 - |
This file contains 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 strict; | |
use warnings; | |
my $str = "A " x 100; | |
my $i = 1; | |
$str =~ s/A/ $i++ /eg; | |
print "$str\n"; |