This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"path/filepath" | |
) | |
const ( | |
DirPath = "D:\\test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <experimental/filesystem> | |
#include <iostream> | |
#include <string> | |
#include <sstream> | |
#include <iomanip> | |
using namespace std; | |
namespace fs = std::experimental::filesystem; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, но перемешанный |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Хэндлер на команду /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) | |
# Хэндлер на текстовое сообщение с текстом “Отмена” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a list of your own shortcuts for Telegram Desktop | |
// You can see full list of commands in the 'shortcuts-default.json' file | |
// Place a null value instead of a command string to switch the shortcut off | |
[ | |
// The two commands below are "inactive" | |
// { | |
// "command": "close_telegram", | |
// "keys": "ctrl+f4" | |
// }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a piece of code how Commit and Revert (reset) are called | |
// m_Git is a TGitClient instance | |
void main() { | |
const auto commitMessage = "Some commit message"; | |
std::string commitError; | |
if(!m_Git.MakeCommitToRepo(commitError, commitMessage)) { | |
std::cout << "MakeCommit returned error: " << commitError << std::endl; | |
} | |
std::cout << "Commited\n"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Здесь будут куски кода к 14-му уроку моего учебника |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Dict, List, Set | |
from aiogram import types | |
from aiogram.dispatcher.handler import CancelHandler | |
from aiogram.dispatcher.middlewares import BaseMiddleware | |
from loguru import logger | |
class WhitelistMiddleware(BaseMiddleware): | |
def __init__(self, users: Set[int]): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Telegram-казино | |
# Этот код позволяет понять, какие именно значения выпали в дайсе "казино" по тому, что вернул Bot API | |
# Авторы: @Groosha, @svinerus | 2020 год | |
### | |
from typing import List | |
# 0 1 2 3 | |
casino = ["BAR", "виноград", "лимон", "семь"] |