Skip to content

Instantly share code, notes, and snippets.

View jca02266's full-sized avatar

Koji Arai jca02266

View GitHub Profile
Get-Item * | % {
$folder = $_
Write-Warning $folder
Get-ChildItem $folder -Recurse | Measure-Object -Sum Length | Select-Object @{Name="Folder"; E={$folder.FullName}},Count,Sum
# [GC]::Collect()
} | Sort-Object Sum -Desc | Format-Table -AutoSize
Option Explicit
' セルに代入しても自動変換されないように値を加工する
' BUG: 日本語以外には対応していない
' BUG: サロゲートペアには対応してない
Function SafeValue(v As Variant) As Variant
Dim c As String
Dim narrowString As String
c = Left(v, 1)
narrowString = StrConv(c, vbNarrow)
@jca02266
jca02266 / expect.txt
Created November 3, 2021 01:16
JSON transform example
person1
a1
b1
2021-11-01 - 2021-11-07 (2021-11-01 - 2021-11-03): c1
2021-11-01 - 2021-11-07 (2021-11-02 - ): c2
person2
a1
b2
2021-11-01 - 2021-11-07 ( - ): c2
b3
@jca02266
jca02266 / morningCheckList.bat
Last active November 3, 2021 23:57
朝やることリスト(powershell) (BOM付UTF-8かShift_JISで保存すること)
powershell -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File "%~dpn0.ps1" morningCheckList
@jca02266
jca02266 / ComparePDFFiles.sct
Last active September 30, 2021 03:47
WinMerge Plugin (convert PDF file to image file)
' Install:
' Download poppler-0.68 from Poppler for Windows (http://blog.alivate.com.au/poppler-windows/)
' and extract it on the "C:\Program Files\WinMerge\MergePlugins\poppler-0.68" folder.
'
<scriptlet>
<implements type="Automation" id="dispatcher">
<property name="PluginEvent">
<get/>
</property>
<property name="PluginDescription">
@jca02266
jca02266 / result.txt
Last active March 14, 2021 19:50
Dump Windows-31J extended chars
< NEC特殊漢字 >
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
0x8740 ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯
0x8750 ⑰ ⑱ ⑲ ⑳ Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ ㍉
0x8760 ㌔ ㌢ ㍍ ㌘ ㌧ ㌃ ㌶ ㍑ ㍗ ㌍ ㌦ ㌣ ㌫ ㍊ ㌻ ㎜
0x8770 ㎝ ㎞ ㎎ ㎏ ㏄ ㎡ ㍻
0x8780 〝 〟 № ㏍ ℡ ㊤ ㊥ ㊦ ㊧ ㊨ ㈱ ㈲ ㈹ ㍾ ㍽ ㍼
0x8790 ≒ ≡ ∫ ∮ ∑ √ ⊥ ∠ ∟ ⊿ ∵ ∩ ∪
< NEC選定IBM拡張文字 >
Function re_match(re As Object, s As String) As Variant
Dim ms As Object
Set ms = re.Execute(s)
Dim arr() As String
If ms.Count = 0 Then
Exit Function
End If
Dim m As Object
// return random intger value: [min, max)
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min);
}
// return (size m) array picked from 0..<n (n >= m)
// Modified Fisher-Yates Shuffle (derived from <https://qiita.com/hmito/items/9f4bdc8442b6f6b3c7bc>)
function randomPick(n, m) {
@jca02266
jca02266 / qtsample.py
Created February 21, 2021 16:08
PyQt programming (transparency window)
import sys
import random
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
class MainWindow(QWidget):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
@jca02266
jca02266 / east_asian_width.py
Last active February 21, 2021 12:11
Detect string width on screen
import unicodedata
# https://www.unicode.org/reports/tr11/tr11-14.html
EAW_WIDTH = {
'F': 2, # Full-width
'H': 1, # Half-width
'W': 2, # Wide
'Na': 1, # Narrow
'A': 2, # Ambiguous
'N': 1 # Not East Asian (Neutral)