Skip to content

Instantly share code, notes, and snippets.

View dobrosketchkun's full-sized avatar

Wisketchy Dobrov dobrosketchkun

View GitHub Profile
@dobrosketchkun
dobrosketchkun / doirefer.py
Last active February 18, 2024 14:20
DOI to citation
#!/usr/bin/env python
#http://www.crosscite.org/cn/
import requests
import json
class CrossRefClient(object):
def __init__(self, accept='text/x-bibliography; style=apa', timeout=3):
"""
import pymorphy2
import re
import nltk
from nltk.tokenize import word_tokenize
nltk.download('punkt')
one_letter_correspondences = {
'А': 'A',
'Б': 'B',
@dobrosketchkun
dobrosketchkun / another_frame_catch.py
Last active November 17, 2023 09:18
timelapse from ip web camera
import cv2
import urllib.request
import numpy as np
import ssl
import time
from datetime import datetime
COUNTER = 0
ctx = ssl.create_default_context()
@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
@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