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 / check_in_vscode_colab_pyodide.ipynb
Created October 27, 2024 04:48
Check if the notebook is executed in vscode colab or pyodide based platform
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@YoraiLevi
YoraiLevi / Get-TemporaryDirectory.ps1
Created June 15, 2024 00:46
Get temporary directories not just files
function Get-TemporaryDirectory {
<#
.SYNOPSIS
Creates a new temporary directory with a random name.
.DESCRIPTION
The Get-TemporaryDirectory function generates a random directory name and creates a new directory in the specified parent directory (or the system's temporary directory if no parent directory is specified) with that name.
.PARAMETER ParentDirectory
The parent directory in which the temporary directory should be created. If not specified, the system's temporary directory will be used.
@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 November 10, 2024 01:06
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 October 30, 2024 17:15
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 September 26, 2024 10:31
"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')