Skip to content

Instantly share code, notes, and snippets.

View Blucknote's full-sized avatar

Evgeniy Blucknote

  • Russia
  • 14:22 (UTC +03:00)
View GitHub Profile
@Blucknote
Blucknote / randomize.py
Last active September 24, 2020 11:58
dummy random letters
from random import choice
STR_LEN = 10
randomize = lambda: ''.join([chr(choice(range(97, 123))) for y in range(STR_LEN+1)])
@Blucknote
Blucknote / trans to _ .rex
Created April 3, 2019 14:55
replace django {% trans '' %} to jinja {{_('')}}
\{%\s?trans\s(.+)\s?%\}
{{ _($1) }}
@Blucknote
Blucknote / static_url.rex
Last active July 16, 2019 13:59
static replacer from django to jinja templates
STATIC_URL\s?\}\}(.+)"
static('$1')" }}
@Blucknote
Blucknote / detitle.sh
Last active June 25, 2019 06:26
remove title from svg
find -name *.svg -exec sed -i 's=<title>.*<\/title>==g' '{}' \;
@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 &&
@Blucknote
Blucknote / scrollTo.js
Created June 25, 2019 06:29
jquery scroll to elemant
$('html, body').animate({scrollTop: $(selector).offset().top}, 300);
@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 / 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 / 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 / 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();
}
)