Skip to content

Instantly share code, notes, and snippets.

View tkmtmkt's full-sized avatar

Takamatsu Makoto tkmtmkt

View GitHub Profile
@tkmtmkt
tkmtmkt / CreatePackageInfo.ps1
Created February 1, 2014 01:24
javaのパッケージ情報ファイルを作成する
<#
.SYNOPSIS
パッケージ情報ファイルを作成します。
#>
ls -dir -r | select -skip 3 | %{
$dir = $_.fullname
$packageInfoFile = "$dir\package-info.java"
$packageName = (resolve-path $dir -rel).substring(2).replace('\','.')
if (test-path $packageInfoFile) {
@tkmtmkt
tkmtmkt / gist:7184659
Created October 27, 2013 16:35
backup by rsync
#!/bin/bash
#
# target server
# /root/.ssh/authorized_keys
#
# backup server
# ssh-keygen -f .ssh/backup -C backup
# ssh-copy-id -i .ssh/backup.pub $TARGET
#
# /root/.ssh/config
@tkmtmkt
tkmtmkt / gist:6257657
Last active December 21, 2015 05:29
Display java system properties on scala console
// raw
System.getProperties.list(System.out)
// sorted
import scala.collection.JavaConverters._
System.getProperties.asScala.toSeq.sortBy(_._1).foreach{x => println(x._1 + " = " + x._2)}
@tkmtmkt
tkmtmkt / gist:5786517
Created June 15, 2013 02:17
mavenプロジェクト作成
cd ~/work
mvn archetype:generate `
-D archetypeArtifactId=maven-archetype-quickstart `
-D groupId=com.github.tkmtmkt `
-D artifactId=study-coherence-java `
-D version=1.0-SNAPSHOT
@tkmtmkt
tkmtmkt / gist:5786513
Created June 15, 2013 02:15
oracle coherenceをmavenのローカルリポジトリに登録する
cd ~/apps/coherence/lib
mvn install:install-file `
-D groupId=com.oracle.coherence `
-D artifactId=coherence `
-D version=3.7.1.7 `
-D file=coherence.jar `
-D packaging=jar `
-D generatePom=true
@tkmtmkt
tkmtmkt / gist:4547097
Last active December 11, 2015 04:39
Windowsイベントログから起動/停止の履歴を抽出する
function Get-RestartLog {
Get-EventLog System |
?{$_.Source -match '(USER32|EventLog)' -and 1074,1076,6005,6006,6008 -contains $_.EventId} | %{
$record = new-object PSObject -property @{
Time = $_.TimeGenerated
EventId = $_.EventId
}
if ($Matches[1] -eq 'USER32') {
$_.Message -split "`r`n" | ?{$_.Length -gt 0} | %{
$line = $_ -split ":(?!\\)",2
@tkmtmkt
tkmtmkt / gist:4519239
Created January 12, 2013 16:57
Windowsの管理者権限の有無を判定する
function IsAdministrator {
[Security.Principal.WindowsPrincipal]$id = [Security.Principal.WindowsIdentity]::GetCurrent()
$id.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}
@tkmtmkt
tkmtmkt / gist:3837177
Created October 4, 2012 23:47
エポック秒の計算
(date "2012/10/04 22:00").Subtract((date "1970/01/01 09:00")).TotalSeconds
((date "2012/10/04 22:00") - (date "1970/01/01 09:00")).TotalSeconds
date (date "2012/10/04 22:00").ToUniversalTime() -u "%s"
date (date "2012/10/04 22:00").AddHours(-9) -u "%s"
(date "2012/10/04 22:00" -u "%s") - 9*60*60
@tkmtmkt
tkmtmkt / Build.scala
Created August 4, 2012 04:57
標準のディレクトリ構成を変更するscala設定ファイル(Full:マルチプロジェクト)
import sbt._
import Keys._
object TestBuild extends Build {
lazy val root: Project = Project("root", file("."), aggregate = nonRoots)
lazy val nonRoots = projects.filter(_ != root).map(p => LocalProject(p.id))
lazy val main = consoleProject("main", file("main")) dependsOn(sub1, sub2, sub3)
lazy val sub1 = webProject("sub1", file("sub1"))
@tkmtmkt
tkmtmkt / build.sbt
Created August 4, 2012 04:54
標準のディレクトリ構成を変更するscala設定ファイル(Basic)
name := "My Project"
version := "0.1-SNAPSHOT"
organization := "home"
unmanagedBase <<= baseDirectory / "lib"
sourceDirectory in Test <<= baseDirectory / "test"