Skip to content

Instantly share code, notes, and snippets.

@hoangitk
hoangitk / CleanUp.md
Last active November 11, 2024 04:28
[Clean up] #admin #clean

Clean Up

Git

  • List: dotnet nuget locals --list all
  • Clean:
     dotnet nuget locals http-cache --clear
     dotnet nuget locals global-packages --clear
     dotnet nuget locals plugins-cache --clear
    
@hoangitk
hoangitk / aspnet_session_cookie.md
Last active January 16, 2024 03:57
[ASP.NET Session, Cookie] #aspnet #hosting
@hoangitk
hoangitk / How to draw diagonal line in html table.md
Created June 5, 2023 04:43
[How to draw diagonal line in html table] #css
@hoangitk
hoangitk / git_sparse_checkout.md
Created February 7, 2023 00:06
[Git sparse-checkout] #git

/* ref: https://unix.stackexchange.com/questions/233327/is-it-possible-to-clone-only-part-of-a-git-project/468182#468182?newreg=af0088568a6f40f883856f50f821ad09 */

git clone --filter from git 2.19 now works on GitHub (tested 2021-01-14, git 2.30.0)

This option was added together with an update to the remote protocol, and it truly prevents objects from being downloaded from the server.

E.g., to clone only objects required for d1 of this minimal test repository: https://github.com/cirosantilli/test-git-partial-clone I can do:

@hoangitk
hoangitk / Install WSL Distro into other location.md
Created December 9, 2022 04:00
[Install WSL Distro into other location] #wsl

Install WSL Distro into other location

  • Download Distro
     Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
    • Available Distros:
    Ubuntu 20.04 - https://aka.ms/wslubuntu2004
    
@hoangitk
hoangitk / SimpleFormatJson.cs
Created November 23, 2022 03:23
[Simple FormatJson] #json #csharp
/*
Credit: https://stackoverflow.com/questions/4580397/json-formatter-in-c
*/
public static string FormatJson(string json, string indent = " ")
{
var indentation = 0;
var quoteCount = 0;
var escapeCount = 0;
var result =
@hoangitk
hoangitk / SQLServerJSONBeautifier.sql
Created November 23, 2022 03:19
[SQLServerJSONBeautifier] #sql #tool #format
/*
Credit: https://github.com/msornakumar/SQLServerJSONBeautifier
*/
/* *********************************************************************************************************************************************************************/
-- Drop the Assembly if already Exists
/* *********************************************************************************************************************************************************************/
IF EXISTS
(
@hoangitk
hoangitk / windows_hardening.cmd
Created November 21, 2022 04:37 — forked from mackwage/windows_hardening.cmd
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
:
@hoangitk
hoangitk / script-all-foreign-keys-in-MSSQL.sql
Created November 15, 2022 05:05
[Script for all Foreign Keys in MSSQL] #sql #tool
/*
Credit: sorry I forgot where I copied from
*/
--SELECT s.[name] AS [Schema],
-- t.[name] AS [Table],
-- c.column_id,
-- c.[name] AS [Column],
-- dt.[name] AS Datatype
--FROM sys.schemas AS s
--INNER JOIN sys.tables AS t ON s.[schema_id]=t.[schema_id]
@hoangitk
hoangitk / script-to-create-or-drop-all-primary-keys-MSSQL.sql
Created November 15, 2022 05:01
[Script to create and drop all Primary Keys in MSSQL] #sql #tools
/*
Credit: https://social.technet.microsoft.com/wiki/contents/articles/2321.script-to-create-or-drop-all-primary-keys.aspx
*/
DECLARE @object_id int;
DECLARE @parent_object_id int;
DECLARE @TSQL NVARCHAR(4000);
DECLARE @COLUMN_NAME SYSNAME;
DECLARE @is_descending_key bit;
DECLARE @col1 BIT;