Skip to content

Instantly share code, notes, and snippets.

View leandrotoledo's full-sized avatar

Leandro Toledo leandrotoledo

  • Google
  • Reston, VA
View GitHub Profile
@leandrotoledo
leandrotoledo / echobot.py using Cloud Functions.md
Last active March 23, 2024 18:17
Creating a simple Echo Telegram Bot using Google Cloud Functions in 5 minutes
Requirements:
  • Google Cloud Platform with Billing enabled.
  • Bot created using the @BotFather on Telegram.
  • Bot Token issued by the @BotFather.
2) On the Navigation Menu, go to Cloud Functions.
3) Click on Create Function.
server {
listen 80;
server_name _;
server_name_in_redirect off;
location ~ ^/~(.+?)(/.*)?$ {
alias /home/$1/public_html$2;
autoindex on;
}

Keybase proof

I hereby claim:

  • I am leandrotoledo on github.
  • I am leandrotoledo (https://keybase.io/leandrotoledo) on keybase.
  • I have a public key whose fingerprint is A4D4 1D6C 70CF 394E 6EE2 A281 F20F 4B10 1AE4 197C

To claim this, I am signing this object:

import logging
import telegram
from telegram import ReplyKeyboardMarkup, KeyboardButton
from telegram.ext import Updater, CommandHandler, MessageHandler, filters
# Enable logging
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
@leandrotoledo
leandrotoledo / main.py
Last active February 2, 2024 00:08
Webhook using self-signed certificate and Flask (with python-telegram-bot library)
#!/usr/bin/env python
'''Using Webhook and self-signed certificate'''
# This file is an annotated example of a webhook based bot for
# telegram. It does not do anything useful, other than provide a quick
# template for whipping up a testbot. Basically, fill in the CONFIG
# section and run it.
# Dependencies (use pip to install them):
# - python-telegram-bot: https://github.com/leandrotoledo/python-telegram-bot
import telegram
__author__ = 'mehrdad'
def handleTgMessage(tgBot,tgMessage,tgChatID,tgUpdateID):
"""do something with message"""
tgBot.sendMessage(chat_id=tgChatID, text=tgMessage)
@leandrotoledo
leandrotoledo / main.py
Last active August 29, 2015 14:27
python-telegram-bot using Redis/RQ
import telegram
import time
from rq import Queue
from redis import Redis
from handleMessage import handleTgMessage
__author__ = 'mehrdad vesal'
_botToken='<TOKEN>'
_raziBot=telegram.Bot(token=_botToken)
@leandrotoledo
leandrotoledo / debian-squeeze-to-wheezy
Last active December 16, 2015 00:09
Upgrades old-stable Debian (squeeze) for new stable Debian (wheezy)
If you have a simple installation, in other words, a basic installation without self-compiled programs or a complicated setup, you just need to follow three steps:
1) Change squeeze to wheezy in source.list
# vi /etc/apt/source.list
:%s/squeeze/wheezy/g
:wq!
2) Update new repository
# aptitude update
@leandrotoledo
leandrotoledo / xorg.conf
Created February 15, 2013 01:49
Intel /etc/X11/xorg.conf
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
Screen 2 "Screen2" RightOf "Screen1"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
@leandrotoledo
leandrotoledo / css-issue-steam
Created February 15, 2013 01:47
CS:S - Black screen with Intel driver issue
Processor Information:
Vendor: GenuineIntel
Speed: 2534 Mhz
4 logical processors
2 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported