Skip to content

Instantly share code, notes, and snippets.

@minimaanima
minimaanima / pwsh-address-bar.ps1
Created September 26, 2025 11:42
Run Powershell from adress bar using pwsh just like cmd (7+)
# PowerShell Address Bar Command Setup
# This script enables typing "pwsh" in Windows Explorer address bar to open PowerShell in current directory
# Similar to how "cmd" opens Command Prompt in the current folder
# Check if running as administrator
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "This script requires administrator privileges. Restarting as administrator..." -ForegroundColor Yellow
Start-Process PowerShell -Verb RunAs -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`""
exit
}
@minimaanima
minimaanima / monad.py
Last active April 10, 2025 13:06
Python Monad
"""Module for introducing Maybe Monad"""
from typing import TypeVar, Generic, Callable
T = TypeVar('T') # Generic type for value in Maybe
U = TypeVar('U') # Generic type for result after applying functions
class Maybe(Generic[T]):
"""Generic Maybe monad type for an optional value or computation result."""
def map(self, func: Callable[[T], U]) -> 'Maybe[U]':
@minimaanima
minimaanima / login.tsx
Created October 4, 2024 08:29 — forked from jdthorpe/login.tsx
expo-auth-session example
/* An example app that uses expo-auth-session to connect to Azure AD (or hopefully most providers)
Features:
- secure cache with refresh on load
- securely stored refresh token using expo-secure-store
- uses zustand for global access to the token / logout
Based on [this gist](https://gist.github.com/thedewpoint/181281f8cbec10378ecd4bb65c0ae131)
*/