Skip to content

Instantly share code, notes, and snippets.

View tusharsnx's full-sized avatar

Tushar Singh tusharsnx

View GitHub Profile
@tusharsnx
tusharsnx / pyproject.toml
Created June 17, 2022 08:52
pyproject.toml content after installation
[tool.poetry]
name = "personal-website"
version = "0.1.0"
description = "backend for personal website"
authors = ["Tushar Singh <tusharvickey1999@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.10"
fastapi = "^0.73.0"
aiofiles = "^0.8.0"
@tusharsnx
tusharsnx / output.sh
Created June 17, 2022 08:44
Poetry Debug Output
Using virtualenv: /home/tushar/.cache/pypoetry/virtualenvs/personal-website-43YhZ939-py3.10
PyPI: 36 packages found for motor *
Using version ^3.0.0 for motor
Updating dependencies
Resolving dependencies...
1: fact: personal-website is 0.1.0
1: derived: personal-website
1: fact: personal-website depends on fastapi (^0.73.0)
1: fact: personal-website depends on aiofiles (^0.8.0)
@tusharsnx
tusharsnx / partial-recurssive.ts
Created June 15, 2022 15:00
Apply Partial Recursively on Object Types
type PartialRecur<T> = T extends {} ? { [K in keyof T]?: PartialRecur<T[K]> } : T
@tusharsnx
tusharsnx / tuple-of.ts
Created June 11, 2022 07:58
generate tuple of primitive-types from tuple of literal-types
type TypeOfLiteral<T> = T extends string
? string
: T extends number
? number
: T extends boolean
? boolean
: T extends bigint
? bigint
: T extends Symbol
? Symbol
@tusharsnx
tusharsnx / forward-wsl.ps1
Last active June 26, 2022 09:14
port forwarding to access wsl localhost from windows
# credit: https://github.com/edwindijas
$remoteport = bash.exe -c "ip a s eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;