Skip to content

Instantly share code, notes, and snippets.

View md-farhan-memon's full-sized avatar
🎯
Focusing

Md. Farhan Memon md-farhan-memon

🎯
Focusing
View GitHub Profile
@md-farhan-memon
md-farhan-memon / telegram_read_and_publish.py
Last active March 18, 2023 22:36
Script to listen to Telegram messages as a user, filter by keywords and push it to slack or do whatever you need. Using Telethon.
from telethon import TelegramClient, events, sync
import re, requests
# Remember to use your own values from my.telegram.org!
api_id = '...'
api_hash = '...'
username = '...'
channel_name = '...'
slack_webhook_url = '...'
client = TelegramClient(username, api_id, api_hash)
@md-farhan-memon
md-farhan-memon / bulk_add_heroku_config_variables.sh
Created October 18, 2019 21:36
Bash script to add multiple config variables to the heroku app in one step.
#!/usr/bin/env bash
# Adding some colors to the output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Help text
@md-farhan-memon
md-farhan-memon / video_embed_url_generator.rb
Last active September 3, 2020 17:17 — forked from niquepa/gist:4c59b7d52a15dde2367a
Ruby/Rails generate YouTube or Vimeo embed video ifram from url
class VideoEmbedUrlGenerator
REGEX_ID = %r{(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/|vimeo\.com\/)([a-zA-Z0-9_-]{8,11})}.freeze
REGEX_PROVIDER = /(youtube|youtu\.be|vimeo)/.freeze
def initialize(url)
@url = url
end
def construct_iframe
'<iframe '\