Skip to content

Instantly share code, notes, and snippets.

@myd7349
myd7349 / IpcClientServer.cs
Created December 28, 2025 08:49 — forked from VPKSoft/IpcClientServer.cs
A class for IPC channel messaging.
#region license
/*
This file is public domain.
You may freely do anything with it.
Copyright (c) VPKSoft 2019
*/
#endregion
using System;
@myd7349
myd7349 / WinMain.cpp
Created December 14, 2025 04:05 — forked from rhoot/WinMain.cpp
Win32 application entry point redirection
/** \file WinMain.cpp
* \author rhoot <https://github.com/rhoot>
*
* \brief Redirects calls from the windows specific WinMain() entry point to a more
* standard main() entry point defined someplace else. In debug builds, also
* allocates a console and redirects stdin, stderr, stdout to that console.
*
* \remark The std* stream redirection is based on RedirectIOToConsole(), as can be found
* at http://dslweb.nwnexus.com/~ast/dload/guicon.htm.
*/
@myd7349
myd7349 / Program.cs
Created December 6, 2025 01:55 — forked from murphybytes/Program.cs
Demonstrates using pinvoke to pass a callback from a .net managed application to a C dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MyCSharpApp
{
Rem run as administrator
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on
@myd7349
myd7349 / lz76benchmarks.py
Created November 6, 2025 08:09 — forked from pranaysy/lz76benchmarks.py
Comparison of LZ76 complexity implementations
"""
A demo comparison of three different implementations for estimating Lempel-Ziv complexity (1976)
Implementations compared:
- Pure Python version, by Naereen
- Numba (str), as implemented in EntroPy by Raphael Vallat
- Numba, updated for speed, based on numpy integer arrays
Simple comparisons for equality of estimates and performance to address issue:
https://github.com/raphaelvallat/entropy/issues/14
@myd7349
myd7349 / WPFFocusVisualStyleSample.xaml
Created August 20, 2025 08:49 — forked from yoshikazuendo/WPFFocusVisualStyleSample.xaml
【WPF】コントロールのフォーカスのStyleとFocusVisualStyle
<!-- MSDN -->
<!-- https://msdn.microsoft.com/ja-jp/library/bb613567(v=vs.100).aspx -->
<!-- こちらも凄く参考になります。 -->
<!-- http://grabacr.net/archives/464 -->
<!-- フォーカス時の見た目を消す-->
<TextBox Text="aikazuyendo"
FocusVisualStyle="{x:Null}" />
@myd7349
myd7349 / TolerantEnumConverter.cs
Created July 12, 2025 07:35 — forked from gubenkoved/TolerantEnumConverter.cs
Tolerant JSON.NET enum converter
/// <summary>
/// Tolerant Enum converter. Based on code in the StackOverflow post below, but adds EnumMember attribute support.
/// http://stackoverflow.com/questions/22752075/how-can-i-ignore-unknown-enum-values-during-json-deserialization
/// </summary>
public class TolerantEnumConverter : JsonConverter
{
[ThreadStatic]
private static Dictionary<Type, Dictionary<string, object>> _fromValueMap; // string representation to Enum value map
[ThreadStatic]
@myd7349
myd7349 / lz77.c
Created July 10, 2025 08:01 — forked from fogus/lz77.c
/* PROG1.C */
/* Simple Hashing LZ77 Sliding Dictionary Compression Program */
/* By Rich Geldreich, Jr. October, 1993 */
/* Originally compiled with QuickC v2.5 in the small model. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* set this to 1 for a greedy encoder */
% Encoding: UTF-8
@Manual{rlanguage,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2015},
url = {https://www.R-project.org/},
}
@article{schonbrodtbfda,
@myd7349
myd7349 / Python_LRU_Cache_Usage_Guide.md
Created May 22, 2025 07:33 — forked from promto-c/Python_LRU_Cache_Usage_Guide.md
A detailed guide to using Python's functools.lru_cache for efficient function caching. Covers basic usage, cache management, custom cache control, and additional insights for optimal utilization in various development scenarios. Ideal for Python developers looking to enhance performance with caching techniques.

1703673950911

Python lru_cache Usage Guide

Overview

The lru_cache decorator in Python's functools module implements a caching strategy known as Least Recently Used (LRU). This strategy helps in optimizing the performance of functions by memorizing the results of expensive function calls and returning the cached result when the same inputs occur again.

Basic Usage

from functools import lru_cache