Skip to content

Instantly share code, notes, and snippets.

View Blucknote's full-sized avatar

Evgeniy Blucknote

  • Russia
  • 04:39 (UTC +03:00)
View GitHub Profile
@Blucknote
Blucknote / kandinskyTXT2IMG.py
Last active May 15, 2023 15:06
Sber Kandinsky runner
check revision or visit https://github.com/Blucknote/Kandinsky-advanced-notebooks
@Blucknote
Blucknote / scratch.py
Created April 26, 2021 13:24
markov chain?
import random
class Dictogram(dict):
def __init__(self, iterable=None):
# Инициализируем наше распределение как новый объект класса,
# добавляем имеющиеся элементы
super(Dictogram, self).__init__()
self.types = 0 # число уникальных ключей в распределении
self.tokens = 0 # общее количество всех слов в распределении
@Blucknote
Blucknote / gist:813ec1fdc579f45535e8ec12bbd0cc62
Last active June 26, 2020 14:25 — forked from hannu/gist:4604611
Filter your own commit messages from git log and group by day. (Modified from http://stackoverflow.com/questions/2976665/git-changelog-day-by-day)
#!/bin/bash
AUTHOR=$(git config user.name)
DATE=$(date +%F)
git log --format="%cd" --date=short --no-merges --author="$AUTHOR" --all --after="2020-06-14" --until="2020-06-20" | sort -u -r | while read DATE ; do
if [ $NEXT != "" ]
then
echo
echo [$NEXT]
fi
GIT_PAGER=cat git log --no-merges --format=" %s" --since=$DATE --until=$NEXT --author="$AUTHOR" --all
@Blucknote
Blucknote / deffered img load.js
Last active June 10, 2020 10:52
self descripted name
const lazyLoad = function() {
let lazyImages = $("img.lazy:visible");
setTimeout(function() {
$.each(
lazyImages,
function() {
let lazyImage = $(this)[0];
if ((lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") {
lazyImage.src = lazyImage.dataset.src;
@Blucknote
Blucknote / xakep-dl.js
Created March 2, 2020 07:18
download xakep magazine from page
jQuery.each(
jQuery('a.download-button'),
function () {
var win = window.open(
jQuery(this).attr('href'),
'_blank'
);
win.focus();
}
)
@Blucknote
Blucknote / hb_all_book_bundle_dl.js
Last active January 12, 2020 15:54 — forked from kfatehi/hb_all_books_dl.js
Humble bundle book bundles - download all books per bundle at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(MOBI|EPUB|PDF)$/i;
@Blucknote
Blucknote / plural.py
Last active August 26, 2019 12:33 — forked from CubexX/plural.py
Python abstract plural
def pluralize(n, lst):
if n % 10 == 1 and n % 100 != 11:
p = 0
elif 2 <= n % 10 <= 4 and (n % 100 < 10 or n % 100 >= 20):
p = 1
else:
p = 2
return '{} {}'.format(str(n), lst[p])
@Blucknote
Blucknote / VKDE.js
Last active July 15, 2021 14:05
Vkontacte Documets Eraser
lst = document.getElementsByClassName('docs_delete_row')
for (var i=0;i<lst.length; i++) {
lst[i].click();
}
@Blucknote
Blucknote / scrollTo.js
Created June 25, 2019 06:29
jquery scroll to elemant
$('html, body').animate({scrollTop: $(selector).offset().top}, 300);
@Blucknote
Blucknote / block_input.js
Created June 25, 2019 06:25
javascript block input
$(selector).keydown(function (e) {
if (e.keyCode === 13) {
// code
}
if (!/[0-9]/.test(e.key) || $(this).val().length >= 4) {
if (
e.keyCode != 8 &&
e.keyCode != 46 &&
e.keyCode != 36 &&
e.keyCode != 35 &&