Skip to content

Instantly share code, notes, and snippets.

View d-Rickyy-b's full-sized avatar
💻
Hack the planet

Rico d-Rickyy-b

💻
Hack the planet
View GitHub Profile
@d-Rickyy-b
d-Rickyy-b / test_timeout.py
Created March 15, 2018 17:36
Code for checking out the timeout of answerCallbackQuery of the Telegram bot API. After ~15 seconds you get the Telegram error QUERY_ID_INVALID
import logging
import time
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.error import BadRequest
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
BOT_TOKEN = "<BOT_TOKEN>"
logger = logging.getLogger(__name__)
@d-Rickyy-b
d-Rickyy-b / config.py
Created March 4, 2018 20:15
Sample configuration file for Python-GuardianBot
BOT_TOKEN = "1234567890:ABCDEFGHIJKLMNOPQRSTUVW123456"
admin_channel_id = -999999999999
admins = [987654321, 123456789]
chats = [-1111111111111]
# Allowed chats for AllowedChatsFilter
whitelisted_chats = [-999999999999, -888888888888]
# Allowed channels for ChannelForwardFilter
@d-Rickyy-b
d-Rickyy-b / main.py
Last active May 27, 2022 11:05
Introduction to bot programming
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=W0613, C0116
# type: ignore[union-attr]
# This program is dedicated to the public domain under the CC0 license.
# Source: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot.py
"""
Simple Bot to reply to Telegram messages.
@d-Rickyy-b
d-Rickyy-b / DateSwitcher.ps1
Created November 13, 2017 15:40
A simple script for changing the creation date and the modify date of files of a folder
# This script switches the file "creation time" with the file "last modified" time
# Scripted by d_Rickyy_b on 11.09.2017
# Telegram: https://t.me/d_Rickyy_b
# Usage: scriptName.ps1 [-path] C:\path\to\folder [-filter] "*.txt"
# Both parameters are optional!
param (
[string]$path = $PSScriptRoot,
[string]$filter = "*"
)
@d-Rickyy-b
d-Rickyy-b / rgb_to_hsi.py
Created November 8, 2017 08:46
RGB to HSI
# Script to convert RGB to HSI
import math
def rgb_to_hsi(R, G, B):
def get_H():
if B < G:
return get_c()
else:
return 360 - get_c()