Skip to content

Instantly share code, notes, and snippets.

View YoraiLevi's full-sized avatar
🎯
Focusing

Yorai Levi YoraiLevi

🎯
Focusing
View GitHub Profile
@YoraiLevi
YoraiLevi / ConvertTo-Hashtable.ps1
Last active October 12, 2023 03:46
ConvertTo-Hashtable.ps1
function ConvertTo-Hashtable {
<#
.LINK
https://gist.github.com/YoraiLevi/292bb8d0e2ce0f87d37e5d5d735fff16
.LINK
https://stackoverflow.com/questions/77265408/powershell-array-to-hashtable-cannot-get-keys-value-with-bracket-notation-but-d
.LINK
https://peps.python.org/pep-0274/
@YoraiLevi
YoraiLevi / Test-ShouldProcess.ps1
Last active February 2, 2024 00:09
Everything you wanted to know about ShouldProcess
# https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-shouldprocess
function Test-ShouldProcess {
[CmdletBinding(
SupportsShouldProcess,
ConfirmImpact = 'High'
)]
param(
[Switch]$Force
)
@YoraiLevi
YoraiLevi / KnownFolderPathPS5.ps1
Last active December 14, 2023 10:58
Change windows user folders with powershell
<#
.SYNOPSIS
Requires powershell 5 or later
Provides Get and Set functions for KnownFolders
.EXAMPLE
PS> Set-KnownFolderPath Desktop $ENV:USERPROFILE/Desktop
.EXAMPLE
PS> $Path=""
PS> Get-KnownFolderPath Desktop ([ref]$Path)
.LINK
@YoraiLevi
YoraiLevi / Download-AppxPackage.ps1
Last active February 19, 2024 12:45
Download Windows Store Apps with Powershell
#https://serverfault.com/questions/1018220/how-do-i-install-an-app-from-windows-store-using-powershell
#Usage:
# > Download-AppxPackage "https://www.microsoft.com/p/dynamic-theme/9nblggh1zbkw" "$ENV:USERPROFILE\Desktop"
# C:\Users\user\Desktop\55888ChristopheLavalle.DynamicTheme_1.4.30233.0_neutral_~_jdggxwd41xcr0.AppxBundle
# C:\Users\user\Desktop\55888ChristopheLavalle.DynamicTheme_1.4.30234.0_neutral_~_jdggxwd41xcr0.AppxBundle
# C:\Users\user\Desktop\Microsoft.NET.Native.Framework.1.7_1.7.27413.0_x64__8wekyb3d8bbwe.Appx
# C:\Users\user\Desktop\Microsoft.NET.Native.Runtime.1.7_1.7.27422.0_x64__8wekyb3d8bbwe.Appx
# C:\Users\user\Desktop\Microsoft.Services.Store.Engagement_10.0.19011.0_x64__8wekyb3d8bbwe.Appx
# C:\Users\user\Desktop\Microsoft.VCLibs.140.00_14.0.29231.0_x64__8wekyb3d8bbwe.Appx
@YoraiLevi
YoraiLevi / libary_vscode_context_menu.reg
Last active July 19, 2020 15:18
"Open with Code" inside windows `libaries` on right click context menu
Windows Registry Editor Version 5.00
;Updated command from:
;"C:\Program Files\Microsoft VS Code\Code.exe" "%1"
;to
;"C:\Program Files\Microsoft VS Code\Code.exe" "%V"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\VSCode]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,77,00,26,00,69,00,74,00,68,00,20,00,43,\
00,6f,00,64,00,65,00,00,00
"Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
00,46,00,69,00,6c,00,65,00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,\
@YoraiLevi
YoraiLevi / pasteconsole.js
Last active September 15, 2020 19:23
this code is obsolete since the 2020 new facebook design. refer to: https://github.com/YoraiLevi/SetFacebookPostsPrivate make all facebook posts private(activity log) very dumb code.
lasti=0
lastj=0
var privatefb = function(){
items = document.getElementsByClassName('_42ft _4jy0 _55pi _5vto _55_p _2agf _4o_4 _401v _p _1zg8 _4jy3 _517h _51sy _59pe')
for(i=lasti;i<items.length;i++)
{ items[i].click()
items[i].focus()
lasti=i
}
items2 = document.getElementsByClassName('_54nh _4chm')