Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Ashish Cherian PandaWhoCodes

View GitHub Profile
View nginx_port_forwarding
server {
listen 80;
server_name utils.infoassistants.com;
location / {
proxy_pass http://localhost:3500;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@PandaWhoCodes
PandaWhoCodes / SFTP.py
Created Apr 12, 2021 — forked from billcrook/SFTP.py
An SFTP util class I created for use in my airflow pipelines. Not beautiful, but it works.
View SFTP.py
import logging
import pexpect
from airflow.hooks.base_hook import BaseHook
class SFTP(object):
"""
Requires openssh_client. Spawns process to execute sftp command.
"""
@PandaWhoCodes
PandaWhoCodes / get_old_rss.py
Last active Sep 7, 2020
Get all items in an RSS feed. You can set the MAX ID higher to get more items from the feeds
View get_old_rss.py
import pandas as pd
import requests
import feedparser
import time
import requests
def parse_rss_feed(url):
# Read feed xml data
# Try 3 times requesting the url if error
for i in range(0, 4):
@PandaWhoCodes
PandaWhoCodes / get_feed_links.py
Created Sep 5, 2020
Extract Feed URL's from a given URL
View get_feed_links.py
@PandaWhoCodes
PandaWhoCodes / url_to_txt.py
Created Jul 16, 2020
Extracts the text from a webpage and saves it to a text file
View url_to_txt.py
"""
Gets the webpage
Converts the HTML to a readable HTML using readability
Extracts the text and saves it to a text file.
usage - python url_to_txt.py http://example.com
"""
from readability import Document
from bs4 import BeautifulSoup
from urllib.parse import urlparse
View database_temp.py
import sqlite3
db_name = "database.db"
def create_connection(db_file):
""" create a database connection to the SQLite database
specified by db_file
:param db_file: database file
:return: Connection object or None
@PandaWhoCodes
PandaWhoCodes / get_gaps.py
Created Apr 15, 2020
gets gaps from uber suggest keywords
View get_gaps.py
import glob
import pandas as pd
import os
def get_file_names(path=os.getcwd()):
return glob.glob(path + "/ubersuggest_*.csv")
def get_file(filename):
View google_sheet_api.gs
// original gist: https://gist.github.com/willpatera/ee41ae374d3c9839c2d6
function doGet(e){
return handleResponse(e);
}
// Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service
@PandaWhoCodes
PandaWhoCodes / verify_mails.py
Created Mar 7, 2020
Code to verify emails from a given csv file
View verify_mails.py
# pip install verify-email (before running this)
import pandas as pd
from verify_email import verify_email
import pickle
final_row = ["S.No", "Name of Student", "Email", "valid"]
def get_file(filename):
return pd.read_csv(filename)
@PandaWhoCodes
PandaWhoCodes / Keyword_gap_analysis.py
Created Mar 6, 2020
convert ubersuggest keywords into a gap analysis
View Keyword_gap_analysis.py
import glob
import pandas as pd
import os
def get_file_names(path=os.getcwd()):
return glob.glob(path + "/ubersuggest_*.csv")
def get_file(filename):