Skip to content

Instantly share code, notes, and snippets.

View vdmit's full-sized avatar

Dmitry Veltishchev vdmit

  • Yandex LLC
  • Russia, Moscow
View GitHub Profile
@vdmit
vdmit / cssutils_busy_loop_bug.py
Created November 2, 2021 21:02
cssutils busy loop example
#!/usr/bin/env python3
import cssutils
css_parser = cssutils.CSSParser(validate=False)
# cssutils.log.setLevel(logging.FATAL)
css_text = '\'\'\':before{content:"\\f175"}.s1{content:"\\f178"}.s2:before{content:"\\f179"}.s3:before{content:"\\f17a"}.s4:before{content:"\\f17b"}.s5:before{content:"\\f17c"}.s6:before{content:"\\f17d"}.s7:before{content:"\\f17e"}.s8:before{content:"\\f180"}.s9:before{content:"\\f181"}.s10:before{content:"\\f182"}.s11:before{content:"\\f183"}'
sheet = css_parser.parseString(cssText=css_text)
css_urls = cssutils.getUrls(sheet)
print(list(css_urls))
#!/usr/bin/env python3
import json
import random
with open("jq-test-input.json", "w") as fd:
obj = {"key_one": random.random(), "key_two": random.random(), "key_three": random.random()}
fd.write("[\n")
for x in range(10*1000*1000):
if x != 0:
@vdmit
vdmit / history_message.cpp.diff
Last active June 17, 2017 10:57
Dirty patch to disable Telegram web page preview
diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp
index a318520..45ca737 100644
--- a/Telegram/SourceFiles/history/history_message.cpp
+++ b/Telegram/SourceFiles/history/history_message.cpp
@@ -709,6 +709,7 @@ void HistoryMessage::initMedia(const MTPMessageMedia *media) {
}
} break;
case mtpc_messageMediaWebPage: {
+ break; // nopreview fix
auto &d = media->c_messageMediaWebPage().vwebpage;