Skip to content

Instantly share code, notes, and snippets.

@revotu
revotu / remove_attrs.py
Last active January 27, 2024 06:48
remove all HTML attributes with BeautifulSoup except some tags(<a> <img>...)
from bs4 import BeautifulSoup
# remove all attributes
def _remove_all_attrs(soup):
for tag in soup.find_all(True):
tag.attrs = {}
return soup
# remove all attributes except some tags
def _remove_all_attrs_except(soup):
@balazsbotond
balazsbotond / notify.ps1
Last active April 28, 2024 04:01
PowerShell script for sending Windows 10 notifications
$ErrorActionPreference = "Stop"
$notificationTitle = "Build Succeeded"
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($toastXml.OuterXml)
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
$toast.Tag = "Test1"
@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
# SPDX-FileCopyrightText: Copyright (c) 2023 ave9858 <edging.duj6i@simplelogin.com>
# SPDX-License-Identifier: CC0-1.0
$ErrorActionPreference = "Stop"
$regView = [Microsoft.Win32.RegistryView]::Registry32
$microsoft = [Microsoft.Win32.RegistryKey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $regView).
OpenSubKey('SOFTWARE\Microsoft', $true)
$edgeUWP = "$env:SystemRoot\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
$uninstallRegKey = $microsoft.OpenSubKey('Windows\CurrentVersion\Uninstall\Microsoft Edge')
$uninstallString = $uninstallRegKey.GetValue('UninstallString') + ' --force-uninstall'