Skip to content

Instantly share code, notes, and snippets.

View dobrosketchkun's full-sized avatar

Wisketchy Dobrov dobrosketchkun

View GitHub Profile
@dobrosketchkun
dobrosketchkun / chromatic_aberration.py
Created July 18, 2023 18:46
chromatic aberration with options (for colab or not)
import cv2
import numpy as np
try:
from google.colab.patches import cv2_imshow
except:
pass
def chromatic_aberration(image_path, save_path, shift_params=None):
# Load the image
image = cv2.imread(image_path)
@dobrosketchkun
dobrosketchkun / pinterest_download.py
Created July 12, 2023 12:08
Fetch images from the pinterest boards
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
import requests
import os
import time
from tqdm import tqdm
import pymorphy2
import re
import nltk
from nltk.tokenize import word_tokenize
nltk.download('punkt')
one_letter_correspondences = {
'А': 'A',
'Б': 'B',
@dobrosketchkun
dobrosketchkun / LICENSE
Created March 19, 2023 11:35
"The Uncertain Commons License" aka "The I-don't-know-what-I'm-doing-please-don't-sue-me License"
The Uncertain Commons License
alias: The I-don't-know-what-I'm-doing-please-don't-sue-me License
This repository and its contents are provided "as is" and "as available", without
warranty or guarantee of any kind, either express or implied, including but not limited to
the warranties of merchantability, fitness for a particular purpose, or non-infringement.
To the best of my knowledge, most of the materials in this repository are public domain,
and you are free to use, modify, distribute, and/or sell them without restriction or
obligation.
@dobrosketchkun
dobrosketchkun / psudorandom.py
Last active December 6, 2022 21:06
One step above naïve implementation of pseudorandom number generator
import hashlib
class HashPseudoRandom:
"""
A class for generating a sequence of pseudorandom values using two hash functions.
"""
def __init__(self, seed, first_hash='sha3_512', second_hash='sha3_512'):
"""
Initialize the pseudorandom generator with the specified seed and hash functions.
@dobrosketchkun
dobrosketchkun / prompt_extract.py
Last active November 23, 2022 16:16
Extract prompt from any* image file made in AUTOMATIC1111
from PIL import Image
filename = 'kprverse_v4-4300.jpg'
im = Image.open(filename)
print(filename)
try:
im.load()
@dobrosketchkun
dobrosketchkun / get_palette_from_image.py
Last active September 14, 2022 09:20
Get a pallete from an image
'''
Shamelessly ripped with some meat from a number of unknown sources, sorry.
'''
from math import sqrt
import pandas as pd
import numpy as np
import random
try:
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
from time import sleep
import urllib.request
from os.path import exists
import hashlib
import requests
import re
# TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
Aalto Alvar architecture; bauhaus
Aarons Slim photography; scene; vibrant
Abbey Edwin Austin realism; scene
Abercrombie Gertrude dark; low contrast; surrealism
Abramović Marina character; photography; scene
Abts Tomma abstract; angular
Acconci Vito architecture; dark; installation; sculpture
Achenbach Andreas landscape; romanticism; seascape
Ackroyd Norman high contrast; landscape; monochromatic
Adams Ansel high contrast; monochromatic; photography
@dobrosketchkun
dobrosketchkun / zlib2libgen.user.js
Last active July 6, 2022 01:55
userscript for tapermonkey, adds a link to search the title of the book on libgen
// ==UserScript==
// @name z-lib to libgen
// @namespace http://tampermonkey.net/
// @version 0.2
// @description z-lib to libgen
// @author dobrosketchkun
// @include https://*/*
// @icon https://www.google.com/s2/favicons?domain=3lib.net
// @grant none
// ==/UserScript==