Skip to content

Instantly share code, notes, and snippets.

View lozhn's full-sized avatar

Nikita Lozhnikov lozhn

View GitHub Profile
@lozhn
lozhn / chrome_remove_passwords.js
Last active September 17, 2021 09:47
Attempts to remove all saved passwords in chrome
// Tested in Chrome 93
//
// Open `chrome://settings/passwords` and paste the snippet in the console and hit Enter
// It may my required to repeat the process a few times as I don't know JS
// and `.click()` seems to be async so not every button get clicked
n = document.querySelector("body > settings-ui").shadowRoot.querySelector("#main").shadowRoot.querySelector("settings-basic-page").shadowRoot.querySelector("#basicPage > settings-section.expanded > settings-autofill-page").shadowRoot.querySelector("#passwordSection").shadowRoot.querySelector("#passwordsListHandler > div > div.cr-separators.list-with-header").children.length
for (i = 1; i < n; i++) {
@lozhn
lozhn / delete-brave-passwords.js
Created August 10, 2021 13:53
Mass delete saved passwords in Brave Browser (v1.26.74 macOS 15)
// On the page brave://settings/passwords open js console
// Select the final password row (to count how many there're, in my case it was 63)
// Update the script below and run
for (i = 1; i < 64; i++) {
document.querySelector("body > settings-ui").shadowRoot.querySelector("#main").shadowRoot.querySelector("settings-basic-page").shadowRoot.querySelector("#advancedPage > settings-section.expanded > settings-autofill-page").shadowRoot.querySelector("#passwordSection").shadowRoot.querySelector("#passwordsListHandler > div > div.cr-separators.list-with-header > password-list-item:nth-child(" + i +")").shadowRoot.querySelector("#moreActionsButton").click();
document.querySelector("body > settings-ui").shadowRoot.querySelector("#main").shadowRoot.querySelector("settings-basic-page").shadowRoot.querySelector("#advancedPage > settings-section.expanded > settings-autofill-page").shadowRoot.querySelector("#passwordSection").shadowRoot.querySelector("#passwordsListHandler").shadowRoot.querySelector("#menuRemovePass
@lozhn
lozhn / test.py
Created July 12, 2020 13:55
Timeit redis vs disk 10mb file store
from redis import Redis
from timeit import timeit
r = Redis('redis')
def blob(m=10):
return '1' * 1024 * 1024 * m
f10mb = blob(10)
@lozhn
lozhn / codechallenge.ipynb
Last active August 6, 2018 22:12
codechallenge
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lozhn
lozhn / solutions.ipynb
Created July 30, 2018 09:03
challenges
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lozhn
lozhn / right-and-down-challenge.ipynb
Created March 24, 2018 12:00
Right and Down challenge
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lozhn
lozhn / remove_stars.js
Last active April 5, 2017 16:08
Run in Chrome JS Console to instantneously click all "Unstar" buttons on your Stars page at https://github.com/{username}?tab=stars (then refresh page due to pagination on run again)
[...document.getElementsByClassName('starred')].map(e => e.children[1].click())
@lozhn
lozhn / model.py
Created March 24, 2017 18:18
DMD course. Base activerecord-like python model.
import datetime
import psycopg2
from collections import namedtuple
"""
Some advices to use Model class for interaction with user_tables
For example we have User class that derived from Model
We will fetch data from table with name __classname__ + 's'