Skip to content

Instantly share code, notes, and snippets.

View PyBagheri's full-sized avatar

MohammadHossein Bagheri PyBagheri

  • Iran
View GitHub Profile
@PyBagheri
PyBagheri / BOT.py
Created September 30, 2017 14:03
Simple Autp learning Chat Bot
from telegram.ext import Updater, MessageHandler, Filters
import sqlite3
import random
import difflib
u = Updater('Your token here...')
d = u.dispatcher
connection = sqlite3.connect('myDatabase.db', check_same_thread=False)
connection.execute('CREATE TABLE IF NOT EXISTS myTbl(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, QUES TEXT NOT NULL, ANSW TEXT NOT NULL)')
from telegram.ext import Updater, MessageHandler, Filters
import sqlite3
import random
import difflib
u = Updater('you token here...')
d = u.dispatcher
connection = sqlite3.connect('myDatabase.db', check_same_thread=False)
connection.execute('CREATE TABLE IF NOT EXISTS myTbl(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, QUES TEXT NOT NULL, ANSW TEXT NOT NULL)')
@PyBagheri
PyBagheri / dijkstra.py
Last active October 18, 2022 16:13
Dijkstra Algorithm on Directed Graphs using Python
# Author: Mohammadhossein Bagheri (@PyBagheri)
# License: MIT
import math
class Dijkstra:
def __init__(self, graph, start_vertex):
self.graph = graph;
self.start_vertex = start_vertex
self.vertices = list(graph.keys())
@PyBagheri
PyBagheri / conway.cpp
Last active May 21, 2021 06:57
John Conway's Game of life simulation with C++
// By MohammadHossein Bagheri KheirAbadi (@PyBagheri)
// Initialize `board` variable with desired values and run.
#include <stdio.h>
#include <iostream>
#include <vector>
#include <chrono>
#include <thread>
using namespace std;