Skip to content

Instantly share code, notes, and snippets.

View iliakonnov's full-sized avatar
🦕

Ilia Konnov iliakonnov

🦕
View GitHub Profile
$ inxi
CPU~Quad core AMD Athlon X4 750K (-MCP-) speed/max~1400/3400 MHz Kernel~4.4.0-24-generic x86_64 Up~9:05 Mem~2784.2/7927.0MB HDD~3000.6GB(19.5% used) Procs~215 Client~Shell inxi~2.2.35
$ python test.py
Average:
For loop: 0.000379131793976
Operator: 0.000367625951767
Lambda 1: 0.000438968896866
Lambda 2: 0.000436615228653
Numpy array 1: 5.86407184601e-05
Numpy array 2: 5.91254234314e-06
@iliakonnov
iliakonnov / notoken.py
Last active December 28, 2016 13:41
pyTelegramBotApi test
import telebot
bot = telebot.TeleBot("TOKEN") # This token is not valid, you should obtain your token from @BotFather bot (https://core.telegram.org/bots#botfather)
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Howdy, how are you doing?")
@bot.message_handler(func=lambda message: True)
def echo_all(message):
#!/usr/bin/python3
# -*- coding:utf8 -*-
from os import path
import lxml.html
import requests
output = "razumovskaja_8_klass"
url = "https://megaresheba.ru/publ/reshebnik/russkomu_jazyku/razumovskaja_8_klass/35-1-0-1217/{task}"
userAgent_header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'}
'''
https://projecteuler.net/problem=4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
'''
from time import time
n = 0
start = time()
DELAY = 1000
for a in range(9, 0, -1):
@iliakonnov
iliakonnov / log.log
Created July 31, 2017 07:35
cookies.txt error
Failed to load resource: net::ERR_FILE_NOT_FOUND
popup.html:1 Error in response to cookies.getAll: InvalidCharacterError: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
at Object.a [as callback] (chrome-extension://njabckikapfpffapmjgojcnbfjonfjfg/scripts/popup.js:4:30972)
at Object.callback (chrome-extension://njabckikapfpffapmjgojcnbfjonfjfg/scripts/popup.js:4:32382)
# https://oauth.vk.com/authorize?client_id=6263031&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=photos,messages,offline,docs&response_type=token
vkToken = токен вконтакте
userId = айди пользователя вк # ID бота
@iliakonnov
iliakonnov / monitor.zsh
Created January 1, 2019 17:11
Simple zsh function to run command every second
monitor() {
heading_template='\[$(date +%T)\] '
heading_length=11 # "[HH:MM:SS] "=11
#$(echo -n '{CMD}' | cut -c -$(( $COLUMNS - {heading_length} )) )
heading_template+="\$( echo -n '$@' | cut -c -\$(( \$COLUMNS - $heading_length )) )"
heading=$(eval echo -n $heading_template)
output=$(eval $@ 2>&1)
while true; do
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
import matplotlib.lines as mlines
fig, ax = plt.subplots()
plt.subplots_adjust(bottom=0.60)
plt.grid(True)
MIN = -10
@iliakonnov
iliakonnov / copy.py
Last active March 4, 2019 07:39
Simple and fast python copier with continue feature and progressbar.
from sys import argv
from hashlib import md5
import time
import shutil
import os
import sqlite3
import progressbar # https://pypi.org/project/progressbar2/3.18.1/
def download(fromDir, toDir, copyId):
/**
* Collision box object.
* @param {number} x X position.
* @param {number} y Y Position.
* @param {number} w Width.
* @param {number} h Height.
*/
function CollisionBox(x, y, w, h) {
this.x = x;
this.y = y;