Skip to content

Instantly share code, notes, and snippets.

View kostyakoz's full-sized avatar
🏠
Working from home

Kostya kostyakoz

🏠
Working from home
View GitHub Profile
{
"event": "message",
"session": "default",
"me": {
"id": "79050199522@c.us",
"pushName": "Smartdiag"
},
"payload": {
"id": "false_79270220038@c.us_244D2FFE3C40ACA6B77F5A56EDC457B9",
"timestamp": 1706083237,
# run in "root" folder (e.g /home/datmusic/api.datmusic.xyz/)
chown -R kostya:www-data storage .env
find storage -type f -exec chmod 664 {} \;
find storage -type d -exec chmod 775 {} \;
chgrp -R www-data storage .env
chmod -R ug+rwx storage .env
def choose_payment_method_keyboard(uid, premium_type, lang):
"""Клавиатура для выбора способа оплаты.
:param premium_type: срок оплаты подписки
"""
data = {
'receiver': 410013085383235,
'successURL': 'https://telegram.me/pstrbot',
'formcomment': 'PosterBot',
'short-dest': 'PosterBot Premium ({n} {m})'.format(
n=config.PREMIUM_TYPES[premium_type]['months'],
import telebot
bot = telebot.TeleBot('TOKEN')
@bot.message_handler(commands=['start'])
def start(m):
msg = bot.send_message(m.chat.id, 'Как тебя зовут?') # сохраняем данные сообщения в msg
bot.register_next_step_handler(msg, hello) # переводим пользователя в функцию hello
def hello(m):
@kostyakoz
kostyakoz / bot.py
Created January 7, 2017 18:01
Telegram Bot for books reading
import telebot
from telebot import types
TOKEN = ''
bot = telebot.TeleBot(TOKEN)
with open('./SH.txt', 'r') as file:
BOOK = file.read() # открываем книгу и записываем её в BOOK
def pages_keyboard(start, stop):
@kostyakoz
kostyakoz / Matrix Line.cpp
Created March 5, 2015 10:21
Matrix Linear
// Matrix Line.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <Windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char const *argv[]) {
srand(time(0));
int n, m;
cout << "Input n (str num) and m (col num): ";
cin >> n;
@kostyakoz
kostyakoz / gist:8335f480247c9d94ce61
Last active August 29, 2015 14:04
Меню в Anchor
<!-- Меню в Anchor -->
<?php if(has_menu_items()): /*проверяет, если пункты меню*/ ?>
<ul>
<?php while(menu_items()): /*выводит один пункт меню (ссылку)*/ ?>
<li <?php echo (menu_active() ? 'class="active"' : ''); /*если ссылка активна, добавляется class="active"*/ ?>>
<a href="<?php echo menu_url(); /*url адрес*/ ?>" title="<?php echo menu_title(); /*заголовок*/ ?>">
<?php echo menu_name(); /*название*/ ?>
</a>
</li>
@kostyakoz
kostyakoz / anchor.php
Last active December 20, 2015 19:18 — forked from Abban/anchor.php
Перевод на русский
<?php
// В файле anchor/libraries/anchor.php меняем строки 50 - 65 с:
public static function functions() {
if( ! is_admin()) {
$fi = new FilesystemIterator(APP . 'functions', FilesystemIterator::SKIP_DOTS);
foreach($fi as $file) {
if($file->isFile() and $file->isReadable() and '.' . $file->getExtension() == EXT) {
<?php $years = array(); $months = array(); ?>
<?php if(has_posts()): while(posts()): ?>
<?php $y = date('Y', article_time()); $m = date('F', article_time()); ?>
<?php if( ! in_array($y, $years)): $years[] = $y; ?>
<h1><?php echo $y; ?></h1>
<?php endif; ?>