This file contains 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
## 最終更新日がbase_dayよりelapsed_day以上古いファイルを抽出するスクリプト | |
## 実行前に目的のディレクトリにcdしておくこと | |
function search_old_files($base_day, $elapsed_day){ | |
Get-ChildItem | %{ | |
$comp_days = ((Get-Date $base_day) - $_.LastWriteTime).Days | |
# base_dayより新しいファイルは差分がマイナスになってしまうので「0以上」の条件も必要 | |
if($comp_days -gt 0 -and $comp_days -lt $elapsed_day){ | |
$_ | |
} |
This file contains 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
Function EXCEL-Get-Book([String]$book_name){ | |
<# | |
.SYNOPSIS | |
既に開かれているExcelブックからブックオブジェクトを選択して出力する関数 | |
#> | |
Function Get-Book($book_name){ | |
# Excelオブジェクトを取得 | |
try{ | |
$ex = [System.Runtime.InteropServices.Marshal]::GetActiveObject("Excel.Application") | |
}catch{ |
This file contains 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
## | |
## 複数サーバ管理用スクリプト | |
## | |
##### ユーザ変数定義 ##### | |
# RLoginのパス | |
$rlogin_path = ".\RLogin.exe" |
This file contains 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
# 八進表記から記号表記に変換 | |
function ConvertPermissionNumberToString($target) { | |
$res = $target | |
# 特殊権限への対応(事前判定と除去) | |
$sp = "" | |
if($res.Length -eq 4){ | |
$sp = $res[0] | |
$res = $res.Remove(0,1) | |
} |
This file contains 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
# Windows形式のファイルをUNIX形式のファイルに変換する関数 | |
## Windows形式 = エンコードがSJISで改行コードがCRLF | |
## UNIX形式 = エンコードがUTF8で改行コードがLF | |
function Convert-WIN2UNIX($Path, $OutFile){ | |
(Get-Content $Path -Raw -Encoding String) -replace "`r`n","`n" | Set-Content $OutFile -NoNewline -Encoding UTF8 | |
} | |
# UNIX形式のファイルをWindows形式のファイルに変換する関数 | |
## UNIX形式 = エンコードがUTF8で改行コードがLF | |
## Windows形式 = エンコードがSJISで改行コードがCRLF |
This file contains 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
# A1形式からR1C1形式に変換する関数 | |
function Convert-A1ToR1C1($address){ | |
# 変換テーブル作成 | |
$alph = @{ | |
A=1;B=2;C=3;D=4;E=5;F=6;G=7;H=8;I=9;J=10; | |
K=11;L=12;M=13;N=14;O=15;P=16;Q=17;R=18;S=19;T=20; | |
U=21;V=22;W=23;X=24;Y=25;Z=26 | |
} | |
# 列名を取得して1文字ずつの配列化 |
This file contains 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
# コマンドライン引数取得(すべて入力必須) | |
Param( | |
[Parameter(Mandatory)] | |
[string]$BookName, # 対象ブック名 | |
[Parameter(Mandatory)] | |
[string]$SheetName, # 対象シート名 | |
[Parameter(Mandatory)] | |
[string]$StartCell, # 対象テーブルの開始セル(テーブルの一番左上のセル)のアドレス | |
[Parameter(Mandatory)] | |
[string]$EndCell # 対象テーブルの終了セル(テーブルの一番右下のセル)のアドレス |
This file contains 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
// Meryのマクロ用スクリプト | |
// マークダウンから見出し行のみ取り出して目次を作成する | |
// コードブロック内の#は無視する | |
var lines = document.GetLines() | |
function main() { | |
// 読み込み | |
var toc = [] |
This file contains 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
// Meryのマクロ用スクリプト | |
// コードのインデントを一括で整形する | |
// Ruby専用のつもりだったが、{}でインデントが増減する系の言語(C, Java, Javascript, Powershellなど)にも基本的に使用可能 | |
// 波括弧省略したif文やfor文があると正しく整形されない不具合あり(判定が難しそう) | |
var lines = document.GetLines() | |
var pm_words = [] | |
var p_words = [] | |
var m_words = [] | |
var counter = 0 |
This file contains 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
class Indent | |
attr_accessor :indent | |
def initialize (ary) | |
@indent = 2 # インデントの空白数 | |
@counter = 0 # 現在のインデントの深さ | |
@ret_ary = ary | |
# 予約語を定義 | |
create_reserved_word | |
end |
NewerOlder