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 openjdk:12-jdk AS base | |
ENV SDKMAN_DIR=/usr/local/sdkman | |
WORKDIR /myapp | |
RUN set -x \ | |
&& yum update -y \ | |
&& yum install -y ca-certificates curl zip unzip sed binutils which \ | |
&& curl -fsSL https://get.sdkman.io | bash \ |
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
#!/bin/bash | |
set -euo pipefail | |
function info() | |
{ | |
echo "[INFO] $@" | |
} | |
function warn() |
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
__scoop_command_completion() | |
{ | |
local candidates_ | |
compword_="${COMP_WORDS[${COMP_CWORD}]}" | |
candidates_=$(scoop help | sed -r -e '/^$/d' -e '/.*(Usage|Some useful|to get help).*/d' | awk '{print $1}' | tr '\n' ' ') | |
COMPREPLY=($(compgen -W "${candidates_}" -- "${compword_}")) | |
} | |
complete -o default -o nospace -F __scoop_command_completion scoop |
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
#!/bin/bash | |
# | |
# download_new_file__ | |
# require date, stat, curl or http | |
# | |
download_new_file__() | |
{ | |
local src=$1 | |
local dst=$2 | |
if [[ -e ${dst} ]]; then |
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
# ex: ts=4 sw=4 et filetype=sh | |
__hostname_completion() | |
{ | |
local ssh_config_ compword_ hosts_ | |
if [[ -e "${HOME}/.ssh/config" ]]; then | |
ssh_config_="${HOME}/.ssh/config" | |
elif [[ -e "/etc/ssh/ssh_config" ]]; then | |
ssh_config_="/etc/ssh/ssh_config" | |
else |
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
## Confirm EnableSMB2Protocol, for mount host folder | |
Set-SmbServerConfiguration -EnableSMB1Protocol $False -EnableSMB2Protocol $True | |
Get-SmbServerConfiguration | Select-Object -Property EnableSMB1Protocol,EnableSMB2Protocol | |
# | |
# EnableSMB1Protocol EnableSMB2Protocol | |
# ------------------ ------------------ | |
# False True | |
# |
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
# 既存のネットワークアダプタとインターネット接続を共有して外部ネットワークに接続できる仮想スイッチ | |
New-VMSwitch -Name External -SwitchType External -NetAdapterName "Wi-Fi" | |
# NAT ネットワークを構成する仮想スイッチ | |
New-VMSwitch -Name NAT -SwitchType Internal | |
$ifIndex = (Get-NetAdapter -Name "vEthernet (Nat)").ifIndex | |
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex $ifIndex | |
New-NetNat -Name NAT -InternalIPInterfaceAddressPrefix 192.168.0.0/24 | |
# NAT ネットワークを削除 |
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
# usage | |
# add prefix "library" to public image | |
# ditl library/openjdk | |
# | |
# don't add prefix "library" to common image | |
# ditl adoptopenjdk/openjdk11 | |
# | |
ditl() { | |
local name=$1 | |
local next_url="https://registry.hub.docker.com/v2/repositories/${name}/tags/?page=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
import java.util.stream.Stream; | |
public class Demo { | |
public static void main(String[] args) { | |
User user = new User("Bob"); | |
System.out.printf("user is %s\n", user.getName()); | |
Stream.of(Role.values()).forEach(role -> { | |
user.setRole(role); | |
System.out.printf("\tas %s\n", role.name()); | |
Stream.of(Item.values()).forEach(choise -> { |
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
// https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.6 | |
public class Fruit { | |
public static void main(String[] args) { | |
System.out.println(Apple.values()); | |
} | |
} | |
enum Apple { | |
FUJI, | |
PIPPIN, |