Skip to content

Instantly share code, notes, and snippets.

View poychang's full-sized avatar
🏠
Stay Home & Be Health

Poy Chang poychang

🏠
Stay Home & Be Health
View GitHub Profile
@poychang
poychang / Note.md
Created May 10, 2024 09:17 — forked from JeffRDay/Note.md
Find Non-UTF8 Encoded Characters using Visual Studio Code (VS Code)

I ran into a problem with python where a file I wanted to read in and parse contained unexpected non-UTF-8 encoded characters. I am certain there are many ways to solve this problem, but capturing my quick and dirty appraoch below for posterity.

  1. Open the file and the Open Find
  2. In find, copy/paste the regex below:
^([\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|[\xEE-\xEF][\x80-\xBF]{2}|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})*$
  1. VS Code will highlight the lines MATCHING UTF encoded characters. So, you just have to skim the file looking for lines without highlighting.
@poychang
poychang / privacy-policy-template-eng.md
Last active April 29, 2024 11:39
隱私權條款範本

Privacy Policy Template

Welcome to [Your Website Name] (hereinafter referred to as "the Website"). In order to provide you with a secure and seamless experience while using the various services and information on our website, we are committed to protecting your privacy rights. Please read the following information carefully:

1. Scope of Privacy Policy

This Privacy Policy outlines how we handle the collection, processing, and utilization of personal identifiable information when you use our website's services. This Privacy Policy does not apply to other related websites not operated by us or to individuals not managed or commissioned by us.

2. Collection, Processing, and Utilization of Personal Data

@poychang
poychang / reset.css
Created May 19, 2017 05:51
Eric Meyer's Reset CSS 2.0
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@poychang
poychang / Install Android apps or apk files in Windows using Windows Subsystem for Android (No Emulator).md This Guide will show you how to install and run apk files or Android apps in any Edition of Windows 11 using Windows Subsystem for Android. WSA or Windows Subsystem for Android is a Tool that allows Windows to run Android Apps directly without using any emulator.

Install Android apps or apk files in Windows using Windows Subsystem for Android

WSA or Windows Subsystem for Android is a Tool that allows Windows to run Android Apps directly without using any emulator. The problem is Windows Subsystem for Android is currently only available through preview via the Beta Channel of the Windows Insider Program. But if you follow my guide, you don't have to be in Windows Insider Program to try it out. The only thing you need is Windows 11 installed and some patience.

Prerequisites:

  • Windows Subsystem for Android or WSA must be Installed.

Click here to view the guide that shows how to install Windows Subsystem for Android in any Edition of Windows 11 (including Windows 11 Home) non Inider or stable release.

How to Install Android Apps or apk files in Windows Subsystem for Android:

@poychang
poychang / firework.html
Last active November 23, 2022 03:30
Pure CSS Fireworks
<div class="pyro fadeOut">
<div class="before"></div>
<div class="after"></div>
</div>
@poychang
poychang / Benchmark 效能測試樣板.linq
Created September 28, 2022 02:48
[LINQPad - Benchmark 效能測試樣板] 簡單驗證執行效能
#LINQPad optimize+
BenchmarkRunner.Run<BenchmarkJob>();
[SimpleJob(RunStrategy.ColdStart, targetCount: 10)]
[MemoryDiagnoser]
public class BenchmarkJob
{
[Benchmark]
public void Method1()
@poychang
poychang / ThenExtension.cs
Last active September 28, 2022 02:47
[LINQ 擴充 - 然後呢] "然後呢"擴充方法 #C# #dotnet
public static class ThenExtension
{
/// <summary>
/// "然後呢"擴充方法
/// </summary>
/// <typeparam name="T">原本的物件型別</typeparam>
/// <param name="instance">原本的物件</param>
/// <param name="fn">然後你要執行什麼,並回傳變更後的物件</param>
/// <returns>原本的物件,可能會變更原本物件的屬性值</returns>
public static T Then<T>(this T instance, Func<T, T> fn) => fn(instance);
@poychang
poychang / 10to62.cs
Last active August 18, 2022 09:00
[10 進制數轉換成 62 進制] #dotnet
void Main()
{
Converter.FromDecimalTo62Hex(10).Dump();
Converter.From62HexToDecimal("a").Dump();
Converter.FromDecimalTo62Hex(100).Dump();
Converter.From62HexToDecimal("1C").Dump();
}
// Define other methods and classes here
@poychang
poychang / CheckDotnetHostingBundleVersion.ps1
Created November 23, 2018 01:29
[檢查 IIS 的 .NET Core Hosting Bundle 版本] #powershell
$DotNETCoreUpdatesPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core"
$DotNetCoreItems = Get-Item -ErrorAction Stop -Path $DotNETCoreUpdatesPath
$NotInstalled = $True
$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object {
$NotInstalled = $False
Write-Host "The host has installed $_"
}
If ($NotInstalled) {
Write-Host "Can not find ASP.NET Core installed on the host"
}
@poychang
poychang / SpaMiddleware.cs
Last active December 4, 2021 09:00
[ASP.NET Core Middleware 存取 SPA 網頁資源] 搭配 SPA 前端框架使用,將網頁導向至 index.html #dotnet #angular
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
namespace DemoApp.Middleware
{
/// <summary>SPA 中介程序</summary>
public class SpaMiddleware
{
private readonly RequestDelegate _next;