This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
t.me/danokhlopkov | |
x.com/danokhlopkov | |
github.com/danokhlopkov | |
Strategy: | |
1. get chats / groups you're in | |
2. iterate over participants and find ones with stories | |
3. watch them |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"username" | |
"aussiegrit" | |
"mfbeltrones" | |
"buffalobills" | |
"aeexpo" | |
"puma" | |
"indiatoday" | |
"ystk_yrk" | |
"franco_esca" | |
"houstontexans" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dokku postgres:export DB | gzip -9 > DB.sql.gz | |
docker pull postgis/postgis:latest | |
export POSTGRES_IMAGE="postgis/postgis" | |
export POSTGRES_IMAGE_VERSION="latest" | |
dokku postgres:create DB | |
gunzip DB.sql.gz | dokku postgres:import DB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
AMPLITUDE_API_KEY = "your-secret-amplitude-key" | |
AMPLITUDE_ENDPOINT = "https://api.amplitude.com/2/httpapi" | |
amp_event = { | |
"user_id": 123123123, # unique user identifier | |
"event_type": event_name, # the name of event | |
"platform": 'Telegram', # useless if you have only Telegram users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AIRFLOW__SMTP__SMTP_HOST=smtp.gmail.com | |
AIRFLOW__SMTP__SMTP_SSL=true | |
AIRFLOW__SMTP__SMTP_PORT=465 | |
AIRFLOW__SMTP__SMTP_USER= | |
AIRFLOW__SMTP__SMTP_PASSWORD= | |
AIRFLOW__SMTP__SMTP_MAIL_FROM= | |
# more env vars: https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#smtp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Want to join your data based on URLs (links)? | |
# You need to convert all urls to one format. | |
# E.g. remove www., remove https://, remove url params | |
# This is how I do it: | |
def prettify(url): | |
if not url or not isinstance(url, str): | |
return None # not sure that this is the best approach | |
url = url.lower().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Dokku app | |
dokku apps:create metabase | |
# Pull Metabase instance from Docker | |
docker pull metabase/metabase | |
# Create and link production Postgres | |
dokku postgres:create metabase | |
dokku postgres:link metabase metabase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you migrated from default H2 db to production-ready (like Postgres) | |
# because otherwise you'll loose data (dashboards, graphs, users) | |
docker pull metabase/metabase:latest | |
docker tag metabase/metabase:latest dokku/lu-metabase:latest | |
dokku tags:deploy lu-metabase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COUNTRY_3_EMOJI_DICT = { | |
"IND": "🇮🇳", | |
"NGA": "🇳🇬", | |
"KEN": "🇰🇪", | |
"ITA": "🇮🇹", | |
"USA": "🇺🇸", | |
"CUB": "🇨🇺", | |
"GBR": "🇬🇧", | |
"ZAF": "🇿🇦", | |
"POL": "🇵🇱", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv, io | |
test_data = [[1, 2, 3], ["please", "follow", "me"]] | |
# csv module can write data in io.StringIO buffer only | |
s = io.StringIO() | |
csv.writer(s).writerows(test_data) | |
s.seek(0) | |
# python-telegram-bot library can send files only from io.BytesIO buffer |
NewerOlder