Skip to content

Instantly share code, notes, and snippets.

@kenjiuno
kenjiuno / Control1.cs
Created April 10, 2024 07:27
About `e.Data.GetDataPresent(DataFormats.FileDrop)`
public partial class Form1 : Form
{
private void _control1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.AllowedEffect & (e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.All : DragDropEffects.None);
}
}
@kenjiuno
kenjiuno / README.md
Created February 27, 2024 00:45
Display OEMCP value acquired from registry

Command prompt:

reg query HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v OEMCP

Result:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
@kenjiuno
kenjiuno / File.cs
Created February 26, 2024 08:20
Obtain actual folder path of `logdir` variable defined at `NLog.config`
var logdir = Path.GetFullPath(
LogManager.Configuration
.Variables["logdir"]
.Render(LogEventInfo.CreateNullEvent())
);
Directory.CreateDirectory(logdir);
Process.Start(logdir);
@kenjiuno
kenjiuno / NLog.config
Created February 21, 2024 10:37
NLog.config from NLog.Config 4.7.15
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
@kenjiuno
kenjiuno / jpeg.py
Created May 16, 2022 10:59
tiff-tobin
#!/usr/bin/python
# Runs great on Python 3.9.7
# Usage:
# - `tiffinfo.exe -d -r -s c03x_02x.tif | python jpeg.py out`
# Output files:
# - `out-Page1-JPEG-Strip 0`
# - `out-Page2-JPEG-Strip 0`
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Test.Utils
{
public static class DefinitivePDF
@kenjiuno
kenjiuno / 0004-Windows-DBCS.patch
Created March 13, 2020 09:08
PHP 5.4 SJIS Patch
From 19db6d3892b7226dbe1d70cb3b07428b42f02d9f Mon Sep 17 00:00:00 2001
From: kenjiuno <h8mastre@gmail.com>
Date: Wed, 10 Feb 2016 09:42:36 +0900
Subject: [PATCH 4/4] =?UTF-8?q?Windows=20DBCS=20=E3=83=91=E3=82=B9?=
=?UTF-8?q?=E5=AF=BE=E5=BF=9C=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
---------------------------
tsf002
---------------------------
--- InputProcessorProfiles
{0000897B-83DF-4B96-BE07-0FB58B01C4A4}
{03B5835F-F03C-411B-9CE2-AA23E1171E36}
{07EB03D6-B001-41DF-9192-BF9B841EE71F}
{23E97BC9-F2D3-4B25-8EF3-D78391BF2150}
{531FDEBF-9B4C-4A43-A2AA-960E8FCDC732}
{6565D455-5030-4C0F-8871-83F6AFDE514F}
全角ひらがな 全角カタカナ 半角カタカナ
あ ア ア
い イ イ
う ウ ウ
ヴ ヴ ヴ
え エ エ
お オ オ
ぁ ァ ァ
ぃ ィ ィ
ぅ ゥ ゥ
@kenjiuno
kenjiuno / acrt_iob_func.c
Last active September 21, 2018 02:33
_imp____acrt_iob_func for libjpeg-turbo
#include <stdio.h>
FILE *__acrt_iob_func(int handle) {
switch (handle) {
case 0: return stdin;
case 1: return stdout;
case 2: return stderr;
}
return NULL;
}