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.io.IOException; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.List; | |
import static java.util.stream.Collectors.toList; |
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 org.junit.Test; | |
import org.springframework.expression.Expression; | |
import org.springframework.expression.ExpressionParser; | |
import org.springframework.expression.common.TemplateParserContext; | |
import org.springframework.expression.spel.standard.SpelExpressionParser; | |
import org.springframework.expression.spel.support.StandardEvaluationContext; | |
import java.util.HashMap; | |
import java.util.Map; |
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 | |
# 「ファイル名の先頭が8ケタの数値」の名前のファイルに | |
# 数値とその次の文字の間にアンダーバーを挟んだ名前にリネームするスクリプト。 | |
for i in $(ls | grep '^[0-9]\{8\}') ; do | |
newname=`echo $i | sed -e 's/^\([0-9]\{8\}\)/\1_/g'` | |
mv ${i} ${newname} | |
done |
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
# フォルダ容量チェッカー。 | |
# | |
# フォルダの上限と容量を指定すると、 | |
# 直下のフォルダがその容量を超えていた場合に、 | |
# 警告ファイル(warning.log)を出力する。 | |
# | |
# ex. folderLimitChecker.ps1 C:work 1000000 | |
# | |
Param( $targetFolder, $maxSize ) |
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
def target = this.args[0] | |
/** | |
* ASCII(&ある種決まった記号)のみで構成されているかを真偽値で返す。 | |
*/ | |
def isAsciiOnly(text) { | |
def valids = ['-', '_'] | |
for (c in text.split('')) { | |
if (((int) c) > 127 && !valids.contains(c)) return false | |
} |
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 org.junit.Test; | |
import static org.hamcrest.CoreMatchers.is; | |
import static org.junit.Assert.assertThat; | |
public class SurrogatePairsTest { | |
@Test | |
public void 文字コード指定でサロゲートペア文字列を作成する() { | |
char[] surrogatePairChars = new char[]{0xd867, 0xde3d}; // サカナ偏に花 |
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 javax.net.ssl.HttpsURLConnection | |
import java.net.URLEncoder | |
def getToken(key) { | |
def authenticationUrl = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken" | |
def conn = new URL(authenticationUrl).openConnection() | |
conn.setRequestMethod("POST") | |
conn.setDoOutput(true) | |
conn.setRequestProperty("Ocp-Apim-Subscription-Key", key) | |
conn.getOutputStream().write(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
public class KazuhitoM { | |
public static void main(String[] args) { | |
KazuhitoM self = new KazuhitoM(); | |
System.out.println(String.format("%s が好きなのは %s 感じのです。" | |
, self.getClass().getCanonicalName() | |
, self.getLikeSize().getCaption())); | |
} | |
/** |
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 static org.hamcrest.CoreMatchers.is; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import org.junit.Test; | |
/** | |
* BooleanのvalueOf()とnewと定数との比較を行うテスト。 | |
* @author kauzhito_m | |
*/ | |
public class BooleanPrimitiveAndBoxingTest { |
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
/* | |
* Special Thanks! | |
* 監修/コードレビュアー: @bufferings さん、 @megascus さん。 (ミウラはほぼアイディアだけ…トホホ) | |
*/ | |
import org.junit.Test | |
/** じゃんけんの"手"を表わす定数群。 */ | |
enum Sign { | |
pa, ty, gu; |