Skip to content

Instantly share code, notes, and snippets.

View honex's full-sized avatar

Honex honex

  • Osaka Japan
View GitHub Profile
@honex
honex / Height_from_address.ps1
Last active June 2, 2016 08:18
住所から緯度経度標高を取得
$api_key = "Your API Key"
function Get-latlng
{
param(
[string]$address
)
process
{
$encoded_address = [System.Uri]::EscapeDataString( $address )
@honex
honex / Excel2PDF.ps1
Last active February 25, 2016 02:35
エクセルをPDFファイルに変換
function excel-conv
{
param(
[parameter(Mandatory=$true,ValueFromPipeline=$true)]
[string]$infile,
[string]$outfile
)
begin{
$excel = New-Object -ComObject Excel.Application
$excel.visible = $false
@honex
honex / count-row.ps1
Created July 30, 2015 10:01
フォルダ内のテキストファイルの行数をカウントする。(cmdのfindを使って)
dir *.txt | %{ cmd /c "find /v /c `"`" $_ >> count.txt" }
@honex
honex / merge-csvfile.ps1
Created June 30, 2015 04:15
CSVファイルの統合
( dir *.csv ) | %{ Import-Csv $_ -Encoding Default } | Export-Csv out.csv -Encoding default
@honex
honex / convertcolor-b2w.ps1
Created March 12, 2015 07:40
画像ファイルの黒を白に
#画像ファイルの黒を白に変換する関数
function convcolor-b2w
{
begin { Write-Host "黒→白に置き換え"
[Void][System.Reflection.Assembly]::LoadWithPartialName( "System.Drawing" )
$activepath = Get-Location
$colormap = New-Object System.Drawing.Imaging.Colormap
$colormap.OldColor = "Black"
$colormap.NewColor = "White"
$ia = New-Object System.Drawing.Imaging.ImageAttributes
@honex
honex / convert2jpg.ps1
Last active August 29, 2015 14:11
パイプラインで入力された画像をJPGに変換
function Convert2-jpg
{
begin { Write-Host "入力画像をJPGに変換"
[Void][System.Reflection.Assembly]::LoadWithPartialName( "System.Drawing" )
}
process {
trap {
"対象ファイルをパイプラインで入力してください"
"異常終了!"
@honex
honex / gist:30ac2c2afc64d0fd8d00
Last active August 29, 2015 14:07
練習用 リネーム関数(文字列置換・ 前方文字列追加・後方文字列追加・前方から指定文字数削除・後方から指定文字数削除)
#ファイル名置換リネーム関数
function Rename-replace ( $bef , $aft )
{
begin { Write-Host "ファイル名の置換リネーム" }
process {
trap {
"対象ファイルをパイプラインで入力してください"
"例:Get-Childitem *.txt | Rename-replace txt dat"
break