Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Entries from 2020-12-01 to 1 month

外部プロセスとしてシェルスクリプトを起動する方法

任意の処理系から外部プロセスとしてシェルスクリプトを起動したい場合、大きく以下の2つの方法が考えられます。 (1) shの引数にシェルスクリプトを指定する /bin/sh foobar.sh のように、shの引数にシェルスクリプトを指定して起動する。 shに与えるパラメ…

シェルスクリプトに渡す引数をサニタイズ

シェルスクリプトに渡した引数を、スクリプト中で単純に$@で参照すると、OSコマンドインジェクションを招くおそれがある。 $ cat sanitize4.sh #!/bin/bash ash -s <

Equivalent of native2ascii and native2ascii -reverse in CyberChef

CyberChef Unescape string is equivalent to native2ascii -reverse. CyberChef Escape string is almost equivalent to native2ascii. Escape level should be "Special chars". native2ascii never escape Escape single quotes, double quotes, or backt…

CPU goes 100% when you read .HAR file with ConvertFrom-JSON

Background In Chrome DevTools, you can export the contents in the Network tab into a JSON file (.HAR file). Chrome cannot export the contents of the spreadsheet in the Network tab into .csv or .xlsx format. If you want to get these content…

Overwriting existing file never change creation time in NTFS

Overwriting existing file like 1..10 > file.txt, 1..10 | Out-File file.txt, or 1..10 | Set-Content file.txt, never changes creation time in NTFS. You have to delete the file explicitly like rm file.txt; 1..10 > file.txt, or change creation…