Skip to content

Instantly share code, notes, and snippets.

View vlad-ds's full-sized avatar

Vlad Gheorghe vlad-ds

View GitHub Profile
-- data for 1 day: 479 MB scanned
SELECT *
FROM `bigquery-public-data.google_trends.international_top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY);
-- data for 2 days: 955 MB scanned
SELECT *
FROM `bigquery-public-data.google_trends.international_top_terms`
WHERE refresh_date > DATE_SUB(CURRENT_DATE, INTERVAL 3 DAY);
@vlad-ds
vlad-ds / knowledge_compound_growth.ipynb
Created June 16, 2022 19:12
knowledge_compound_growth.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vlad-ds
vlad-ds / deploy_telegram_aws.md
Last active July 21, 2024 01:46
How to deploy a Telegram bot on AWS EC2

Remote setup (AWS EC2)

If you run your Telegram bot locally, it will stop working when you close the terminal. The alternative is to host the bot somewhere.

There are many ways to do this. I chose AWS EC2 as it's a cheap and easy option.

Create an AWS account and start an EC2 instance. Install pip, git and github cli. If you use an Amazon Linux image (which is what the free tier offers) you can run the commands in this gist.

Connect to your GitHub account with gh auth login and clone this repo. Create the .env

@vlad-ds
vlad-ds / ec2_start.sh
Created August 1, 2023 07:43
Initial setup for EC2 Amazon Linux Image (for hosting telegram bots & other use cases)
#!/bin/bash
# install requirements
sudo yum update -y
sudo yum install -y python3-devel
sudo yum install -y python3-pip
sudo yum install -y git
# install github cli
type -p yum-config-manager >/dev/null || sudo yum install yum-utils
@vlad-ds
vlad-ds / MainActivity.kt
Created August 3, 2023 10:15
Android: Bluetooth Device App
package com.example.cyborg2
import android.bluetooth.BluetoothA2dp
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothHeadset
import android.bluetooth.BluetoothProfile
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
@vlad-ds
vlad-ds / bot_template.py
Created September 11, 2023 08:10
Telegram Bot Template
import os
from dotenv import load_dotenv
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
load_dotenv()
TOKEN = os.environ["BOT_TOKEN"]