Skip to content

Instantly share code, notes, and snippets.

View MRDGH2821's full-sized avatar

Mihir Rabade MRDGH2821

View GitHub Profile
@MRDGH2821
MRDGH2821 / oh-my-posh-random.ps1
Created December 27, 2021 14:11
A random theme loader for Oh-my-posh in Windows Powershell
View oh-my-posh-random.ps1
$theme = Get-ChildItem $env:UserProfile\AppData\Local\Programs\oh-my-posh\themes\ | Get-Random
echo $theme.name
oh-my-posh --init --shell pwsh --config $theme.FullName | Invoke-Expression
@MRDGH2821
MRDGH2821 / oh-my-posh-random.lua
Created December 27, 2021 13:38
A random oh-my-posh theme loader for Command Prompt
View oh-my-posh-random.lua
math.randomseed(os.time())
math.random()
math.random()
math.random()
function math.randomchoice(t) --Selects a random item from a table
local keys = {}
for key, value in pairs(t) do
keys[#keys + 1] = key --Store keys in another table
end
index = keys[math.random(1, #keys)]