Skip to content

Instantly share code, notes, and snippets.

View MasterGroosha's full-sized avatar

Aleksandr MasterGroosha

View GitHub Profile
@MasterGroosha
MasterGroosha / 01_request_quiz.py
Last active February 16, 2020 21:30
Куски кода к уроку 13 моего учебника по ботам для Telegram.
# Хэндлер на команду /start
@dp.message_handler(commands=["start"])
async def cmd_start(message: types.Message):
poll_keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
poll_keyboard.add(types.KeyboardButton(text="Создать викторину",
request_poll=types.KeyboardButtonPollType(type=types.PollType.QUIZ)))
poll_keyboard.add(types.KeyboardButton(text="Отмена"))
await message.answer("Нажмите на кнопку ниже и создайте викторину!", reply_markup=poll_keyboard)
# Хэндлер на текстовое сообщение с текстом “Отмена”
#!/bin/bash
PYVERSION="3.8.2"
if [[ $EUID -ne 0 ]]; then
sudo apt install -y gcc build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
else
apt install -y gcc build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
@MasterGroosha
MasterGroosha / discount_vs_points.py
Last active January 16, 2020 18:45
Что выгоднее: постоянная скидка или накопление и трата баллов?
from random import choice, shuffle, seed
from os import urandom
prices = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
def prepare_data_shuffle():
"""
:return: Возвращает исходный массив prices, но перемешанный
#include <experimental/filesystem>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
namespace fs = std::experimental::filesystem;
@MasterGroosha
MasterGroosha / renamer.go
Created July 25, 2019 16:34
Test go files renamer with padding
package main
import (
"fmt"
"os"
"path/filepath"
)
const (
DirPath = "D:\\test"
# -*- coding: utf-8 -*-
row1 = ["a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"]
row2 = ["b1", "b2", "b3", "b4", "b5"]
row3 = ["c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c12", "c13", "c14"]
rows = [row1, row2, row3]
max_size = -1
number = 0
package main
import (
"bytes"
"compress/zlib"
"encoding/binary"
"fmt"
//"io"
"io/ioutil"
//"os"
@MasterGroosha
MasterGroosha / return_filters_scrollbar.user.js
Created May 14, 2019 10:46
Returns missing filters scrollbar to pixelfed.social on Google Chrome
// ==UserScript==
// @name Return filters scrollbar to pixelfed.social
// @namespace https://pixelfed.social/
// @version 1.0
// @description Return filters scrollbar to pixelfed.social
// @author MasterGroosha
// @match https://pixelfed.social/
// @grant GM_addStyle
// ==/UserScript==

Keybase proof

I hereby claim:

  • I am MasterGroosha on github.
  • I am groosha (https://keybase.io/groosha) on keybase.
  • I have a public key whose fingerprint is 4209 7F5C 23F1 D8E3 C60F 3644 8948 02DE 0BEB 3789

To claim this, I am signing this object:

swagger: '2.0'
info:
description: Pistache test
version: 0.0.1
title: Pistache-Test
host: '127.0.0.1:8081'
tags:
- name: echo
description: Check service status
- name: calc