Skip to content

Instantly share code, notes, and snippets.

View cashwu's full-sized avatar
🌴
On vacation

Cash Wu cashwu

🌴
On vacation
View GitHub Profile
@cashwu
cashwu / C# QuestPDF.cs
Created November 11, 2023 03:38
Install-Package QuestPDF
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
Document.Create(container =>
{
container.Page(page =>
{
page.Margin(50);
page.Size(PageSizes.A4);
static async Task Main(string[] args)
{
// Generate Base64 Key Sample
//using (var aes = Aes.Create())
//{
// Console.WriteLine(Convert.ToBase64String(aes.Key));
//}
var plainText = "Hello World!!";
Console.WriteLine($"PlainText: {plainText}");
@cashwu
cashwu / C# MD5.cs
Last active November 10, 2023 14:39
.net 5 之後提供
public static string MD5_HexConvert_Static(string input)
{
var inputBytes = Encoding.UTF8.GetBytes(input);
var hashBytes = MD5.HashData(inputBytes);
return Convert.ToHexString(hashBytes);
}
@cashwu
cashwu / DapperExtensions.cs
Last active November 5, 2023 13:26 — forked from hyrmn/DapperExtensions.cs
Extension methods for calling Dapper asynchronously with a Polly retry
public static class DapperExtensions
{
private static readonly IEnumerable<TimeSpan> RetryTimes = new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3),
TimeSpan.FromSeconds(4)
};
@cashwu
cashwu / LINQPad-MinAPI.linq
Created July 14, 2023 09:11 — forked from sanme98/LINQPad-MinAPI.linq
LINQPad 7 Minimum APIs
<Query Kind="Program">
<NuGetReference>Microsoft.EntityFrameworkCore.InMemory</NuGetReference>
<NuGetReference>Swashbuckle.AspNetCore</NuGetReference>
<Namespace>Microsoft.AspNetCore.Builder</Namespace>
<Namespace>Microsoft.EntityFrameworkCore</Namespace>
<Namespace>Microsoft.Extensions.DependencyInjection</Namespace>
<Namespace>Microsoft.OpenApi.Models</Namespace>
<Namespace>Microsoft.AspNetCore.Http</Namespace>
<IncludeAspNet>true</IncludeAspNet>
<RuntimeVersion>6.0</RuntimeVersion>
@cashwu
cashwu / obsidian-web-clipper.js
Created May 16, 2023 02:40 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@cashwu
cashwu / .editorConfig
Created April 6, 2023 01:58 — forked from RealDotNetDave/.editorConfig
.editorConfig by David (dotNetDave) McCarter - dotNetTips.com
# dotNetDave's (David McCarter) Editor Config - dotNetTips.com
# Updates to this file are posted quarterly at: https://bit.ly/EditorConfig5
# Updated February 2023
# dotNetDave's books available at: http://bit.ly/RockYourCodeBooks
# Rockin' the Code World with dotNetDave (weekly live show): https://www.c-sharpcorner.com/live/rockin-the-code-world-with-dotnetdave
root = true
# All Files
[*]
@cashwu
cashwu / .env.template
Created February 19, 2023 13:39 — forked from typebrook/.env.template
Docker Compose for nginx and gitea
GITEA_DATA_DIR=/tmp/gitea
@cashwu
cashwu / 01.bash_shortcuts_v2.md
Created February 7, 2023 02:47 — forked from tuxfight3r/01.bash_shortcuts_v2.md
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
$$('*').forEach(e => {e.style.outline = "1px solid #" + (~~(Math.random()*(1<<24))).toString(16);e.style.outlineOffset='-1px'} )