Skip to content

Instantly share code, notes, and snippets.

View joeface's full-sized avatar
🛀
Home-Office

Mikhail Ageev joeface

🛀
Home-Office
View GitHub Profile
@joeface
joeface / discovery.py
Created June 11, 2022 16:05
Blocked Websites Discovery based on OONI API
import difflib
import json
import os
import re
import requests
import sys
from datetime import datetime, timedelta
from pprint import pprint
@joeface
joeface / Dockerfile
Created April 10, 2020 11:26
Docker Container for COVID-19 Parser
FROM python:3.8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ADD main.py /
ADD requirements.txt /
# Set up and activate virtual environment
ENV VIRTUAL_ENV "/venv"
@joeface
joeface / main.py
Last active April 10, 2020 11:23
COVID-19 Data parser for Google Cloud/Amazon Lambda with support of Redis and Amazon S3-type Cloud Storage
'''
Fetchs COVID-19 spread data from 4 sources:
1. CSSE at JHU ArcGIS,
2. CSSE at JHU github repo
3. Worldometer website
4. Manual Input from Google Spreadsheet
Combines the data and uploads on a Amazon S3-type Cloud-Storage
'''
@joeface
joeface / google_spreadsheet_parser.py
Created April 10, 2020 11:02
Fetching and parsing data from Google Spreadsheet
"""
Fetch and parse data from Google Spreadsheet CSV
Requires requests package to be installed: pip install requests
Spreadsheet URL: https://docs.google.com/spreadsheets/d/10Xlr25Qtb-sRDJPqX66zqPPEP8yignUsPxxhT0O9Zb0/edit?usp=sharing
CSV export URL: https://docs.google.com/spreadsheets/d/e/2PACX-1vSZ_YhO6H0Q-dBX1sifVmDN9nonyx0xBePvqsU6NdsJJVO-B1MdBRXRCjHo9NBlYpl96AZai8_HGXKa/pub?gid=0&single=true&output=csv
"""
from io import StringIO
@joeface
joeface / soup.py
Created May 4, 2019 17:09
Parse Kremlin search results with Python
from bs4 import BeautifulSoup
# Initialize a bs4 instance with a HTML-source
page_dom = BeautifulSoup(page_html, "html.parser")
# Iterate over all DIVs with class hentry_event
for line in page_dom.find_all('div', class_="hentry_event"):
# Find first A inside the DIV and get innerText
title = line.find('a').contents[0]
@joeface
joeface / requests.py
Last active May 4, 2019 17:01
Python requests lib example
import requests
# Retrieving Vladimir Putin's interviews from Kremlin website
response = requests.get('http://en.kremlin.ru/search', params={'query': 'interview'}, timeout=40)
# Checking response status code
if response.status_code == requests.codes.ok:
# Output response content as a string
print response.text
else: