Skip to content

Instantly share code, notes, and snippets.

View tkmtmkt's full-sized avatar

Takamatsu Makoto tkmtmkt

View GitHub Profile
@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: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: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: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: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 / 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) {