Skip to content

Instantly share code, notes, and snippets.

@mas0061
mas0061 / run-other-container.yml
Created February 2, 2024 13:43
Running actions/checkout@v4 with Maven 3.6.3 + Amazon Corretto 8
name: Actions apply Node.js 20
on:
workflow_dispatch:
jobs:
run-other-container:
runs-on: ubuntu-latest
container:
image: amazoncorretto:8u362-al2023
#!/usr/bin/env zx
/*
* Attension:
* This is a prototype and we have not actually tried Terraform import.
*
* Usage:
* Maybe you can run it with `npx zx users.mjs`.
* If not, use `npm install -g zx` to install zx
*
@mas0061
mas0061 / build.gradle
Created June 22, 2019 21:38
Gradle minimum template with Kotlin + Spek 2
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.40'
}
ext {
spek_version = '2.0.5'
kotlin_version = '1.3.40'
}
repositories {
@mas0061
mas0061 / git-branch-list-on-remote-with-sort
Created June 6, 2019 03:13
Gitのリモートブランチリストを最終コミット日でソートする
git for-each-ref --sort=-committerdate refs/remotes/origin --format='%(authordate:short) %(refname)'
@mas0061
mas0061 / convertJpFiscalString.java
Created December 5, 2013 08:44
Date → 和暦、西暦(String) → 和暦の変換をJava 7で
/**
* Date型を和暦の年度に変換する
* @param date 算定する日付
* @return 元号 + 年 + 年度をStringで返す
*/
public static String convertJpFiscalString(Date date) {
Locale locale = new Locale("ja", "JP", "JP");
Calendar cal = Calendar.getInstance(locale);
cal.setTime(date);
@mas0061
mas0061 / get_name_from_MySQL.sh
Last active December 19, 2015 06:59
MySQLのDB名やテーブル名を取得するワンライナー。最後のsedをしないと不要な文字列が入る。
# DB名の取得
mysql -u user -ppassword -e 'show databases;' | cut -d '|' -f2- | sed 1d
# 指定したDBのテーブル名を取得
mysql -u user -ppassword -e 'show tables from hoge_db;' | cut -d '|' -f2- | sed 1d
@mas0061
mas0061 / divideFile2000.sh
Created April 8, 2013 13:00
ファイルを2,000個ごとに別ディレクトリへ格納するシェルスクリプト
#!/bin/sh
i=1
prefix="dir"
curDir=$prefix$i
mkdir $curDir
for file in `ls`
do
mv $file $curDir
@mas0061
mas0061 / StringClass.vpp
Created March 18, 2013 21:14
String class like Java on VDM++.
class StringClass
types
public String = seq of char;
functions
-- 文字列の列から、接頭辞にマッチする文字列を列で抜き出す
-- p StringClass`returnStartsWith(["askdj", "testA", "askjtest", "Testaai", "test"], "test")
public returnStartsWith : seq of StringClass`String * StringClass`String -> seq of StringClass`String
returnStartsWith(aStrList, aPrefix) ==
@mas0061
mas0061 / createMacInstaller.sh
Created March 11, 2013 21:14
Mac向けインストーラーを作るシェルスクリプト。Snow Leopard以降で動くはず。Mountain Lionで動作確認済み。
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage : createMacInstaller.sh VERSION"
exit
fi
FILES="./インストーラーに入れるファイル群ディレクトリ"
DISTXML="./Distribution.xml"
TARGET="/Applications"
@mas0061
mas0061 / ObjectFiltering
Last active December 10, 2015 00:39
VDM++でオブジェクト列のインスタンス変数の値を指定して、該当オブジェクトを抽出する例
class A
instance variables
public member : nat;
operations
public A : nat ==> A
A(n) == member := n;
end A