Skip to content

Instantly share code, notes, and snippets.

View stranger777's full-sized avatar

Ivan Novikov stranger777

View GitHub Profile
import os
from flask import Flask, request, Response
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
@stranger777
stranger777 / HabrOldFraftGeneratorWithTampermonkey.js
Last active May 17, 2024 11:24
Habr Old Draft Generator. Tampermonkey
// ==UserScript==
// @name Habr Old Draft Generator
// @version 0.1
// @description Autofills a text field with the provided text if it's empty. Generate a draft for the Habr.
// @author Novikov Ivan
// @match https://habr.com/ru/topic/add/*
// @match https://habr.com/ru/article/edit/*/
// @namespace https://habr.com/
// @grant none
// @run-at
1953282128707757731632014947596256332443542996591873396953405194571625257887015694766641987634150146128879524335220236084625510912019560233744015438115196636156919962125642894303370113827800638002767411527927466669865578379318822832061271497583230334854893489572599230722912901928209264331627521730861460017912582042699659936020959339202005184862028402447343139811367418720203868480175318538621112878108240617741383293554561687606454065125954718029126547942894036981659206361019359291352135410376799082940320155702716115395031975973247782162957631629653356694777663285062345245593460647575025935813443457816767646258788590113727299073729478511448089572456191503507025589529116868550008802013233458747217794781447546792016090170642585629359747546532757575740077432034913428785189795354304734560307765078938767286539166799232817449361991523768149557632085371047859706188438731530582395627560879063107819004975169594709736713891745704555202135123350794403360712030504144685221041565037321067932275625864751191461141736034968121
from PIL import Image, ImageDraw
images = []
a = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0 ,0, 0, 0, 1, 0, 1, 1, 1, 1],
[1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0 ,0, 0, 0, 1, 0, 0, 0, 0, 0],
@stranger777
stranger777 / bitrix_installer_fragment.php
Last active August 29, 2018 15:42
PHP code example
<?php
interface iUserLocaleInstallerSettings
{
public function getInstallationSiteURL();
}
class RussianInstallation implements iUserLocaleInstallerSettings
{
public function getInstallationSiteURL()
@stranger777
stranger777 / nginx_centos68_src_installation.sh
Last active December 6, 2016 14:41
Install nginx from sources on CentOS 6.8
#!/bin/bash
set -x
getfilenamebypath () {
echo "$1" | gawk -F/ '{print $NF}'
}
getpathbyfilename () {
local fullpath; fullpath="$1"
@stranger777
stranger777 / datediff.sh
Last active August 21, 2024 14:58
Simplest calculator two dates difference. By default in days
#!/bin/bash
#Simplest calculator two dates difference. By default in days
# Usage:
# ./datediff.sh first_date second_date [-(s|m|h|d) | --(seconds|minutes|hours|days)]
first_date=$(date -d "$1" "+%s")
second_date=$(date -d "$2" "+%s")
case "$3" in