Skip to content

Instantly share code, notes, and snippets.

View arisng's full-sized avatar

Aris Nguyen arisng

  • Nha Trang, Vietnam
View GitHub Profile
@arisng
arisng / prd2prod_101.md
Last active July 2, 2025 07:27
prd2prod
@arisng
arisng / gist:54f8e1c29632f3081501335190bad5b9
Created November 24, 2023 02:55
Creating a slug from a string in C#
public static string Slugify(this string input)
{
string str = input.RemoveDiacritics().ToLower();
// invalid chars
str = Regex.Replace(str, @"[^a-z0-9\s-]", "");
// convert multiple spaces into one space
str = Regex.Replace(str, @"\s+", " ").Trim();
// cut and trim
str = str.Substring(0, str.Length <= 45 ? str.Length : 45).Trim();
// hyphens
@arisng
arisng / cheatsheet.ps1
Created November 13, 2023 07:43 — forked from pcgeek86/cheatsheet.ps1
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command

K8s

kubeconfig

  • kubectl commands:
# View the current context:
kubectl config current-context
@arisng
arisng / gist:a93e5c95ce20fe3fa1d850d3e8e97566
Created December 25, 2022 03:17
Linq Queryable Extensions
public static IQueryable<T> WhereIf<T>([NotNull] this IQueryable<T> query, bool condition, Expression<Func<T, bool>> predicate)
{
if (query == null)
{
throw new ArgumentNullException(nameof(query));
}
return condition
? query.Where(predicate)
: query;