Skip to content

Instantly share code, notes, and snippets.

@vadviktor
vadviktor / delete-google-photos.py
Created January 24, 2021 09:21
Delete all Google Photos with Selenium, Firefox, Python
"""
1. create a separate Firefox profile
2. start that profile and log into the Google Account of choice
3. get the profile's path from `about:profiles`
4. set `profile_url` to the profile's path
5. run script
"""
from time import sleep
from selenium import webdriver
@mturilin
mturilin / paste_to_devtools_console.js
Created March 29, 2020 22:04
Delete all Google Photos
for(i = 1; i<=9999; i++) {
console.log("Iteration # --> " + i);
document.querySelectorAll('div[role=checkbox]').forEach(div=>div.click());
document.querySelectorAll('div[aria-label*="Select all photos"]').forEach(div=>div.click());
await new Promise(r => setTimeout(r, 3000));
try{console.log("Selected documents count for iteration [" + i + "]: " + document.evaluate('/html/body/div[1]/div/c-wiz/c-wiz[2]/span/div[1]/div/span', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText);}catch(ex){/*do nothing*/}
document.querySelector('button[title=Delete]').click();
await new Promise(r => setTimeout(r, 5000));
document.evaluate('//span[text()="Move to trash"]', document, null, XPathResult.ANY_TYPE, null ).iterateNext().click();
@edannenberg
edannenberg / magento_url_rewrite.patch
Last active August 11, 2022 17:27
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));