Skip to content

Instantly share code, notes, and snippets.

@keithwongg
keithwongg / Profile.ps1
Last active September 19, 2025 07:28
PowerShell Script - New Tab Split Panes, Run Custom PowerShell Commands
# run 'echo $PROFILE' in PowerShell to get location of Profile Script. Paste the script inside that file and open a new instance to load it.
## Automation scripts to start local dev instance
function run-backend {
cd "C:\\Users\\admin\\Documents\\Repos\\VueWithAsp\\VueWithAsp.Server";
dotnet run;
}
function run-frontend {
cd "C:\\Users\\admin\\Documents\\Repos\\VueWithAsp\\vuewithasp.client"
@keithwongg
keithwongg / UsefulTooling.txt
Created February 13, 2025 03:44
Useful Software
# Windows
Everything by voidtools - faster windows file search: https://www.voidtools.com/
LinqPad - https://www.linqpad.net/download.aspx
# Mac
Alfred - https://www.alfredapp.com/
# All
Git Fork: https://git-fork.com/
@keithwongg
keithwongg / _TemplateSnippet.snippet
Created November 8, 2024 02:37
SSMS Code Snippets Template
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>_TemplateSnippet</Title>
<Shortcut>shortcut</Shortcut>
<Description>Description</Description>
<Author></Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
gv "Select previous selection
zo "Open one fold under cursor
zc "Close one fold under cursor
zM "Close all folds
zR "Open all folds
zb " Set current line to bottom of the screen
# Append '",' to all end of lines. Works with Visual selection.
:%norm A",
@keithwongg
keithwongg / git.txt
Last active February 24, 2025 02:01
Git
ssh -T [email protected]
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/dir/priv_key
git remote add origin [email protected]:username/repo.git
git remote -v
# checkout to branch
git checkout main
# checkout to prev branch
@keithwongg
keithwongg / terminal_utils.txt
Last active August 21, 2024 06:30
Terminal Utils
# .bashrc set alias
alias downloads='cd ~/../../mnt/c/Users/User/Downloads/'
# Move file
mv /home/user/file /home/user/Documents/
# Find files matching keywords in dir recursively - Source: https://stackoverflow.com/questions/15286947/how-to-perform-grep-operation-on-all-files-in-a-directory
grep -rni "string" *
@keithwongg
keithwongg / regex.md
Last active July 24, 2024 09:40
Regex

Notepad++

Search 2 keywords in the same line

Join 2 keywords with .*

Example:

22/07/2024 11:20:00 +08:00 HTTP "PUT" "/user" responded 500 in 361.2326 ms
@keithwongg
keithwongg / sql_useful_snippets.sql
Last active August 29, 2024 15:14
Useful SQL Snippets - SQL Server
-- Row Number with Partition
select
*
from (
select
ROW_NUMBER() over (partition by Name order by CreatedAt) as rn
,*
from [Table].[TableEntity]
) as entities
where entities.rn = 1