Skip to content

Instantly share code, notes, and snippets.

@leotop
leotop / wikipedia-infoboxes-in-pandas.ipynb
Created March 10, 2018 17:08 — forked from aculich/wikipedia-infoboxes-in-pandas.ipynb
How to extract Wikipedia infoboxes and wikitables using Pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
http://labelauty.js.org/
https://lokesh-coder.github.io/pretty-checkbox/
https://github.com/fronteed/iCheck
https://github.com/jaywcjlove/magic-input
http://abpetkov.github.io/switchery/
https://github.com/zhiyul/switch
https://github.com/kleinejan/titatoggle/
https://720kb.github.io/checkbox.css/
https://tech.yandex.ru/bem/
https://tech.yandex.ru/translate/
https://tech.yandex.ru/mystem/
https://tech.yandex.ru/tomita/
https://tech.yandex.ru/speller/
https://tech.yandex.ru/clickhouse/
https://tech.yandex.ru/elliptics/
https://tech.yandex.ru/webmaster/
https://tech.yandex.ru/validator/
https://tech.yandex.ru/xml/
@leotop
leotop / content.modx
Created January 31, 2018 07:33
Плагин MODX Revo. Событие OnWebPagePrerender. Конструкция {% verbatim %}{% endverbatim %}. для отмены обработки любых тегов, синтаксис django
Обычный вызов чанка [[!code]]<hr>
{% verbatim %}Имитация вызова чанка [[!code]]
{% endverbatim %}
{% verbatim %}Имитация 2 вызова чанка [[!code2]]
{% endverbatim %}
@leotop
leotop / content_to_eval.php
Last active January 31, 2018 07:26
Обработка тегов {php}{/php}, аналог из шаблонизатора smarty. Особенность, т.к. всегда выполняется как код в контексте основного, то данные в строку передаем через $php_val внутри eval
<?php
// НЕ ИСПОЛЬЗОВАТЬ НА РАБОЧЕМ САЙТЕ
// Плагин сделан с целью изучения
function replace_php_tags($matches){
//$res = $modx->getObject('modResource',1); // Внутри функции вызов не работает, причина пока не известна
$code = $matches[1];
eval($code);
return $php_val;
}
@leotop
leotop / test.php
Created January 28, 2018 21:29
Пример работы с гео данными https://github.com/maxmind/GeoIP2-php
<?php
require_once 'vendor/autoload.php';
use GeoIp2\Database\Reader;
// This creates the Reader object, which should be reused across
// lookups.
$reader = new Reader('GeoLite2-City.mmdb');
// Replace "city" with the appropriate method for your database, e.g.,
// "country".
from PIL import Image, ImageEnhance
import os
from os.path import join
def start():
batch("img_source_dir", "img_result_dir", "watermark.png")
def batch(infolder, outfolder, watermark):
@leotop
leotop / EscPreCode.php
Last active January 28, 2018 18:17
MODX плагин, на событие OnLoadWebDocument. Преобразует теги MODX и экранирует html символы внутри конструкции <pre><code> </code></pre>
<?php
function replace_modxtags($matches){
$code_entities_match = array('[', ']','{', '}', '!', '`', '*', '~');
$code_entities_replace = array('&#91;','&#93;','&#123;','&#125;', '&#033;', '&#96;', '&#42;', '&#126;');
$code = str_replace(
$code_entities_match,
$code_entities_replace,
htmlentities($matches[1], ENT_QUOTES)
);
@leotop
leotop / example.html
Created January 21, 2018 18:42
т.к. не было понятно какое будет value, то был использован индекс для определения изменения поля в списке. Индекс начинается с 0, поэтому последний элемент 4, а не 5
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
</META></HEAD><body>
<style>#hidden_fields{display: none;}</style>
<select class="putName fr" name="ugolnaklona" id="ugolnaklona" onchange="showFields()" required >
<option value="" selected="" disabled="">Просеивающие поверхности</option>
<option value="Сыпучий груз">Решетка колосниковая сварная</option>
from PIL import Image, ImageEnhance
import os
from os.path import join
def test():
batch("img", "t", "watermark.png")
def batch(infolder, outfolder, watermark):
mark = Image.open(watermark)
for root, dirs, files in os.walk(infolder):