Skip to content

Instantly share code, notes, and snippets.

@kou1okada
kou1okada / calc_ddrescue_log.awk
Last active September 3, 2023 08:28
ddrescueutils
#!/usr/bin/gawk -f
BEGIN {
bad_sector = non_split = non_trimmed = finished = non_tried = 0;
}
$3 == "-" {bad_sector += strtonum($2);}
$3 == "/" {non_split += strtonum($2);}
$3 == "*" {non_trimmed += strtonum($2);}
$3 == "+" {finished += strtonum($2);}
$3 == "?" {non_tried += strtonum($2);}
@kou1okada
kou1okada / README.md
Created June 2, 2023 11:25
shortcutfile_utils.bat - Utilities for the Windows Shortcut File

shortcutfile_utils.bat - Utilities for the Windows Shortcut File

Usage

Usage: SCF-GetFace.bat <ShortcutFile>
Usage: SCF-SetFace.bat <ShortcutFile> <FontFace>

Referenses

@kou1okada
kou1okada / README.md
Last active January 16, 2023 13:04
dump_comp_vars.bash - Dump completion variables for bash

dump_comp_vars.bash - Dump completion variables for bash

Usage

1. Make symbolic link into $BINDIR as:

BINDIR=~/.local/bin/
ln -sv "$PWD/dump_comp_vars.bash" "${BINDIR:-/usr/local/bin/}"
@kou1okada
kou1okada / CVE-2022-30190-remove-msdt.bat
Last active June 3, 2022 07:13
CVE-2022-30190-remove-msdt.bat : Disable the MSDT URL Protocol.
@ECHO OFF
SETLOCAL
REM Check the permission
openfiles >NUL 2>&1
IF %ERRORLEVEL% == 0 GOTO ;MAIN
REM Elevate with UAC
powershell -C start-process %0 -verb runas
GOTO :EOF
@kou1okada
kou1okada / pdfdroppw.sh
Created May 13, 2022 03:44
pdfdroppw.sh - Drop password from PDF file.
#!/usr/bin/env bash
function usage ()
{
cat <<-EOD
Usage: ${0##*/} [options] <pdffile>...
Drop password from PDF file.
Output:
\${@%.*}_nopw.pdf
Environment variables:
@kou1okada
kou1okada / checkkey.sh
Last active March 14, 2022 06:27
checkkey.sh - Check key about GNUPG.
#!/usr/bin/env bash
#
# checkkey.sh - Check key about GNUPG.
# Copyright (c) 2022 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
SGR0="\e[0m"
SGR1="\e[1m"
SGR31="\e[31m"
@kou1okada
kou1okada / shebang4powershell.bat
Last active March 10, 2022 14:04
shebang4powershell.bat - shebang for PowerShell by Batch file.
<# ::
@REM shebang4powershell.bat - shebang for PowerShell by Batch file.
@REM Copyright 2022 (c) Koichi OKADA. All rights reserved.
@REM This script is destributed under the MIT license.
@REM References:
@REM https://qiita.com/earthdiver1/items/cab769aad623a03a0f2d
@REM https://stackoverflow.com/q/2609985
@
@SETLOCAL
@SET ARGS=%*
@kou1okada
kou1okada / wc4word.rb
Last active January 11, 2022 11:51
wc4word.rb: wc for Microsoft Word.
#!/usr/bin/env ruby
#
# wordwc.rb - wc for Microsoft Word
# Copyright (c) 2021 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
require 'win32ole'
require 'optparse'
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:51
shortcutfile_utils.rb: Utilities for the Windows Shortcut File

shortcutfile_utils.rb - Utilities for the Windows Shortcut File

Usage

Usage: shortcutfile_utils.rb <ShortcutFile>
    Utility of console properties.

Options:
        --show-facename
 --facename 
@kou1okada
kou1okada / SimpleCalendar.js
Last active February 23, 2021 17:20
SimpleCalendar.js
/**
* Simple Calendar
* Copyright (c) 2021 Koichi OKADA. All rights reserved.
* This script is distributed under the MIT license.
*/
(function(){
let wd0 = 0; // week day of the first cell in calendar
let pad = (s,w,c="0")=>(Array(w).fill(c).join("")+s).slice(-w);
let isSameMonth = (d1,d2) => d1.getMonth() == d2.getMonth();
let today = new Date();