Anduin

let today = new Beginning();

All Posts


Raise up Visual Studio Code correctly in your C# client-side program

When I search this topic from Google, I always get results with 'How to write C# program in VS Code'. But what I was working on is an editor, which allows the user to open VS Code to edit a folder. My UI is like this: So what should I do to open the folder in VSCode? Code is below: Process.Start(new ProcessStartInfo { UseShellExecute = true, // IMPORTANT: …

C# VSCode WPF

Auto backup for Minecraft on Linux

Recently, I was addicted to Minecraft. And I hosted a server. In order to backup the server automatically, I have tried many solutions. Git solution Git solution requires a lot of CPU when compressing the objects. And may impact the game performance since Java itself requires a lot of CPU. So I finally gave up Git.   Copy solution Copy the world folder to anther place is super simple. Before try …

bash Minecraft Backup

Validate an object in any C# projects

Sometimes, we need to check if the input is valid. Usually, we may do this: if (string.IsNullOrWhiteSpace(InputArgument.TargetMachine) || string.IsNullOrWhiteSpace(InputArgument.PatchId)) { throw new ArgumentException($"Invalid input argument! Patch ID: '{InputArgument.PatchId}', Target Machine: '{InputArgument.TargetMachine}'!"); …

ASP.NET Core C# .NET Validation

在一秒钟内打开苏康码

之前每次进公司,为了打开苏康码,都得翻半天支付宝和微信的小程序,非常痛苦。 尤其是手机卡住了,网不稳了,小程序框架本身就加载半天,弄得我经常尴尬的卡在门外,迟到,难受。 不过,我怎么看怎么感觉,这个苏康码好像就是个网页呀,如果能抠出来URL,自己用浏览器打开,岂不是相当方便快捷? 还可以省去天天翻各种小程序了。   获取苏康码 在下面地址获取苏康码: https://scm.szgaj.cn/wjw/health_skm.html (这并不需要你有任何App例如微信、支付宝,可以在PC上操作)   (防钓鱼:         这个URL的意思,看起来是 https://苏城码.苏州公安局.中国/微警务/健康_苏康码.html。经过检查备案信息,确实属于苏州公安局。再加上有HTTPS,应该不是钓鱼链接,可以放心输入个人信息)     加速这个过程 在你通过浏览器获取到苏康码后,可以复制 …

Web China Health Code

C# Play with GZip.

A extension class for string to add GZip features. Copy the following code to your project first. using System; using System.IO; using System.IO.Compression; using System.Text; public static class GZipExtensions { private static byte[] Zip(string str) { var bytes = Encoding.UTF8.GetBytes(str); using (var msi = new MemoryStream( …

C# .NET Compress GZip Base64

Directly talk to any enterprise Microsoft Teams user

Recently, we found that you can directly talk with any Microsoft Teams (Work or School) user. Before starting Before starting, you need to have Microsoft Teams (Work or School) installed and sign in with your work or school account. To buy it, reference Microsoft 365: Compare Microsoft 365 Enterprise plans   Find a person The approach is pretty simple. First, you need to grab his email address. …

Microsoft Teams Microsoft 365

Use Windows as a stateless OS on your devices

Why stateless device, stateless OS? OS might be buggy Now Windows 11 is very buggy. Stuck everyday. Unresponsive everyday. Store stop working every day. Since those tiny problems emerge endlessly on Windows 11. Often inexplicable systems will fall into weird failures. Solving these problems is very difficult, and it may require us to understand how Windows works. However, …

PowerShell Windows Windows 11 Automation Configuration Device Reimage


Install Windows store app with WinGet

Now winget supports to install a Microsoft store app. First, you need to get the store app Id. Go to the Microsoft official website: https://www.microsoft.com/en-US/ And search the store app here. For example:   Click it. And now you have the address. So, for example, the 'to do app' has ID: 9nblggh5r558 You can use command to open store: ms-windows-store://pdp/?ProductId=9 …

PowerShell Windows Winget Microsoft Store UWP Store

Install Windows 11 side-by-side without a USB drive

This tutorial only for existing Windows users which needs to install the second Windows along-side it without USB disk or CD. How When you have the Windows installer, you can directly unzip the install.wim to a new partition. This process does not need to restart or enter the PE environment, so no USB storage disk nor CD is required.   After the decompression is complete, directly boot the new …

Windows 10 PowerShell Windows Windows 11 Install DISM Bcdedit Boot BCD

Retry with exponetial back-off on C#

Just built a simple retry engine in C#. /// /// Retry engine. /// public class RetryEngine { private static Random rnd = new Random(); private readonly ILogger logger; /// /// Creates new retry engine. /// /// Logger public RetryEngine( …

C# .NET Retry

找到玄学问题的根源的方法 - 夹逼调试法

背景 最近经常会有人找我问一些非常有趣,但是又非常玄学的问题。这类玄学问题我指的是正常情况下明明能工作,现在却不知为何无法工作的情况。 这些问题往往和非常多的难以预料的因素(例如环境)有关。例如:为什么我无法将一个文件签入到git? 解决大部分玄学问题,往往需要我主动在他的电脑上进行大量操作、环境分析,才能知道到底是哪里对程序产生了影响。或往往需要我反复沟通数十条消息才能真正判断问题所在。而且这类问题,由于正常情况下是能工作的,所以非常难以通过Google和Stack Overflow解决。 后来我想,与其每次都花费大量时间帮别人解决问题,不如抽象出一套能够解决上述问题的通用方法,来让大部分人能够自行解决这些问题。 夹逼调试法由此诞生。 夹逼调试法 夹逼调试法,指的是通过两个方向共同限制作用,使得问题根源的可能范围集中在最小化的条件变化中。 夹逼调试法适用于解决: 平时或 …